Comment 7 for bug 892820

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

https://lp-oops.canonical.com/oops.py/?oopsid=OOPS-61398f63dc890e7f5cf2b3276ae04ecf#statementlog is the page in question as an anonymous user.

Query there has the same structsub entries etc - and works nice and fast.
SELECT BugTask.*, Bug.*
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 NOT EXISTS
    (SELECT TRUE
     FROM BugTag
     WHERE BugTag.bug = Bug.id
       AND BugTag.tag = 'notserv')
  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
ORDER BY BugTask.datecreated LIMIT 76
OFFSET 0;