Comment 2 for bug 618396

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

                                                                                          QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit (cost=13737674.36..13737674.55 rows=76 width=2316) (actual time=3518.337..3518.372 rows=76 loops=1)
   -> Sort (cost=13737674.36..13737675.32 rows=384 width=2316) (actual time=3518.335..3518.355 rows=76 loops=1)
         Sort Key: bugtask.importance, bugtask.id
         Sort Method: top-N heapsort Memory: 187kB
         -> Nested Loop Left Join (cost=0.00..13737660.44 rows=384 width=2316) (actual time=10.401..3515.553 rows=184 loops=1)
               -> Nested Loop Left Join (cost=0.00..13737540.71 rows=384 width=1022) (actual time=10.395..3513.918 rows=184 loops=1)
                     -> Nested Loop (cost=0.00..13737430.42 rows=384 width=1005) (actual time=10.378..3512.234 rows=184 loops=1)
                           Join Filter: (((bug.fti)::tsvector @@ '''someth'' & ''strang'''::tsquery) OR ((bugtask.fti)::tsvector @@ '''someth'' & ''strang'''::tsquery))
                           -> Seq Scan on bugtask (cost=0.00..48352.10 rows=245470 width=398) (actual time=0.028..512.107 rows=278783 loops=1)
                                 Filter: ((status = 10) OR (status = 15) OR (status = 20) OR (status = 21) OR (status = 22) OR (status = 25))
                           -> Index Scan using bug_pkey on bug (cost=0.00..55.75 rows=1 width=1109) (actual time=0.007..0.007 rows=1 loops=278783)
                                 Index Cond: (bug.id = bugtask.bug)
                                 Filter: ((bug.duplicateof IS NULL) AND ((NOT bug.private) OR (subplan)))
                                 SubPlan
                                   -> Nested Loop (cost=0.00..53.88 rows=1 width=4) (actual time=0.022..0.022 rows=1 loops=13951)
                                         -> Index Scan using bugsubscription_bug_idx on bugsubscription (cost=0.00..9.10 rows=7 width=8) (actual time=0.007..0.008 rows=3 loops=13951)
                                               Index Cond: (bug = $0)
                                         -> Index Scan using teamparticipation_team_key on teamparticipation (cost=0.00..6.38 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=35789)
                                               Index Cond: ((teamparticipation.team = bugsubscription.person) AND (teamparticipation.person = 2))
                     -> Index Scan using sourcepackagename_pkey on sourcepackagename (cost=0.00..0.27 rows=1 width=17) (actual time=0.006..0.006 rows=1 loops=184)
                           Index Cond: (bugtask.sourcepackagename = sourcepackagename.id)
               -> Index Scan using product_pkey on product (cost=0.00..0.30 rows=1 width=1294) (actual time=0.004..0.004 rows=0 loops=184)
                     Index Cond: (bugtask.product = product.id)
 Total runtime: 3518.964 ms

- its having to sort the results