explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Gj1t

Settings
# exclusive inclusive rows x rows loops node
1. 217.882 3,860.560 ↓ 22,658.0 22,658 1

GroupAggregate (cost=119,641.53..119,641.59 rows=1 width=28) (actual time=3,452.857..3,860.560 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. 943.819 3,642.678 ↓ 1,048,583.0 2,097,166 1

Sort (cost=119,641.53..119,641.53 rows=2 width=9) (actual time=3,450.340..3,642.678 rows=2,097,166 loops=1)

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

Hash Join (cost=15,052.48..119,641.52 rows=2 width=9) (actual time=49.582..2,698.859 rows=2,097,166 loops=1)

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

Nested Loop (cost=984.09..105,516.60 rows=21,533 width=9) (actual time=22.804..2,071.403 rows=2,633,350 loops=1)

5. 54.193 297.216 ↓ 965.6 66,628 1

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

6. 36.057 43.139 ↓ 5.3 66,628 1

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

  • Group Key: u0.surveytaker_id
7. 7.082 7.082 ↓ 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.029..7.082 rows=66,628 loops=1)

  • Index Cond: (sentemployeegroup_id = ANY ('{36114328,44099713,42159591}'::integer[]))
  • Heap Fetches: 0
8. 199.884 199.884 ↑ 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.003..0.003 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. 1,399.188 1,399.188 ↑ 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.006..0.021 rows=40 loops=66,628)

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

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

  • Buckets: 65,536 (originally 2048) Batches: 1 (originally 1) Memory Usage: 2,567kB
11. 11.778 18.917 ↓ 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=7.367..18.917 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.255 7.139 ↓ 0.0 0 1

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

13. 4.635 4.635 ↓ 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=4.635..4.635 rows=127,436 loops=1)

  • Index Cond: (instance_id = ANY ('{25849,25147,23929}'::integer[]))
14. 2.249 2.249 ↑ 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=2.249..2.249 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 : 1.564 ms
Execution time : 3,868.494 ms