explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aUse

Settings
# exclusive inclusive rows x rows loops node
1. 453.902 6,760.507 ↓ 22,658.0 22,658 1

GroupAggregate (cost=119,641.55..119,641.61 rows=1 width=28) (actual time=5,893.031..6,760.507 rows=22,658 loops=1)

  • Group Key: survey_sentemployeegroup.original_id
  • Filter: (count(survey_sentemployeegroup_takers.surveytaker_id) FILTER (WHERE survey_surveytaker.complete) > 0)
  • Rows Removed by Filter: 650
2. 1,702.205 6,306.605 ↓ 1,048,583.0 2,097,166 1

Sort (cost=119,641.55..119,641.55 rows=2 width=9) (actual time=5,887.684..6,306.605 rows=2,097,166 loops=1)

  • Sort Key: survey_sentemployeegroup.original_id
  • Sort Method: external merge Disk: 39,000kB
3. 1,024.061 4,604.400 ↓ 1,048,583.0 2,097,166 1

Hash Join (cost=15,052.48..119,641.54 rows=2 width=9) (actual time=84.839..4,604.400 rows=2,097,166 loops=1)

  • Hash Cond: (survey_sentemployeegroup_takers.sentemployeegroup_id = survey_sentemployeegroup.id)
4. 601.479 3,534.975 ↓ 122.3 2,633,350 1

Nested Loop (cost=984.09..105,516.62 rows=21,533 width=9) (actual time=39.455..3,534.975 rows=2,633,350 loops=1)

5. 68.860 468.260 ↓ 965.6 66,628 1

Nested Loop (cost=983.52..98,941.01 rows=69 width=9) (actual time=39.424..468.260 rows=66,628 loops=1)

6. 52.732 66.260 ↓ 5.3 66,628 1

HashAggregate (cost=983.08..1,108.71 rows=12,563 width=4) (actual time=39.394..66.260 rows=66,628 loops=1)

  • Group Key: u0.surveytaker_id
7. 13.528 13.528 ↓ 5.2 66,628 1

Index Only Scan using survey_sentemployeeg_sentemployeegroup_id_4c60698edfdf70f4_uniq on survey_sentemployeegroup_takers u0 (cost=0.57..951.25 rows=12,734 width=4) (actual time=0.044..13.528 rows=66,628 loops=1)

  • Index Cond: (sentemployeegroup_id = ANY ('{36114328,44099713,42159591}'::integer[]))
  • Heap Fetches: 0
8. 333.140 333.140 ↑ 1.0 1 66,628

Index Scan using survey_surveytaker_pkey on survey_surveytaker (cost=0.43..7.79 rows=1 width=5) (actual time=0.005..0.005 rows=1 loops=66,628)

  • Index Cond: (id = u0.surveytaker_id)
  • Filter: ((complete OR (NOT skip_when_counting) OR (skip_when_counting IS NULL)) AND (instance_id = ANY ('{25849,25147,23929}'::integer[])))
9. 2,465.236 2,465.236 ↑ 7.8 40 66,628

Index Scan using survey_sentemployeegroup_takers_surveytaker_id on survey_sentemployeegroup_takers (cost=0.57..92.16 rows=314 width=8) (actual time=0.011..0.037 rows=40 loops=66,628)

  • Index Cond: (surveytaker_id = survey_surveytaker.id)
10. 12.656 45.364 ↓ 39.4 52,598 1

Hash (cost=14,051.70..14,051.70 rows=1,335 width=8) (actual time=45.363..45.364 rows=52,598 loops=1)

  • Buckets: 65,536 (originally 2048) Batches: 1 (originally 1) Memory Usage: 2,567kB
11. 20.594 32.708 ↓ 39.4 52,598 1

Bitmap Heap Scan on survey_sentemployeegroup (cost=8,703.42..14,051.70 rows=1,335 width=8) (actual time=12.412..32.708 rows=52,598 loops=1)

  • Recheck Cond: ((instance_id = ANY ('{25849,25147,23929}'::integer[])) AND (category_id = ANY ('{126815,126816,126817,126818,126819,126820,126821,126822,126823,126824,126825,126826,126827,126828,126829,126830,126831,126832,126833,126834,126835,126836,126837,126838,126839,126840,126841,126842,126843,126844,126845,126846,126847,126848,126849,126850,126851,126852,126853,126854,142149,142148,142147,142146,142145,142144,142143,142142,142141,142140,142139,142138,142137,142136,142135,142134,142133,142132,142131,142130,142129,142128,142127,142126,142125,142124,142123,142122,142121,142120,142119,142118,142117,142116,142043,141991,141990,141989,141988,141987,141986,141985,141984,149695,149694,149693,149692,149691,149690,149689,149688,149687,149686,149685,149684,149683,149682,149681,149680,149679,149678,149677,149676,149675,149674,149673,149672,149671,149670,149669,149668,149667,149666,149665,149664,149663,149659,149658,149657,149656,149655,149654,149653,149652,149651}'::integer[])))
  • Filter: (original_id IS NOT NULL)
  • Heap Blocks: exact=1,838
12. 0.322 12.114 ↓ 0.0 0 1

BitmapAnd (cost=8,703.42..8,703.42 rows=1,335 width=0) (actual time=12.114..12.114 rows=0 loops=1)

13. 8.029 8.029 ↓ 1.4 127,436 1

Bitmap Index Scan on survey_sentemployeegroup_instance_id (cost=0.00..2,509.81 rows=93,350 width=0) (actual time=8.029..8.029 rows=127,436 loops=1)

  • Index Cond: (instance_id = ANY ('{25849,25147,23929}'::integer[]))
14. 3.763 3.763 ↑ 4.2 52,598 1

Bitmap Index Scan on survey_sentemployeegroup_category_id (cost=0.00..6,192.69 rows=220,657 width=0) (actual time=3.763..3.763 rows=52,598 loops=1)

  • Index Cond: (category_id = ANY ('{126815,126816,126817,126818,126819,126820,126821,126822,126823,126824,126825,126826,126827,126828,126829,126830,126831,126832,126833,126834,126835,126836,126837,126838,126839,126840,126841,126842,126843,126844,126845,126846,126847,126848,126849,126850,126851,126852,126853,126854,142149,142148,142147,142146,142145,142144,142143,142142,142141,142140,142139,142138,142137,142136,142135,142134,142133,142132,142131,142130,142129,142128,142127,142126,142125,142124,142123,142122,142121,142120,142119,142118,142117,142116,142043,141991,141990,141989,141988,141987,141986,141985,141984,149695,149694,149693,149692,149691,149690,149689,149688,149687,149686,149685,149684,149683,149682,149681,149680,149679,149678,149677,149676,149675,149674,149673,149672,149671,149670,149669,149668,149667,149666,149665,149664,149663,149659,149658,149657,149656,149655,149654,149653,149652,149651}'::integer[]))
Planning time : 2.395 ms
Execution time : 6,772.340 ms