explain.depesz.com

PostgreSQL's explain analyze made readable

Result: klAM

Settings
# exclusive inclusive rows x rows loops node
1. 7.674 69,756.866 ↑ 1.0 1 1

GroupAggregate (cost=207,855.09..220,309.13 rows=1 width=56) (actual time=69,756.866..69,756.866 rows=1 loops=1)

  • Group Key: c.instanceid
2. 67.475 69,749.192 ↓ 6,163.0 6,163 1

Nested Loop (cost=207,855.09..220,309.11 rows=1 width=16) (actual time=1,470.598..69,749.192 rows=6,163 loops=1)

3. 63.110 1,463.994 ↓ 7,171.0 7,171 1

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

  • Merge Cond: (mdl_role_assignments.contextid = c.id)
4. 123.553 1,400.412 ↓ 5.1 762,025 1

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

5. 1,004.629 1,276.859 ↑ 1.7 853,381 1

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

  • Sort Key: mdl_role_assignments.contextid, mdl_role_assignments.userid
  • Sort Method: external merge Disk: 36008kB
6. 272.230 272.230 ↓ 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.031..272.230 rows=1,412,193 loops=1)

  • Filter: (roleid = 5)
  • Rows Removed by Filter: 80118
7. 0.011 0.472 ↑ 1.0 1 1

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

  • Sort Key: c.id
  • Sort Method: quicksort Memory: 25kB
8. 0.461 0.461 ↑ 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.461..0.461 rows=1 loops=1)

  • Index Cond: (instanceid = 3912)
  • Filter: (contextlevel = 50)
  • Rows Removed by Filter: 1
9. 889.204 68,217.723 ↑ 1.0 1 7,171

Bitmap Heap Scan on mdl_logstore_standard_log l (cost=1,267.66..1,271.68 rows=1 width=16) (actual time=9.440..9.513 rows=1 loops=7,171)

  • Recheck Cond: ((userid = mdl_role_assignments.userid) AND (contextlevel = 50) AND (courseid = 3912))
  • Filter: ((action)::text = 'viewed'::text)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=5955
10. 690.943 67,328.519 ↓ 0.0 0 7,171

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

11. 5,908.904 5,908.904 ↑ 3.1 1,009 7,171

Bitmap Index Scan on mdl_logsstanlog_useconconcr_ix (cost=0.00..120.47 rows=3,091 width=0) (actual time=0.824..0.824 rows=1,009 loops=7,171)

  • Index Cond: ((userid = mdl_role_assignments.userid) AND (contextlevel = 50))
12. 60,728.672 60,728.672 ↓ 2.9 120,788 6,466

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

  • Index Cond: (courseid = 3912)