explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.027 187.725 ↓ 2.0 2 1

Group (cost=31,893.53..31,893.54 rows=1 width=17) (actual time=187.684..187.725 rows=2 loops=1)

  • Group Key: aps.id, (true)
2.          

CTE aps

3. 0.005 0.022 ↓ 2.0 2 1

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

4. 0.009 0.009 ↓ 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.008..0.009 rows=2 loops=1)

  • Index Cond: (patient_id = '54d9df16-5371-11e8-80ea-034fb4ed6904'::uuid)
5. 0.008 0.008 ↑ 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.004..0.004 rows=1 loops=2)

  • Index Cond: (attendance_id = a.id)
6. 0.088 187.698 ↓ 231.0 231 1

Sort (cost=31,876.92..31,876.93 rows=1 width=17) (actual time=187.682..187.698 rows=231 loops=1)

  • Sort Key: aps.id, (true)
  • Sort Method: quicksort Memory: 43kB
7. 32.925 187.610 ↓ 231.0 231 1

Hash Right Join (cost=1,008.34..31,876.91 rows=1 width=17) (actual time=44.791..187.610 rows=231 loops=1)

  • Hash Cond: (apa.attendance_period_id = aps.id)
8. 11.855 154.659 ↓ 76.7 256,097 1

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

  • Workers Planned: 2
  • Workers Launched: 2
9. 74.582 142.804 ↓ 61.3 85,366 3 / 3

Hash Join (cost=8.30..30,530.24 rows=1,392 width=17) (actual time=0.115..142.804 rows=85,366 loops=3)

  • Hash Cond: (apa.user_group_id = uug.user_group_id)
10. 68.205 68.205 ↑ 1.4 473,833 3 / 3

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

11. 0.003 0.017 ↑ 1.0 1 3 / 3

Hash (cost=8.29..8.29 rows=1 width=16) (actual time=0.017..0.017 rows=1 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
12. 0.014 0.014 ↑ 1.0 1 3 / 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.014..0.014 rows=1 loops=3)

  • Index Cond: (user_id = '1304ff22-3368-11e8-ba9d-43a62f2ef9fd'::uuid)
13. 0.002 0.026 ↓ 2.0 2 1

Hash (cost=0.02..0.02 rows=1 width=16) (actual time=0.026..0.026 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
14. 0.024 0.024 ↓ 2.0 2 1

CTE Scan on aps (cost=0.00..0.02 rows=1 width=16) (actual time=0.017..0.024 rows=2 loops=1)

Planning time : 0.442 ms
Execution time : 189.790 ms