explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9nSo : Optimization for: Optimization for: plan #eDZE; plan #twBy

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.025 425.495 ↓ 2.0 2 1

Group (cost=31,922.73..31,922.74 rows=1 width=18) (actual time=425.459..425.495 rows=2 loops=1)

  • Group Key: ap.id, (true)
2. 0.083 425.470 ↓ 231.0 231 1

Sort (cost=31,922.73..31,922.73 rows=1 width=17) (actual time=425.458..425.470 rows=231 loops=1)

  • Sort Key: ap.id, (true)
  • Sort Method: quicksort Memory: 43kB
3. 46.501 425.387 ↓ 231.0 231 1

Nested Loop Left Join (cost=1,008.87..31,922.72 rows=1 width=17) (actual time=127.772..425.387 rows=231 loops=1)

  • Join Filter: (apa.attendance_period_id = ap.id)
  • Rows Removed by Join Filter: 511,963
4. 0.007 0.034 ↓ 2.0 2 1

Nested Loop (cost=0.56..16.61 rows=1 width=16) (actual time=0.014..0.034 rows=2 loops=1)

5. 0.011 0.011 ↓ 2.0 2 1

Index Scan using attendances_patient_id_idx on attendances a (cost=0.28..8.30 rows=1 width=16) (actual time=0.007..0.011 rows=2 loops=1)

  • Index Cond: (patient_id = '54d9df16-5371-11e8-80ea-034fb4ed6904'::uuid)
6. 0.016 0.016 ↑ 1.0 1 2

Index Scan using attendance_periods_attendance_id_idx on attendance_periods ap (cost=0.28..8.30 rows=1 width=32) (actual time=0.006..0.008 rows=1 loops=2)

  • Index Cond: (attendance_id = a.id)
7. 48.580 378.852 ↓ 76.7 256,097 2

Gather (cost=1,008.30..31,864.34 rows=3,341 width=17) (actual time=1.982..189.426 rows=256,097 loops=2)

  • Workers Planned: 2
  • Workers Launched: 2
8. 172.868 330.272 ↓ 61.3 85,366 6 / 3

Hash Join (cost=8.30..30,530.24 rows=1,392 width=17) (actual time=0.113..165.136 rows=85,366 loops=6)

  • Hash Cond: (apa.user_group_id = uug.user_group_id)
9. 157.372 157.372 ↑ 1.4 473,833 6 / 3

Parallel Seq Scan on attendance_period_acl apa (cost=0.00..28,712.00 rows=683,600 width=32) (actual time=0.022..78.686 rows=473,833 loops=6)

10. 0.005 0.032 ↑ 1.0 1 5 / 3

Hash (cost=8.29..8.29 rows=1 width=16) (actual time=0.019..0.019 rows=1 loops=5)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
11. 0.027 0.027 ↑ 1.0 1 5 / 3

Index Scan using users_user_groups_user_id_idx on users_user_groups uug (cost=0.27..8.29 rows=1 width=16) (actual time=0.015..0.016 rows=1 loops=5)

  • Index Cond: (user_id = '1304ff22-3368-11e8-ba9d-43a62f2ef9fd'::uuid)
Planning time : 0.542 ms
Execution time : 430.388 ms