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
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 structuralsubsc ription ss on (
BugTask. product = ss.product productseries = ss.productseries distribution = ss.distribution sourcepackagena me = ss.sourcepackag ename ename IS NULL) distroseries = ss.distroseries patch_uploaded IS NOT NULL
ss.subscriber = 343381
and(
OR BugTask.
OR Product.project = ss.project
OR BugTask.
AND (BugTask.
OR ss.sourcepackag
OR BugTask.
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_
AND Bug.private = FALSE;
(this restores the subscriber -> all of the other constraints, and blows the time out again). 30..703183. 55 rows=22125 width=4)
HashAggregate (cost=702962.
however this: ription ss on ( distribution = ss.distribution AND (BugTask. sourcepackagena me = ss.sourcepackag ename ename IS NULL) patch_uploaded IS NOT NULL
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 structuralsubsc
ss.subscriber = 343381
and (BugTask.
OR ss.sourcepackag
)
)
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_
AND Bug.private = FALSE;
only finds 100 bugs. So we're finding too many bugs with the long structsub clause