explain.depesz.com

PostgreSQL's explain analyze made readable

Result: o5LX : Optimization for: plan #sCUx

Settings

Optimization path:

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

CTE Scan on subtopic_breakdown (cost=104.66..108.66 rows=200 width=24) (actual time=10.342..10.361 rows=5 loops=1)

2.          

CTE subtopic_breakdown

3. 1.474 10.344 ↑ 40.0 5 1

HashAggregate (cost=102.66..104.66 rows=200 width=24) (actual time=10.333..10.344 rows=5 loops=1)

  • Group Key: q.topic_id, q.subtopic_id
4. 2.495 8.870 ↓ 2.0 1,000 1

GroupAggregate (cost=0.57..92.74 rows=496 width=16) (actual time=0.117..8.870 rows=1,000 loops=1)

  • Group Key: q.question_id
5. 2.741 6.375 ↓ 2.0 1,000 1

Merge Join (cost=0.57..82.82 rows=496 width=20) (actual time=0.090..6.375 rows=1,000 loops=1)

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

Index Only Scan using ix_super on questions q (cost=0.28..46.28 rows=2,000 width=16) (actual time=0.037..2.565 rows=2,000 loops=1)

  • Index Cond: (question_set_id = 2)
  • Heap Fetches: 0
7. 1.069 1.069 ↓ 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.034..1.069 rows=1,000 loops=1)

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