explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rjk

Settings
# exclusive inclusive rows x rows loops node
1. 0.020 10,602.240 ↑ 2.2 5 1

Sort (cost=65,097.41..65,097.43 rows=11 width=89) (actual time=10,602.240..10,602.240 rows=5 loops=1)

  • Sort Key: (((forms.follow_up_email IS NOT NULL) AND ((count(DISTINCT CASE WHEN (answers.follow_up IS TRUE) THEN answers.id ELSE NULL::integer END) > 0) OR (count(DISTINCT CASE WHEN (questions.follow_up IS TRUE) THEN questions.id ELSE NULL::integer END) > 0))))
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=6110005 read=1, temp read=9619 written=9619
2. 1,860.903 10,602.220 ↑ 2.2 5 1

GroupAggregate (cost=64,974.44..65,097.22 rows=11 width=89) (actual time=7,114.102..10,602.220 rows=5 loops=1)

  • Group Key: forms.id
  • Buffers: shared hit=6110005 read=1, temp read=9619 written=9619
3. 2,849.935 8,741.317 ↓ 283,080.4 3,113,884 1

Nested Loop Left Join (cost=64,974.44..65,096.91 rows=11 width=89) (actual time=1,516.472..8,741.317 rows=3,113,884 loops=1)

  • Buffers: shared hit=6110005 read=1, temp read=9619 written=9619
4. 1,318.789 3,555.969 ↓ 212,310.3 2,335,413 1

Merge Left Join (cost=64,974.15..64,974.39 rows=11 width=84) (actual time=1,516.461..3,555.969 rows=2,335,413 loops=1)

  • Merge Cond: (forms.id = questions.form_id)
  • Buffers: shared hit=186022, temp read=9619 written=9619
5. 905.126 1,767.810 ↓ 70,770.1 778,471 1

Sort (cost=64,836.84..64,836.86 rows=11 width=79) (actual time=1,516.351..1,767.810 rows=778,471 loops=1)

  • Sort Key: forms.id
  • Sort Method: external sort Disk: 76952kB
  • Buffers: shared hit=186002, temp read=9619 written=9619
6. 447.355 862.684 ↓ 70,770.1 778,471 1

Hash Right Join (cost=56.68..64,836.65 rows=11 width=79) (actual time=0.089..862.684 rows=778,471 loops=1)

  • Hash Cond: (form_responses.form_id = forms.id)
  • Join Filter: (forms.project_id = 20206)
  • Buffers: shared hit=186002
7. 415.269 415.269 ↓ 1.1 778,470 1

Index Only Scan using form_responses_form_id_mailing_id_covering_index on form_responses (cost=0.56..62,009.65 rows=734,125 width=16) (actual time=0.017..415.269 rows=778,470 loops=1)

  • Index Cond: (project_id = 20206)
  • Filter: ((deleted IS NOT TRUE) AND (is_unanswered IS NOT TRUE))
  • Rows Removed by Filter: 45737
  • Heap Fetches: 831
  • Buffers: shared hit=185987
8. 0.003 0.060 ↑ 2.2 5 1

Hash (cost=55.98..55.98 rows=11 width=71) (actual time=0.060..0.060 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
  • Buffers: shared hit=15
9. 0.032 0.057 ↑ 2.2 5 1

Bitmap Heap Scan on forms (cost=4.40..55.98 rows=11 width=71) (actual time=0.035..0.057 rows=5 loops=1)

  • Recheck Cond: (project_id = 20206)
  • Filter: (deleted IS NOT TRUE)
  • Rows Removed by Filter: 7
  • Heap Blocks: exact=12
  • Buffers: shared hit=15
10. 0.025 0.025 ↑ 1.2 12 1

Bitmap Index Scan on forms_project_id_index (cost=0.00..4.39 rows=15 width=0) (actual time=0.025..0.025 rows=12 loops=1)

  • Index Cond: (project_id = 20206)
  • Buffers: shared hit=3
11. 469.293 469.370 ↓ 66,724.5 2,335,359 1

Sort (cost=137.31..137.40 rows=35 width=9) (actual time=0.102..469.370 rows=2,335,359 loops=1)

  • Sort Key: questions.form_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=20
12. 0.054 0.077 ↑ 2.3 15 1

Bitmap Heap Scan on questions (cost=4.64..136.42 rows=35 width=9) (actual time=0.042..0.077 rows=15 loops=1)

  • Recheck Cond: (project_id = 20206)
  • Filter: (deleted IS NOT TRUE)
  • Rows Removed by Filter: 13
  • Heap Blocks: exact=18
  • Buffers: shared hit=20
13. 0.023 0.023 ↑ 1.6 28 1

Bitmap Index Scan on questions_project_id_index (cost=0.00..4.63 rows=46 width=0) (actual time=0.023..0.023 rows=28 loops=1)

  • Index Cond: (project_id = 20206)
  • Buffers: shared hit=2
14. 2,335.413 2,335.413 ↑ 1.0 1 2,335,413

Index Scan using answers_parent_question_id_index on answers (cost=0.29..11.13 rows=1 width=9) (actual time=0.001..0.001 rows=1 loops=2,335,413)

  • Index Cond: (questions.id = parent_question_id)
  • Filter: ((deleted IS NOT TRUE) AND (project_id = 20206))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=5923983 read=1
Planning time : 0.775 ms