explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.027 221.804 ↑ 1.0 2 1

Group (cost=31,960.85..31,960.98 rows=2 width=17) (actual time=221.764..221.804 rows=2 loops=1)

  • Group Key: aps.id, perms.is_perm
2.          

CTE aps

3. 0.006 0.023 ↓ 2.0 2 1

Nested Loop (cost=0.56..16.61 rows=1 width=16) (actual time=0.015..0.023 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.          

CTE perms

7. 0.000 88.494 ↓ 76.7 256,097 1

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

  • Workers Planned: 2
  • Workers Launched: 2
8. 66.947 129.428 ↓ 61.3 85,366 3 / 3

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

  • Hash Cond: (apa.user_group_id = uug.user_group_id)
9. 62.437 62.437 ↑ 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.025..62.437 rows=473,833 loops=3)

10. 0.004 0.044 ↑ 1.0 1 3 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.040 0.040 ↑ 1.0 1 3 / 3

Index Only Scan using users_user_groups_pkey on users_user_groups uug (cost=0.27..8.29 rows=1 width=16) (actual time=0.039..0.040 rows=1 loops=3)

  • Index Cond: (user_id = '1304ff22-3368-11e8-ba9d-43a62f2ef9fd'::uuid)
  • Heap Fetches: 0
12. 0.095 221.777 ↓ 13.6 231 1

Sort (cost=79.90..79.94 rows=17 width=17) (actual time=221.763..221.777 rows=231 loops=1)

  • Sort Key: aps.id, perms.is_perm
  • Sort Method: quicksort Memory: 43kB
13. 36.827 221.682 ↓ 13.6 231 1

Hash Right Join (cost=0.03..79.55 rows=17 width=17) (actual time=66.381..221.682 rows=231 loops=1)

  • Hash Cond: (perms.attendance_period_id = aps.id)
14. 184.827 184.827 ↓ 76.7 256,097 1

CTE Scan on perms (cost=0.00..66.82 rows=3,341 width=17) (actual time=0.424..184.827 rows=256,097 loops=1)

15. 0.003 0.028 ↓ 2.0 2 1

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

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

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

Planning time : 0.449 ms
Execution time : 226.676 ms