explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 59Sj

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 1.360 ↓ 156.0 156 1

Nested Loop (cost=89.95..124.24 rows=1 width=16) (actual time=0.681..1.360 rows=156 loops=1)

2. 0.000 1.215 ↓ 156.0 156 1

Nested Loop (cost=89.80..116.07 rows=1 width=32) (actual time=0.679..1.215 rows=156 loops=1)

3. 0.025 1.072 ↓ 156.0 156 1

Nested Loop (cost=89.66..107.89 rows=1 width=32) (actual time=0.677..1.072 rows=156 loops=1)

4. 0.012 0.032 ↓ 29.0 29 1

Hash Right Join (cost=8.18..9.59 rows=1 width=71) (actual time=0.021..0.032 rows=29 loops=1)

  • Hash Cond: (person_assignment.organizational_unit_id = organizational_unit.id)
5. 0.006 0.006 ↑ 1.0 29 1

Seq Scan on person_assignment (cost=0.00..1.29 rows=29 width=39) (actual time=0.003..0.006 rows=29 loops=1)

6. 0.004 0.014 ↓ 26.0 26 1

Hash (cost=8.17..8.17 rows=1 width=64) (actual time=0.014..0.014 rows=26 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
7. 0.010 0.010 ↓ 26.0 26 1

Index Scan using idx_organizational_unit_state on organizational_unit (cost=0.15..8.17 rows=1 width=64) (actual time=0.004..0.010 rows=26 loops=1)

  • Index Cond: (state = 'ACTIVE'::text)
8. 0.105 1.015 ↓ 5.0 5 29

Nested Loop Anti Join (cost=81.48..98.30 rows=1 width=16) (actual time=0.023..0.035 rows=5 loops=29)

9. 0.029 0.754 ↓ 5.0 5 29

Subquery Scan on alias_755097 (cost=81.19..81.28 rows=1 width=16) (actual time=0.022..0.026 rows=5 loops=29)

  • Filter: (alias_755097.r = 1)
  • Rows Removed by Filter: 0
10. 0.087 0.725 ↓ 2.0 6 29

WindowAgg (cost=81.19..81.25 rows=3 width=20) (actual time=0.022..0.025 rows=6 loops=29)

11. 0.058 0.638 ↓ 2.0 6 29

Sort (cost=81.19..81.19 rows=3 width=20) (actual time=0.022..0.022 rows=6 loops=29)

  • Sort Key: employee.person_id, employee.sort_code
  • Sort Method: quicksort Memory: 25kB
12. 0.025 0.580 ↓ 2.0 6 29

Result (cost=20.17..81.16 rows=3 width=20) (actual time=0.002..0.020 rows=6 loops=29)

  • One-Time Filter: ((person_assignment.state = 'ACTIVE'::text) AND (person_assignment.person_id = '8e459ecd-2208-44b9-836a-b9bbf182ec03'::uuid))
13. 0.000 0.555 ↓ 55.7 167 1

Nested Loop (cost=20.17..81.16 rows=3 width=20) (actual time=0.047..0.555 rows=167 loops=1)

14. 0.058 0.175 ↓ 56.0 448 1

Nested Loop (cost=19.90..78.12 rows=8 width=16) (actual time=0.044..0.175 rows=448 loops=1)

15. 0.010 0.010 ↑ 1.0 1 1

Index Scan using idx_organizational_unit_state on organizational_unit ou2 (cost=0.15..8.17 rows=1 width=16) (actual time=0.005..0.010 rows=1 loops=1)

  • Index Cond: (state = 'ACTIVE'::text)
  • Filter: (materialized_path @> organizational_unit.materialized_path)
  • Rows Removed by Filter: 25
16. 0.075 0.107 ↑ 1.0 448 1

Bitmap Heap Scan on organization_assignment (cost=19.75..65.47 rows=448 width=32) (actual time=0.036..0.107 rows=448 loops=1)

  • Recheck Cond: ((organizational_unit_id = ou2.id) AND (state = 'ACTIVE'::text))
  • Heap Blocks: exact=39
17. 0.032 0.032 ↑ 1.0 448 1

Bitmap Index Scan on organizational_assignment_org_unit_id_org_id_idx (cost=0.00..19.64 rows=448 width=0) (actual time=0.032..0.032 rows=448 loops=1)

  • Index Cond: (organizational_unit_id = ou2.id)
18. 0.448 0.448 ↓ 0.0 0 448

Index Scan using employee_organization_id_state_idx on employee (cost=0.27..0.35 rows=3 width=36) (actual time=0.001..0.001 rows=0 loops=448)

  • Index Cond: ((organization_id = organization_assignment.organization_id) AND (state = 'ACTIVE'::text))
19. 0.000 0.156 ↓ 0.0 0 156

Nested Loop (cost=0.29..8.65 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=156)

20. 0.156 0.156 ↑ 1.0 1 156

Index Scan using person_to_person_type_person_idx on person_to_person_type (cost=0.14..8.16 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=156)

  • Index Cond: (person_id = alias_755097.person_id)
21. 0.156 0.156 ↓ 0.0 0 156

Index Scan using person_type_pkey on person_type (cost=0.15..0.48 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=156)

  • Index Cond: (id = person_to_person_type.person_type_id)
  • Filter: (base_type = 'INTERNAL'::text)
  • Rows Removed by Filter: 1
22. 0.156 0.156 ↑ 1.0 1 156

Index Scan using person_id_active_idx on person (cost=0.14..8.16 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=156)

  • Index Cond: (id = alias_755097.person_id)
23. 0.156 0.156 ↑ 1.0 1 156

Index Scan using pk_organizational_hierarchy on organizational_hierarchy (cost=0.15..8.17 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=156)

  • Index Cond: (id = organizational_unit.organizational_hierarchy_id)
  • Filter: (state = 'ACTIVE'::text)
Planning time : 0.968 ms
Execution time : 1.422 ms