explain.depesz.com

PostgreSQL's explain analyze made readable

Result: L0ju

Settings
# exclusive inclusive rows x rows loops node
1. 0.011 52,937.063 ↑ 8.3 11 1

Hash Left Join (cost=220,415.93..220,646.55 rows=91 width=56) (actual time=52,937.032..52,937.063 rows=11 loops=1)

  • Hash Cond: (cm.id = cmlogagg.cmid)
2. 0.057 0.057 ↑ 8.3 11 1

Index Scan using mdl_courmodu_cou_ix on mdl_course_modules cm (cost=0.42..230.70 rows=91 width=8) (actual time=0.030..0.057 rows=11 loops=1)

  • Index Cond: (course = 3912)
3. 0.005 52,936.995 ↓ 11.0 11 1

Hash (cost=220,415.49..220,415.49 rows=1 width=24) (actual time=52,936.995..52,936.995 rows=11 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
4. 0.003 52,936.990 ↓ 11.0 11 1

Subquery Scan on cmlogagg (cost=220,415.46..220,415.49 rows=1 width=24) (actual time=52,935.561..52,936.990 rows=11 loops=1)

5. 1.348 52,936.987 ↓ 11.0 11 1

GroupAggregate (cost=220,415.46..220,415.48 rows=1 width=32) (actual time=52,935.560..52,936.987 rows=11 loops=1)

  • Group Key: l.contextinstanceid
6. 3.516 52,935.639 ↓ 6,880.0 6,880 1

Sort (cost=220,415.46..220,415.46 rows=1 width=16) (actual time=52,935.302..52,935.639 rows=6,880 loops=1)

  • Sort Key: l.contextinstanceid
  • Sort Method: quicksort Memory: 515kB
7. 233.113 52,932.123 ↓ 6,880.0 6,880 1

Nested Loop (cost=207,961.42..220,415.45 rows=1 width=16) (actual time=1,339.883..52,932.123 rows=6,880 loops=1)

8. 54.689 1,333.137 ↓ 7,171.0 7,171 1

Merge Join (cost=206,587.43..219,037.42 rows=1 width=16) (actual time=1,301.947..1,333.137 rows=7,171 loops=1)

  • Merge Cond: (mdl_role_assignments.contextid = c.id)
9. 116.260 1,278.405 ↓ 5.1 762,025 1

Unique (cost=206,578.97..217,163.56 rows=149,231 width=16) (actual time=1,044.295..1,278.405 rows=762,025 loops=1)

10. 910.192 1,162.145 ↑ 1.7 853,381 1

Sort (cost=206,578.97..210,107.17 rows=1,411,279 width=16) (actual time=1,044.294..1,162.145 rows=853,381 loops=1)

  • Sort Key: mdl_role_assignments.contextid, mdl_role_assignments.userid
  • Sort Method: external merge Disk: 36008kB
11. 251.953 251.953 ↓ 1.0 1,412,193 1

Seq Scan on mdl_role_assignments (cost=0.00..38,304.90 rows=1,411,279 width=16) (actual time=0.011..251.953 rows=1,412,193 loops=1)

  • Filter: (roleid = 5)
  • Rows Removed by Filter: 80118
12. 0.009 0.043 ↑ 1.0 1 1

Sort (cost=8.46..8.46 rows=1 width=16) (actual time=0.043..0.043 rows=1 loops=1)

  • Sort Key: c.id
  • Sort Method: quicksort Memory: 25kB
13. 0.034 0.034 ↑ 1.0 1 1

Index Scan using mdl_cont_ins_ix on mdl_context c (cost=0.42..8.45 rows=1 width=16) (actual time=0.034..0.034 rows=1 loops=1)

  • Index Cond: (instanceid = 3912)
  • Filter: (contextlevel = 50)
  • Rows Removed by Filter: 1
14. 121.907 51,365.873 ↑ 1.0 1 7,171

Bitmap Heap Scan on mdl_logstore_standard_log l (cost=1,373.99..1,378.01 rows=1 width=24) (actual time=7.156..7.163 rows=1 loops=7,171)

  • Recheck Cond: ((userid = mdl_role_assignments.userid) AND (contextlevel = 70) AND (courseid = 3912))
  • Filter: ((action)::text = 'viewed'::text)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=6459
15. 780.630 51,243.966 ↓ 0.0 0 7,171

BitmapAnd (cost=1,373.99..1,373.99 rows=1 width=0) (actual time=7.146..7.146 rows=0 loops=7,171)

16. 1,591.962 1,591.962 ↑ 3.3 1,793 7,171

Bitmap Index Scan on mdl_logsstanlog_useconconcr_ix (cost=0.00..225.90 rows=5,912 width=0) (actual time=0.222..0.222 rows=1,793 loops=7,171)

  • Index Cond: ((userid = mdl_role_assignments.userid) AND (contextlevel = 70))
17. 48,871.374 48,871.374 ↓ 2.9 120,788 6,406

Bitmap Index Scan on mdl_logsstanlog_couanotim_ix (cost=0.00..1,145.95 rows=41,784 width=0) (actual time=7.629..7.629 rows=120,788 loops=6,406)

  • Index Cond: (courseid = 3912)