Comment 8 for bug 787294

Revision history for this message
Robert Collins (lifeless) wrote : Re: Person:+patches timeouts

Bah, clearly tired. Take 2:

SELECT distinct BugTask.bug FROM BugTask inner join bug on bug.id=bugtask.bug LEFT JOIN Product ON BugTask.product = Product.id AND Product.active inner join structuralsubscription ss on (
ss.subscriber = 343381
 and(
         BugTask.product = ss.product
         OR BugTask.productseries = ss.productseries
         OR Product.project = ss.project
         OR BugTask.distribution = ss.distribution
         AND (BugTask.sourcepackagename = ss.sourcepackagename
              OR ss.sourcepackagename IS NULL)
         OR BugTask.distroseries = ss.distroseries
         OR BugTask.milestone = ss.milestone)
)
         WHERE ((BugTask.status = 10) OR (BugTask.status = 15) OR (BugTask.status = 20) OR (BugTask.status = 21) OR (BugTask.status = 22) OR (BugTask.status = 25))
           AND Bug.duplicateof IS NULL
           AND Bug.latest_patch_uploaded IS NOT NULL
           AND Bug.private = FALSE;

(this restores the subscriber -> all of the other constraints, and blows the time out again).
 HashAggregate (cost=702962.30..703183.55 rows=22125 width=4)

however this:
SELECT distinct BugTask.bug FROM BugTask inner join bug on bug.id=bugtask.bug LEFT JOIN Product ON BugTask.product = Product.id AND Product.active inner join structuralsubscription ss on (
ss.subscriber = 343381
 and (BugTask.distribution = ss.distribution AND (BugTask.sourcepackagename = ss.sourcepackagename
              OR ss.sourcepackagename IS NULL)
  )
)
         WHERE ((BugTask.status = 10) OR (BugTask.status = 15) OR (BugTask.status = 20) OR (BugTask.status = 21) OR (BugTask.status = 22) OR (BugTask.status = 25))
           AND Bug.duplicateof IS NULL
           AND Bug.latest_patch_uploaded IS NOT NULL
           AND Bug.private = FALSE;

only finds 100 bugs. So we're finding too many bugs with the long structsub clause