Comment 3 for bug 892820

Revision history for this message
Robert Collins (lifeless) wrote : Re: Timeout on Distribution:+bugs

Ah, I'm seeing different (more complex) rules - due to disclosure.private_bug_visibility_rules.enabled being on for team:launchpad.

Original OOPS has:
SELECT BugTask.status,
       BugTask.assignee,
       BugTask.bug,
       BugTask.bugwatch,
       BugTask.date_assigned,
       BugTask.date_closed,
       BugTask.date_confirmed,
       BugTask.date_fix_committed,
       BugTask.date_fix_released,
       BugTask.date_incomplete,
       BugTask.date_inprogress,
       BugTask.date_left_closed,
       BugTask.date_left_new,
       BugTask.date_triaged,
       BugTask.datecreated,
       BugTask.distribution,
       BugTask.distroseries,
       BugTask.heat,
       BugTask.id,
       BugTask.importance,
       BugTask.milestone,
       BugTask.owner,
       BugTask.product,
       BugTask.productseries,
       BugTask.sourcepackagename,
       BugTask.targetnamecache,
       Bug.date_last_message,
       Bug.date_last_updated,
       Bug.date_made_private,
       Bug.datecreated,
       Bug.description,
       Bug.duplicateof,
       Bug.heat,
       Bug.heat_last_updated,
       Bug.id,
       Bug.latest_patch_uploaded,
       Bug.message_count,
       Bug.name,
       Bug.number_of_duplicates,
       Bug.owner,
       Bug.private,
       Bug.security_related,
       Bug.title,
       Bug.users_affected_count,
       Bug.users_unaffected_count,
       Bug.who_made_private
FROM BugTask
JOIN Bug ON BugTask.bug = Bug.id
WHERE Bug.id = BugTask.bug
  AND BugTask.importance IN (5)
  AND BugTask.distribution = 1
  AND (BugTask.status IN (10))
  AND Bug.duplicateof IS NULL
  AND BugTask.id IN
    (SELECT BugTask.id
     FROM BugTask,
          Product
     WHERE BugTask.product = Product.id
       AND Product.bug_supervisor = 343381
     UNION ALL SELECT BugTask.id
     FROM BugTask,
          StructuralSubscription
     WHERE BugTask.distribution = StructuralSubscription.distribution
       AND BugTask.sourcepackagename = StructuralSubscription.sourcepackagename
       AND StructuralSubscription.subscriber = 343381
     UNION ALL SELECT BugTask.id
     FROM BugTask,
          Distribution
     WHERE BugTask.distribution = Distribution.id
       AND Distribution.bug_supervisor = 343381)
  AND (Bug.private = FALSE
       OR EXISTS (WITH teams AS
                    (SELECT team
                     FROM TeamParticipation
                     WHERE person = 2)
                  SELECT BugSubscription.bug
                  FROM BugSubscription
                  WHERE BugSubscription.person IN
                      (SELECT team
                       FROM teams)
                    AND BugSubscription.bug = Bug.id
                  UNION
                  SELECT BugTask.bug
                  FROM BugTask
                  WHERE BugTask.assignee IN
                      (SELECT team
                       FROM teams)
                    AND BugTask.bug = Bug.id
                  UNION
                  SELECT BugTask.bug
                  FROM BugTask,
                       Product
                  WHERE Product.owner IN
                      (SELECT team
                       FROM teams)
                    AND BugTask.product = Product.id
                    AND BugTask.bug = Bug.id
                    AND Bug.security_related IS FALSE
                  UNION
                  SELECT BugTask.bug
                  FROM BugTask,
                       ProductSeries
                  WHERE ProductSeries.owner IN
                      (SELECT team
                       FROM teams)
                    AND BugTask.productseries = ProductSeries.id
                    AND BugTask.bug = Bug.id
                    AND Bug.security_related IS FALSE
                  UNION
                  SELECT BugTask.bug
                  FROM BugTask,
                       Distribution
                  WHERE Distribution.owner IN
                      (SELECT team
                       FROM teams)
                    AND BugTask.distribution = Distribution.id
                    AND BugTask.bug = Bug.id
                    AND Bug.security_related IS FALSE
                  UNION
                  SELECT BugTask.bug
                  FROM BugTask,
                       DistroSeries,
                       Distribution
                  WHERE Distribution.owner IN
                      (SELECT team
                       FROM teams)
                    AND DistroSeries.distribution = Distribution.id
                    AND BugTask.distroseries = DistroSeries.id
                    AND BugTask.bug = Bug.id
                    AND Bug.security_related IS FALSE))
ORDER BY BugTask.datecreated LIMIT 76
OFFSET 0