explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ULfO

Settings
# exclusive inclusive rows x rows loops node
1. 1.215 1,579.332 ↑ 1.0 1 1

Aggregate (cost=2,019.81..2,019.81 rows=1 width=32) (actual time=1,579.332..1,579.332 rows=1 loops=1)

2.          

CTE user_stat

3. 616.664 1,133.987 ↓ 125.6 886,446 1

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

  • Group Key: user_1.id, quiz_concept_question.id
4. 84.437 517.323 ↓ 125.6 886,446 1

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

5. 0.068 0.124 ↓ 66.0 66 1

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

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

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

7. 0.003 0.013 ↓ 5.0 5 1

Hash (cost=6.24..6.24 rows=1 width=8) (actual time=0.013..0.013 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. 198.910 432.762 ↑ 1.1 13,431 66

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

  • Hash Cond: (license.user_id = user_1.id)
10. 229.548 229.548 ↓ 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.478 rows=15,250 loops=66)

  • Index Cond: (lesson_program_id = 1)
  • Heap Fetches: 251,998
11. 1.806 4.304 ↓ 1.0 13,458 1

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

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

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

13.          

CTE t2

14. 178.638 1,550.804 ↓ 67.2 13,431 1

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

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

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

16. 10.974 1,578.117 ↓ 67.2 13,431 1

Nested Loop (cost=0.06..481.50 rows=200 width=4) (actual time=1,548.849..1,578.117 rows=13,431 loops=1)

17. 1,553.712 1,553.712 ↓ 67.2 13,431 1

CTE Scan on t2 (cost=0.00..1.20 rows=200 width=8) (actual time=1,548.817..1,553.712 rows=13,431 loops=1)

18. 13.431 13.431 ↑ 1.0 1 13,431

Index Only Scan using user_pkey on ""user"" (cost=0.06..2.40 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=13,431)

  • Index Cond: (id = t2.id)
  • Heap Fetches: 12,569
Planning time : 0.531 ms
Execution time : 1,588.127 ms