explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4IpZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=206,588.12..230,518.60 rows=1 width=56) (actual rows= loops=)

  • Group Key: c.instanceid
2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=206,588.12..230,518.58 rows=1 width=16) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Merge Join (cost=206,587.43..219,037.42 rows=1 width=16) (actual rows= loops=)

  • Merge Cond: (mdl_role_assignments.contextid = c.id)
4. 0.000 0.000 ↓ 0.0

Unique (cost=206,578.97..217,163.56 rows=149,231 width=16) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Sort (cost=206,578.97..210,107.17 rows=1,411,279 width=16) (actual rows= loops=)

  • Sort Key: mdl_role_assignments.contextid, mdl_role_assignments.userid
6. 0.000 0.000 ↓ 0.0

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

  • Filter: (roleid = 5)
7. 0.000 0.000 ↓ 0.0

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

  • Sort Key: c.id
8. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (instanceid = 2643)
  • Filter: (contextlevel = 50)
9. 0.000 0.000 ↓ 0.0

Index Scan using mdl_logsstanlog_useconconcr_ix on mdl_logstore_standard_log l (cost=0.70..11,481.11 rows=5 width=16) (actual rows= loops=)

  • Index Cond: ((userid = mdl_role_assignments.userid) AND (contextlevel = 50))
  • Filter: ((courseid = 2643) AND ((action)::text = 'viewed'::text))