explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yBIj

Settings
# exclusive inclusive rows x rows loops node
1. 0.053 150,900.484 ↓ 3.0 3 1

HashAggregate (cost=2,329.88..2,329.89 rows=1 width=16) (actual time=150,900.483..150,900.484 rows=3 loops=1)

  • Group Key: c.id, g.id
2. 6,975.498 150,900.431 ↓ 228.0 228 1

Nested Loop (cost=506.00..2,329.88 rows=1 width=16) (actual time=121,413.363..150,900.431 rows=228 loops=1)

3. 2,375.910 18,203.813 ↓ 1,381,550.8 17,960,160 1

Nested Loop (cost=505.58..2,289.95 rows=13 width=24) (actual time=5.858..18,203.813 rows=17,960,160 loops=1)

4. 1,136.824 9,939.291 ↓ 1,472,153.0 1,472,153 1

Nested Loop (cost=505.29..2,288.68 rows=1 width=40) (actual time=5.838..9,939.291 rows=1,472,153 loops=1)

  • Join Filter: (cm.course = context.instanceid)
5. 182.436 4,386.008 ↓ 1,472,153.0 1,472,153 1

Nested Loop (cost=504.87..2,287.93 rows=1 width=64) (actual time=5.814..4,386.008 rows=1,472,153 loops=1)

  • Join Filter: (cm.course = c.id)
6. 250.079 1,259.266 ↓ 1,472,153.0 1,472,153 1

Nested Loop (cost=504.58..2,287.55 rows=1 width=56) (actual time=5.799..1,259.266 rows=1,472,153 loops=1)

7. 12.527 186.101 ↓ 45,727.0 45,727 1

Nested Loop (cost=504.29..2,286.06 rows=1 width=40) (actual time=5.787..186.101 rows=45,727 loops=1)

8. 2.588 103.559 ↓ 3,685.0 3,685 1

Nested Loop (cost=504.00..2,285.14 rows=1 width=40) (actual time=5.750..103.559 rows=3,685 loops=1)

9. 5.576 30.956 ↓ 3,685.0 3,685 1

Hash Join (cost=503.58..2,280.85 rows=1 width=40) (actual time=5.723..30.956 rows=3,685 loops=1)

  • Hash Cond: ((cm.course = q.course) AND (cm.instance = q.id))
10. 19.971 20.808 ↑ 1.0 3,686 1

Bitmap Heap Scan on mdl_course_modules cm (cost=73.46..1,822.49 rows=3,763 width=24) (actual time=1.094..20.808 rows=3,686 loops=1)

  • Recheck Cond: (module = 18)
  • Heap Blocks: exact=1186
11. 0.837 0.837 ↑ 1.0 3,686 1

Bitmap Index Scan on mdl_courmodu_mod_ix (cost=0.00..72.52 rows=3,763 width=0) (actual time=0.837..0.837 rows=3,686 loops=1)

  • Index Cond: (module = 18)
12. 2.149 4.572 ↑ 1.0 3,685 1

Hash (cost=374.85..374.85 rows=3,685 width=16) (actual time=4.572..4.572 rows=3,685 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 205kB
13. 2.423 2.423 ↑ 1.0 3,685 1

Seq Scan on mdl_quiz q (cost=0.00..374.85 rows=3,685 width=16) (actual time=0.006..2.423 rows=3,685 loops=1)

14. 70.015 70.015 ↑ 1.0 1 3,685

Index Scan using mdl_cont_conins_uix on mdl_context contextm (cost=0.42..4.28 rows=1 width=16) (actual time=0.019..0.019 rows=1 loops=3,685)

  • Index Cond: ((contextlevel = 70) AND (instanceid = cm.id))
15. 70.015 70.015 ↑ 1.8 12 3,685

Index Scan using mdl_quesusag_con_ix on mdl_question_usages qu (cost=0.29..0.70 rows=22 width=16) (actual time=0.004..0.019 rows=12 loops=3,685)

  • Index Cond: (contextid = contextm.id)
16. 823.086 823.086 ↓ 4.0 32 45,727

Index Scan using mdl_grou_cou_ix on mdl_groups g (cost=0.29..1.41 rows=8 width=16) (actual time=0.003..0.018 rows=32 loops=45,727)

  • Index Cond: (courseid = cm.course)
17. 2,944.306 2,944.306 ↑ 1.0 1 1,472,153

Index Only Scan using mdl_cour_id_pk on mdl_course c (cost=0.29..0.37 rows=1 width=8) (actual time=0.001..0.002 rows=1 loops=1,472,153)

  • Index Cond: (id = g.courseid)
  • Heap Fetches: 1472153
18. 4,416.459 4,416.459 ↑ 1.0 1 1,472,153

Index Scan using mdl_cont_ins_ix on mdl_context context (cost=0.42..0.75 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,472,153)

  • Index Cond: (instanceid = g.courseid)
  • Filter: (contextlevel = 50)
  • Rows Removed by Filter: 3
19. 5,888.612 5,888.612 ↑ 1.1 12 1,472,153

Index Only Scan using mdl_quizslot_qui_ix on mdl_quiz_slots qs (cost=0.29..1.13 rows=13 width=8) (actual time=0.002..0.004 rows=12 loops=1,472,153)

  • Index Cond: (quizid = q.id)
  • Heap Fetches: 17960160
20. 125,721.120 125,721.120 ↓ 0.0 0 17,960,160

Index Scan using mdl_quesatte_que2_ix on mdl_question_attempts att (cost=0.42..3.06 rows=1 width=8) (actual time=0.007..0.007 rows=0 loops=17,960,160)

  • Index Cond: (questionusageid = qu.id)
  • Filter: (questionid = ANY ('{686662,686663}'::bigint[]))
  • Rows Removed by Filter: 18
Planning time : 36.273 ms
Execution time : 150,900.737 ms