explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zz9v

Settings
# exclusive inclusive rows x rows loops node
1. 1.225 3,218.648 ↑ 22.0 1 1

GroupAggregate (cost=599.87..600.15 rows=22 width=80) (actual time=3,218.647..3,218.648 rows=1 loops=1)

  • Group Key: user_stat.subgroup
2.          

CTE user_stat

3. 14.791 3,209.786 ↓ 68.5 1,506 1

GroupAggregate (cost=526.20..526.31 rows=22 width=44) (actual time=3,188.251..3,209.786 rows=1,506 loops=1)

  • Group Key: user_1.id
4. 53.858 3,194.995 ↓ 2,969.3 65,325 1

Sort (cost=526.20..526.21 rows=22 width=5) (actual time=3,188.233..3,194.995 rows=65,325 loops=1)

  • Sort Key: user_1.id
  • Sort Method: quicksort Memory: 4,599kB
5. 683.482 3,141.137 ↓ 2,969.3 65,325 1

Hash Join (cost=22.02..526.10 rows=22 width=5) (actual time=0.546..3,141.137 rows=65,325 loops=1)

  • Hash Cond: ((user_quiz_answer.quiz_answer_id = quiz_answer.id) AND (quiz_concept_question.quiz_question_id = quiz_answer.quiz_question_id))
6. 924.313 2,457.214 ↓ 1,190.2 4,663,379 1

Nested Loop (cost=6.38..506.35 rows=3,918 width=13) (actual time=0.089..2,457.214 rows=4,663,379 loops=1)

7. 16.866 41.341 ↓ 717.1 74,578 1

Nested Loop (cost=6.30..290.62 rows=104 width=12) (actual time=0.068..41.341 rows=74,578 loops=1)

8. 1.697 10.777 ↓ 5.1 1,522 1

Nested Loop (cost=0.06..282.17 rows=297 width=12) (actual time=0.032..10.777 rows=1,522 loops=1)

9. 2.968 2.968 ↓ 5.1 1,528 1

Seq Scan on license (cost=0.00..224.20 rows=297 width=8) (actual time=0.017..2.968 rows=1,528 loops=1)

  • Filter: (completed AND passed AND (lesson_program_id = 1))
  • Rows Removed by Filter: 5,685
10. 6.112 6.112 ↑ 1.0 1 1,528

Index Only Scan using user_pkey on ""user"" user_1 (cost=0.06..0.20 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1,528)

  • Index Cond: (id = license.user_id)
  • Heap Fetches: 24
11. 13.607 13.698 ↓ 49.0 49 1,522

Materialize (cost=6.25..7.42 rows=1 width=8) (actual time=0.000..0.009 rows=49 loops=1,522)

12. 0.052 0.091 ↓ 49.0 49 1

Hash Join (cost=6.25..7.42 rows=1 width=8) (actual time=0.033..0.091 rows=49 loops=1)

  • Hash Cond: (quiz_concept_question.quiz_concept_id = quiz_concept.id)
13. 0.022 0.022 ↑ 1.0 49 1

Seq Scan on quiz_concept_question (cost=0.00..1.15 rows=49 width=8) (actual time=0.006..0.022 rows=49 loops=1)

14. 0.004 0.017 ↓ 5.0 5 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
15. 0.013 0.013 ↓ 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.010..0.013 rows=5 loops=1)

  • Index Cond: (lesson_program_id = 1)
16. 1,491.560 1,491.560 ↓ 1.1 63 74,578

Index Scan using user_quiz_answer_user_id_index on user_quiz_answer (cost=0.08..1.90 rows=59 width=9) (actual time=0.005..0.020 rows=63 loops=74,578)

  • Index Cond: (user_id = user_1.id)
17. 0.197 0.441 ↑ 1.0 662 1

Hash (cost=12.99..12.99 rows=662 width=8) (actual time=0.441..0.441 rows=662 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 34kB
18. 0.244 0.244 ↑ 1.0 662 1

Seq Scan on quiz_answer (cost=0.00..12.99 rows=662 width=8) (actual time=0.008..0.244 rows=662 loops=1)

19. 0.925 3,217.423 ↓ 68.5 1,506 1

Sort (cost=73.56..73.57 rows=22 width=44) (actual time=3,217.247..3,217.423 rows=1,506 loops=1)

  • Sort Key: user_stat.subgroup
  • Sort Method: quicksort Memory: 166kB
20. 1.383 3,216.498 ↓ 68.5 1,506 1

Nested Loop (cost=0.06..73.47 rows=22 width=44) (actual time=3,188.271..3,216.498 rows=1,506 loops=1)

21. 3,210.597 3,210.597 ↓ 68.5 1,506 1

CTE Scan on user_stat (cost=0.00..0.13 rows=22 width=44) (actual time=3,188.254..3,210.597 rows=1,506 loops=1)

22. 4.518 4.518 ↑ 1.0 1 1,506

Index Scan using user_pkey on ""user"" (cost=0.06..3.33 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,506)

  • Index Cond: (id = user_stat.id)
Planning time : 3.639 ms
Execution time : 3,219.392 ms