explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uGw3

Settings
# exclusive inclusive rows x rows loops node
1. 0.888 1,270.176 ↑ 1.0 1 1

Aggregate (cost=2,008.67..2,008.67 rows=1 width=32) (actual time=1,270.176..1,270.176 rows=1 loops=1)

2.          

CTE user_stat

3. 452.115 920.482 ↓ 206.3 687,720 1

HashAggregate (cost=1,494.80..1,504.80 rows=3,333 width=8) (actual time=745.963..920.482 rows=687,720 loops=1)

  • Group Key: user_1.id, quiz_concept_question.id
4. 151.979 468.367 ↓ 210.1 700,260 1

Hash Join (cost=712.03..1,491.47 rows=3,333 width=8) (actual time=4.225..468.367 rows=700,260 loops=1)

  • Hash Cond: (license.user_id = user_1.id)
5. 62.818 312.217 ↓ 210.2 700,458 1

Nested Loop (cost=6.25..783.94 rows=3,333 width=8) (actual time=0.033..312.217 rows=700,458 loops=1)

6. 0.069 0.117 ↓ 66.0 66 1

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

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

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

8. 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
9. 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)
10. 249.282 249.282 ↓ 1.5 10,613 66

Seq Scan on license (cost=0.00..755.26 rows=7,069 width=8) (actual time=0.002..3.777 rows=10,613 loops=66)

  • Filter: (completed AND passed AND (lesson_program_id = 1))
  • Rows Removed by Filter: 7,768
11. 1.763 4.171 ↓ 1.0 13,458 1

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

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

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

13.          

CTE t2

14. 142.224 1,248.144 ↓ 52.1 10,420 1

HashAggregate (cost=21.66..22.26 rows=200 width=8) (actual time=1,246.541..1,248.144 rows=10,420 loops=1)

  • Group Key: user_stat.id
15. 1,105.920 1,105.920 ↓ 206.3 687,720 1

CTE Scan on user_stat (cost=0.00..20.00 rows=3,333 width=4) (actual time=745.965..1,105.920 rows=687,720 loops=1)

16. 8.481 1,269.288 ↓ 52.1 10,420 1

Nested Loop (cost=0.06..481.50 rows=200 width=4) (actual time=1,246.574..1,269.288 rows=10,420 loops=1)

17. 1,250.387 1,250.387 ↓ 52.1 10,420 1

CTE Scan on t2 (cost=0.00..1.20 rows=200 width=8) (actual time=1,246.543..1,250.387 rows=10,420 loops=1)

18. 10.420 10.420 ↑ 1.0 1 10,420

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=10,420)

  • Index Cond: (id = t2.id)
  • Heap Fetches: 9,801
Planning time : 0.492 ms
Execution time : 1,278.871 ms