explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sCUx

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 12.112 12.112 ↑ 40.0 5 1

CTE Scan on subtopic_breakdown (cost=144.33..148.33 rows=200 width=24) (actual time=12.093..12.112 rows=5 loops=1)

2.          

CTE subtopic_breakdown

3. 1.580 12.095 ↑ 40.0 5 1

HashAggregate (cost=142.33..144.33 rows=200 width=24) (actual time=12.086..12.095 rows=5 loops=1)

  • Group Key: q.topic_id, q.subtopic_id
4. 2.668 10.515 ↓ 2.0 1,000 1

GroupAggregate (cost=0.57..132.41 rows=496 width=16) (actual time=0.129..10.515 rows=1,000 loops=1)

  • Group Key: q.question_id
5. 3.808 7.847 ↓ 2.0 1,000 1

Merge Join (cost=0.57..122.49 rows=496 width=20) (actual time=0.101..7.847 rows=1,000 loops=1)

  • Merge Cond: (q.question_id = aq.question_id)
6. 2.883 2.883 ↑ 1.0 2,000 1

Index Scan using ix_questions_question_set_id_question_id_answer_index on questions q (cost=0.28..85.97 rows=2,000 width=16) (actual time=0.041..2.883 rows=2,000 loops=1)

  • Index Cond: (question_set_id = 2)
7. 1.156 1.156 ↓ 1.0 1,000 1

Index Only Scan using ix_answered_questions_user_id_q_set_id_q_id_answer_index on subscriptions_questions_association aq (cost=0.29..24.13 rows=992 width=8) (actual time=0.038..1.156 rows=1,000 loops=1)

  • Index Cond: ((user_id = 1) AND (question_set_id = 2))
  • Heap Fetches: 0