explain.depesz.com

PostgreSQL's explain analyze made readable

Result: hbO2

Settings
# exclusive inclusive rows x rows loops node
1. 1.097 1,527.675 ↑ 1.0 1 1

Aggregate (cost=1,539.51..1,539.51 rows=1 width=32) (actual time=1,527.675..1,527.675 rows=1 loops=1)

2.          

CTE user_stat

3. 597.478 1,099.167 ↓ 125.6 886,446 1

HashAggregate (cost=1,470.55..1,491.73 rows=7,059 width=8) (actual time=875.745..1,099.167 rows=886,446 loops=1)

  • Group Key: ""user"".id, quiz_concept_question.id
4. 78.369 501.689 ↓ 125.6 886,446 1

Nested Loop (cost=712.08..1,463.49 rows=7,059 width=8) (actual time=4.281..501.689 rows=886,446 loops=1)

5. 0.073 0.128 ↓ 66.0 66 1

Hash Join (cost=6.25..7.48 rows=1 width=8) (actual time=0.026..0.128 rows=66 loops=1)

  • Hash Cond: (quiz_concept_question.quiz_concept_id = quiz_concept.id)
6. 0.041 0.041 ↑ 1.0 66 1

Seq Scan on quiz_concept_question (cost=0.00..1.20 rows=66 width=8) (actual time=0.007..0.041 rows=66 loops=1)

7. 0.004 0.014 ↓ 5.0 5 1

Hash (cost=6.24..6.24 rows=1 width=8) (actual time=0.013..0.014 rows=5 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
8. 0.010 0.010 ↓ 5.0 5 1

Index Scan using quiz_concept_name_lesson_program_id on quiz_concept (cost=0.03..6.24 rows=1 width=8) (actual time=0.008..0.010 rows=5 loops=1)

  • Index Cond: (lesson_program_id = 1)
9. 193.252 423.192 ↑ 1.1 13,431 66

Hash Join (cost=705.84..1,411.09 rows=14,973 width=8) (actual time=0.070..6.412 rows=13,431 loops=66)

  • Hash Cond: (license.user_id = ""user"".id)
10. 225.720 225.720 ↓ 1.0 15,250 66

Index Only Scan using license_user_id_lesson_program_id_active on license (cost=0.06..697.45 rows=14,973 width=8) (actual time=0.005..3.420 rows=15,250 loops=66)

  • Index Cond: (lesson_program_id = 1)
  • Heap Fetches: 251,922
11. 1.781 4.220 ↓ 1.0 13,458 1

Hash (cost=659.59..659.59 rows=13,197 width=4) (actual time=4.220..4.220 rows=13,458 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 602kB
12. 2.439 2.439 ↓ 1.0 13,458 1

Seq Scan on ""user"" (cost=0.00..659.59 rows=13,197 width=4) (actual time=0.004..2.439 rows=13,458 loops=1)

13.          

CTE t2

14. 185.368 1,523.627 ↓ 67.2 13,431 1

HashAggregate (cost=45.88..46.48 rows=200 width=8) (actual time=1,521.868..1,523.627 rows=13,431 loops=1)

  • Group Key: user_stat.id
15. 1,338.259 1,338.259 ↓ 125.6 886,446 1

CTE Scan on user_stat (cost=0.00..42.35 rows=7,059 width=4) (actual time=875.747..1,338.259 rows=886,446 loops=1)

16. 1,526.578 1,526.578 ↓ 67.2 13,431 1

CTE Scan on t2 (cost=0.00..1.20 rows=200 width=4) (actual time=1,521.870..1,526.578 rows=13,431 loops=1)

Planning time : 0.461 ms
Execution time : 1,537.526 ms