From staging:
Limit (cost=148649.73..148651.84 rows=51 width=57) (actual time=23673.661..23675.791 rows=51 loops=1) -> Unique (cost=148649.73..153285.81 rows=112426 width=57) (actual time=23673.659..23675.778 rows=51 loops=1) -> Sort (cost=148649.73..149036.07 rows=154536 width=57) (actual time=23673.656..23674.758 rows=1606 loops=1) Sort Key: buildfarmjob.date_finished, buildfarmjob.id, buildfarmjob.date_created, buildfarmjob.date_first_dispatched, buildfarmjob.date_started, buildfarmjob.job_type, buildfarmjob.log, buildfarmjob.processor, buildfarmjob.status, buildfarmjob.virtualized Sort Method: external merge Disk: 171056kB -> Hash Left Join (cost=74869.48..143494.09 rows=154536 width=57) (actual time=609.450..3272.502 rows=2275497 loops=1) Hash Cond: (packagebuild.archive = archive.id) Filter: ((NOT COALESCE(archive.private, false)) OR (teamparticipation.person = 2)) -> Merge Right Join (cost=28166.54..89063.64 rows=56213 width=61) (actual time=339.722..2067.928 rows=53331 loops=1) Merge Cond: (packagebuild.build_farm_job = buildfarmjob.id) -> Index Scan using packagebuild__build_farm_job__idx on packagebuild (cost=0.00..55396.04 rows=1863177 width=8) (actual time=0.034..1292.351 rows=1863124 loops=1) -> Sort (cost=28166.54..28307.08 rows=56213 width=57) (actual time=237.429..282.928 rows=53331 loops=1) Sort Key: buildfarmjob.id Sort Method: quicksort Memory: 9036kB -> Bitmap Heap Scan on buildfarmjob (cost=931.06..23731.73 rows=56213 width=57) (actual time=30.516..125.626 rows=53331 loops=1) Recheck Cond: (builder = 3) -> Bitmap Index Scan on buildfarmjob__builder_and_status__idx (cost=0.00..917.01 rows=56213 width=0) (actual time=22.007..22.007 rows=53331 loops=1) Index Cond: (builder = 3) -> Hash (cost=45335.51..45335.51 rows=109394 width=9) (actual time=269.627..269.627 rows=49138 loops=1) -> Nested Loop Left Join (cost=0.00..45335.51 rows=109394 width=9) (actual time=0.044..238.518 rows=49138 loops=1) -> Seq Scan on archive (cost=0.00..1490.99 rows=19899 width=9) (actual time=0.010..9.088 rows=19899 loops=1) -> Index Scan using teamparticipation_team_key on teamparticipation (cost=0.00..2.13 rows=6 width=8) (actual time=0.007..0.009 rows=2 loops=19899) Index Cond: (teamparticipation.team = archive.owner) Total runtime: 23744.002 ms (24 rows)
From staging:
Limit (cost=148649. 73..148651. 84 rows=51 width=57) (actual time=23673. 661..23675. 791 rows=51 loops=1) 73..153285. 81 rows=112426 width=57) (actual time=23673. 659..23675. 778 rows=51 loops=1) 73..149036. 07 rows=154536 width=57) (actual time=23673. 656..23674. 758 rows=1606 loops=1) date_finished, buildfarmjob.id, buildfarmjob. date_created, buildfarmjob. date_first_ dispatched, buildfarmjob. date_started, buildfarmjob. job_type, buildfarmjob.log, buildfarmjob. processor, buildfarmjob. status, buildfarmjob. virtualized 48..143494. 09 rows=154536 width=57) (actual time=609. 450..3272. 502 rows=2275497 loops=1)
Hash Cond: (packagebuild. archive = archive.id)
Filter: ((NOT COALESCE( archive. private, false)) OR (teamparticipat ion.person = 2))
-> Merge Right Join (cost=28166. 54..89063. 64 rows=56213 width=61) (actual time=339. 722..2067. 928 rows=53331 loops=1)
Merge Cond: (packagebuild. build_farm_ job = buildfarmjob.id)
- > Index Scan using packagebuild_ _build_ farm_job_ _idx on packagebuild (cost=0. 00..55396. 04 rows=1863177 width=8) (actual time=0. 034..1292. 351 rows=1863124 loops=1)
- > Sort (cost=28166. 54..28307. 08 rows=56213 width=57) (actual time=237. 429..282. 928 rows=53331 loops=1)
Sort Key: buildfarmjob.id
Sort Method: quicksort Memory: 9036kB
-> Bitmap Heap Scan on buildfarmjob (cost=931. 06..23731. 73 rows=56213 width=57) (actual time=30. 516..125. 626 rows=53331 loops=1)
Recheck Cond: (builder = 3)
-> Bitmap Index Scan on buildfarmjob_ _builder_ and_status_ _idx (cost=0.00..917.01 rows=56213 width=0) (actual time=22.007..22.007 rows=53331 loops=1)
Index Cond: (builder = 3)
-> Hash (cost=45335. 51..45335. 51 rows=109394 width=9) (actual time=269. 627..269. 627 rows=49138 loops=1)
- > Nested Loop Left Join (cost=0. 00..45335. 51 rows=109394 width=9) (actual time=0.044..238.518 rows=49138 loops=1)
-> Seq Scan on archive (cost=0.00..1490.99 rows=19899 width=9) (actual time=0.010..9.088 rows=19899 loops=1)
-> Index Scan using teamparticipati on_team_ key on teamparticipation (cost=0.00..2.13 rows=6 width=8) (actual time=0.007..0.009 rows=2 loops=19899)
Index Cond: (teamparticipat ion.team = archive.owner)
-> Unique (cost=148649.
-> Sort (cost=148649.
Sort Key: buildfarmjob.
Sort Method: external merge Disk: 171056kB
-> Hash Left Join (cost=74869.
Total runtime: 23744.002 ms
(24 rows)