explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Jh5p

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.028 417.475 ↓ 2.0 2 1

Group (cost=31,889.81..31,889.82 rows=1 width=17) (actual time=417.436..417.475 rows=2 loops=1)

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

CTE aps

3. 0.004 0.024 ↓ 2.0 2 1

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

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

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

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

Sort (cost=31,873.20..31,873.20 rows=1 width=17) (actual time=417.433..417.447 rows=231 loops=1)

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

Nested Loop Left Join (cost=1,008.34..31,873.19 rows=1 width=17) (actual time=113.109..417.335 rows=231 loops=1)

  • Join Filter: (apa.attendance_period_id = aps.id)
  • Rows Removed by Join Filter: 231
8. 0.020 0.020 ↓ 2.0 2 1

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

9. 61.705 417.242 ↓ 231.0 231 2

Hash Semi Join (cost=1,008.34..31,873.16 rows=1 width=17) (actual time=45.135..208.621 rows=231 loops=2)

  • Hash Cond: (apa.attendance_period_id = aps_1.id)
10. 37.926 355.526 ↓ 76.7 256,097 2

Gather (cost=1,008.30..31,864.34 rows=3,341 width=16) (actual time=1.372..177.763 rows=256,097 loops=2)

  • Workers Planned: 2
  • Workers Launched: 2
11. 171.129 317.600 ↓ 61.3 85,366 6 / 3

Hash Join (cost=8.30..30,530.24 rows=1,392 width=16) (actual time=0.099..158.800 rows=85,366 loops=6)

  • Hash Cond: (apa.user_group_id = uug.user_group_id)
12. 146.444 146.444 ↑ 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.020..73.222 rows=473,833 loops=6)

13. 0.003 0.027 ↑ 1.0 1 5 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.023 0.023 ↑ 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.013..0.014 rows=1 loops=5)

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 0.009 0.009 ↓ 2.0 2 1

CTE Scan on aps aps_1 (cost=0.00..0.02 rows=1 width=16) (actual time=0.000..0.009 rows=2 loops=1)

Planning time : 0.706 ms
Execution time : 419.898 ms