explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7F8R

Settings
# exclusive inclusive rows x rows loops node
1. 3.748 285.109 ↓ 177.0 177 1

GroupAggregate (cost=8,533.21..8,533.25 rows=1 width=28) (actual time=278.943..285.109 rows=177 loops=1)

  • Group Key: survey_sentemployeegroup.original_id
  • Filter: (count(CASE WHEN survey_surveytaker.complete THEN survey_sentemployeegroup_takers.surveytaker_id ELSE NULL::integer END) > 0)
  • Rows Removed by Filter: 22
2. 10.022 281.361 ↓ 33,950.0 33,950 1

Sort (cost=8,533.21..8,533.21 rows=1 width=9) (actual time=278.932..281.361 rows=33,950 loops=1)

  • Sort Key: survey_sentemployeegroup.original_id
  • Sort Method: quicksort Memory: 3,128kB
3. 22.908 271.339 ↓ 33,950.0 33,950 1

Nested Loop (cost=2,994.61..8,533.20 rows=1 width=9) (actual time=169.000..271.339 rows=33,950 loops=1)

4. 10.029 180.531 ↓ 33,950.0 33,950 1

Hash Join (cost=2,994.17..8,529.55 rows=1 width=12) (actual time=168.977..180.531 rows=33,950 loops=1)

  • Hash Cond: ("ANY_subquery".surveytaker_id = survey_sentemployeegroup_takers.surveytaker_id)
5. 0.699 20.174 ↓ 1.0 4,244 1

Subquery Scan on ANY_subquery (cost=0.57..5,520.25 rows=4,183 width=4) (actual time=18.630..20.174 rows=4,244 loops=1)

6. 5.463 19.475 ↓ 1.0 4,244 1

HashSetOp Intersect (cost=0.57..5,478.42 rows=4,183 width=8) (actual time=18.629..19.475 rows=4,244 loops=1)

7. 3.559 14.012 ↑ 1.2 52,676 1

Append (cost=0.57..5,321.84 rows=62,632 width=8) (actual time=0.021..14.012 rows=52,676 loops=1)

8. 0.355 0.866 ↓ 1.0 4,244 1

Subquery Scan on *SELECT* 2 (cost=0.57..348.07 rows=4,201 width=8) (actual time=0.021..0.866 rows=4,244 loops=1)

9. 0.511 0.511 ↓ 1.0 4,244 1

Index Only Scan using survey_sentemployeeg_sentemployeegroup_id_4c60698edfdf70f4_uniq on survey_sentemployeegroup_takers survey_sentemployeegroup_takers_1 (cost=0.57..306.06 rows=4,201 width=4) (actual time=0.020..0.511 rows=4,244 loops=1)

  • Index Cond: (sentemployeegroup_id = 42,802,206)
  • Heap Fetches: 0
10. 3.967 9.587 ↑ 1.2 48,432 1

Subquery Scan on *SELECT* 1 (cost=0.57..4,660.61 rows=58,431 width=8) (actual time=0.010..9.587 rows=48,432 loops=1)

11. 5.620 5.620 ↑ 1.2 48,432 1

Index Only Scan using survey_sentemployeeg_sentemployeegroup_id_4c60698edfdf70f4_uniq on survey_sentemployeegroup_takers survey_sentemployeegroup_takers_2 (cost=0.57..4,076.30 rows=58,431 width=4) (actual time=0.009..5.620 rows=48,432 loops=1)

  • Index Cond: (sentemployeegroup_id = 42,684,578)
  • Heap Fetches: 0
12. 59.610 150.328 ↓ 7,253.8 413,469 1

Hash (cost=2,992.89..2,992.89 rows=57 width=8) (actual time=150.328..150.328 rows=413,469 loops=1)

  • Buckets: 524,288 (originally 1024) Batches: 1 (originally 1) Memory Usage: 20,248kB
13. 38.715 90.718 ↓ 7,253.8 413,469 1

Nested Loop (cost=834.84..2,992.89 rows=57 width=8) (actual time=0.592..90.718 rows=413,469 loops=1)

14. 0.353 0.876 ↓ 198.2 1,189 1

Bitmap Heap Scan on survey_sentemployeegroup (cost=834.27..858.39 rows=6 width=8) (actual time=0.540..0.876 rows=1,189 loops=1)

  • Recheck Cond: ((instance_id = 25,335) AND (category_id = ANY ('{146892,145818,144180,144179,144178,144177,144176,144175,144174,144173,144076,144075,144074,144073,144072}'::integer[])))
  • Filter: (original_id IS NOT NULL)
  • Heap Blocks: exact=72
15. 0.027 0.523 ↓ 0.0 0 1

BitmapAnd (cost=834.27..834.27 rows=6 width=0) (actual time=0.523..0.523 rows=0 loops=1)

16. 0.414 0.414 ↓ 3.0 9,740 1

Bitmap Index Scan on survey_sentemployeegroup_instance_id (cost=0.00..89.30 rows=3,299 width=0) (actual time=0.414..0.414 rows=9,740 loops=1)

  • Index Cond: (instance_id = 25,335)
17. 0.082 0.082 ↑ 22.0 1,189 1

Bitmap Index Scan on survey_sentemployeegroup_category_id (cost=0.00..744.71 rows=26,169 width=0) (actual time=0.082..0.082 rows=1,189 loops=1)

  • Index Cond: (category_id = ANY ('{146892,145818,144180,144179,144178,144177,144176,144175,144174,144173,144076,144075,144074,144073,144072}'::integer[]))
18. 51.127 51.127 ↑ 12.6 348 1,189

Index Only Scan using survey_sentemployeeg_sentemployeegroup_id_4c60698edfdf70f4_uniq on survey_sentemployeegroup_takers (cost=0.57..311.85 rows=4,390 width=8) (actual time=0.003..0.043 rows=348 loops=1,189)

  • Index Cond: (sentemployeegroup_id = survey_sentemployeegroup.id)
  • Heap Fetches: 0
19. 67.900 67.900 ↑ 1.0 1 33,950

Index Scan using survey_surveytaker_pkey on survey_surveytaker (cost=0.43..3.65 rows=1 width=5) (actual time=0.002..0.002 rows=1 loops=33,950)

  • Index Cond: (id = survey_sentemployeegroup_takers.surveytaker_id)
  • Filter: ((complete OR (NOT skip_when_counting) OR (skip_when_counting IS NULL)) AND (instance_id = 25,335))
Planning time : 1.120 ms
Execution time : 286.714 ms