explain.depesz.com

PostgreSQL's explain analyze made readable

Result: L6jc

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 5.099 44.000 ↑ 10.3 2,479 1

Nested Loop (cost=104.35..17,476.05 rows=25,451 width=162) (actual time=0.910..44.000 rows=2,479 loops=1)

2. 2.704 33.583 ↓ 1.0 2,659 1

Nested Loop Left Join (cost=104.08..9,688.32 rows=2,553 width=125) (actual time=0.902..33.583 rows=2,659 loops=1)

3. 0.926 12.266 ↓ 1.0 2,659 1

Nested Loop Left Join (cost=103.66..8,521.44 rows=2,553 width=93) (actual time=0.895..12.266 rows=2,659 loops=1)

4. 1.097 6.340 ↑ 1.0 1,000 1

Nested Loop (cost=103.23..7,702.51 rows=1,000 width=76) (actual time=0.889..6.340 rows=1,000 loops=1)

5. 0.572 1.243 ↑ 1.0 1,000 1

HashAggregate (cost=102.81..112.81 rows=1,000 width=16) (actual time=0.882..1.243 rows=1,000 loops=1)

  • Group Key: users.user_id
6. 0.105 0.671 ↑ 1.0 1,000 1

Limit (cost=0.42..90.31 rows=1,000 width=16) (actual time=0.032..0.671 rows=1,000 loops=1)

7. 0.566 0.566 ↑ 443.2 1,000 1

Index Only Scan using users_pkey on users (cost=0.42..39,836.42 rows=443,193 width=16) (actual time=0.032..0.566 rows=1,000 loops=1)

  • Index Cond: (user_id > '00000000-0000-0000-0000-000000000000'::uuid)
  • Heap Fetches: 657
8. 4.000 4.000 ↑ 1.0 1 1,000

Index Scan using users_pkey on users u (cost=0.42..7.60 rows=1 width=76) (actual time=0.004..0.004 rows=1 loops=1,000)

  • Index Cond: (user_id = users.user_id)
9. 5.000 5.000 ↑ 2.0 3 1,000

Index Scan using enrollments_user_id_index on enrollments e (cost=0.43..0.76 rows=6 width=33) (actual time=0.002..0.005 rows=3 loops=1,000)

  • Index Cond: (user_id = u.user_id)
10. 18.613 18.613 ↑ 1.0 1 2,659

Index Scan using classes_pkey on classes c (cost=0.42..0.46 rows=1 width=48) (actual time=0.007..0.007 rows=1 loops=2,659)

  • Index Cond: (class_id = e.class_id)
  • Filter: (NOT is_deleted)
  • Rows Removed by Filter: 0
11. 5.318 5.318 ↑ 10.0 1 2,659

Index Scan using orgs_pkey on orgs o (cost=0.28..2.95 rows=10 width=37) (actual time=0.002..0.002 rows=1 loops=2,659)

  • Index Cond: (org_id = ANY (u.org_ids))
Planning time : 0.575 ms
Execution time : 44.228 ms