explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wKZh : Optimization for: plan #L6jc

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 2.852 30.390 ↑ 10.3 2,479 1

Nested Loop (cost=104.35..17,479.57 rows=25,454 width=162) (actual time=0.880..30.390 rows=2,479 loops=1)

2. 0.944 22.220 ↓ 1.0 2,659 1

Nested Loop Left Join (cost=104.08..9,688.79 rows=2,554 width=125) (actual time=0.873..22.220 rows=2,659 loops=1)

3. 1.373 10.640 ↓ 1.0 2,659 1

Nested Loop Left Join (cost=103.66..8,521.46 rows=2,554 width=93) (actual time=0.867..10.640 rows=2,659 loops=1)

4. 1.016 4.267 ↑ 1.0 1,000 1

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

5. 0.596 1.251 ↑ 1.0 1,000 1

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

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

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

7. 0.550 0.550 ↑ 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.017..0.550 rows=1,000 loops=1)

  • Index Cond: (user_id > '00000000-0000-0000-0000-000000000000'::uuid)
  • Heap Fetches: 676
8. 2.000 2.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.002..0.002 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.003..0.005 rows=3 loops=1,000)

  • Index Cond: (user_id = u.user_id)
10. 10.636 10.636 ↑ 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.004..0.004 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.643 ms
Execution time : 30.625 ms