Comment 10 for bug 866100

Revision history for this message
Robert Collins (lifeless) wrote :

same plan.
take #2: bugaffectsperson has 1M rows in it.

set enable_bitmapscan = 0;
SELECT BugTask.*, Bug.*
FROM BugTask, Bug, BugAffectsPerson
WHERE
    Bug.id = BugTask.bug
    AND BugTask.product = 10294
    AND BugTask.status IN (10, 15, 20, 21, 22, 25)
    AND Bug.duplicateof IS NULL
    AND Bug.id = BugAffectsPerson.bug
    AND BugAffectsPerson.person = 78
    AND BugAffectsPerson.affected IS TRUE
ORDER BY Bug.date_last_updated DESC LIMIT 76 OFFSET 0;

 Limit (cost=2957.31..2957.31 rows=3 width=1520) (actual time=3.618..3.642 rows=64 loops=1)
   -> Sort (cost=2957.31..2957.31 rows=3 width=1520) (actual time=3.617..3.624 rows=64 loops=1)
         Sort Key: bug.date_last_updated
         Sort Method: quicksort Memory: 122kB
         -> Nested Loop (cost=0.00..2957.28 rows=3 width=1520) (actual time=0.098..3.364 rows=64 loops=1)
               -> Nested Loop (cost=0.00..2931.64 rows=4 width=407) (actual time=0.083..2.663 rows=73 loops=1)
                     -> Index Scan using bugaffectsperson__person__idx on bugaffectsperson (cost=0.00..941.40 rows=336 width=4) (actual time=0.029..0.665 rows=345 loops=1)
                           Index Cond: (person = 78)
                           Filter: (affected IS TRUE)
                     -> Index Scan using bugtask__product__bug__key on bugtask (cost=0.00..5.91 rows=1 width=403) (actual time=0.005..0.005 rows=0 loops=345)
                           Index Cond: ((bugtask.product = 10294) AND (bugtask.bug = bugaffectsperson.bug))
                           Filter: (bugtask.status = ANY ('{10,15,20,21,22,25}'::integer[]))
               -> Index Scan using bug_pkey on bug (cost=0.00..6.40 rows=1 width=1117) (actual time=0.007..0.008 rows=1 loops=73)
                     Index Cond: (bug.id = bugtask.bug)
                     Filter: (bug.duplicateof IS NULL)
 Total runtime: 3.800 ms