explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YiJM

Settings
# exclusive inclusive rows x rows loops node
1. 0.076 38.274 ↓ 167.0 167 1

Nested Loop (cost=20.90..120.19 rows=1 width=32) (actual time=5.560..38.274 rows=167 loops=1)

2. 4.831 38.031 ↓ 167.0 167 1

Nested Loop (cost=20.76..113.35 rows=1 width=48) (actual time=5.556..38.031 rows=167 loops=1)

  • Join Filter: (organizational_unit.id = person_assignment.organizational_unit_id)
  • Rows Removed by Join Filter: 3,674
3. 0.000 21.677 ↓ 3,841.0 3,841 1

Nested Loop Anti Join (cost=20.76..111.91 rows=1 width=32) (actual time=0.104..21.677 rows=3,841 loops=1)

4. 0.432 14.194 ↓ 3,841.0 3,841 1

Nested Loop (cost=20.46..97.56 rows=1 width=32) (actual time=0.100..14.194 rows=3,841 loops=1)

5. 0.026 0.060 ↓ 26.0 26 1

Nested Loop (cost=0.29..16.34 rows=1 width=48) (actual time=0.009..0.060 rows=26 loops=1)

6. 0.008 0.008 ↓ 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.008 rows=26 loops=1)

  • Index Cond: (state = 'ACTIVE'::text)
7. 0.026 0.026 ↑ 1.0 1 26

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=26)

  • Index Cond: (id = organizational_unit.organizational_hierarchy_id)
  • Filter: (state = 'ACTIVE'::text)
8. 0.000 13.702 ↓ 49.3 148 26

Nested Loop (cost=20.17..81.16 rows=3 width=20) (actual time=0.027..0.527 rows=148 loops=26)

9. 1.118 3.822 ↓ 49.5 396 26

Nested Loop (cost=19.90..78.12 rows=8 width=16) (actual time=0.025..0.147 rows=396 loops=26)

10. 0.260 0.260 ↓ 4.0 4 26

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

  • Index Cond: (state = 'ACTIVE'::text)
  • Filter: (materialized_path @> organizational_unit.materialized_path)
  • Rows Removed by Filter: 22
11. 1.692 2.444 ↑ 4.1 110 94

Bitmap Heap Scan on organization_assignment (cost=19.75..65.47 rows=448 width=32) (actual time=0.009..0.026 rows=110 loops=94)

  • Recheck Cond: ((organizational_unit_id = ou2.id) AND (state = 'ACTIVE'::text))
  • Heap Blocks: exact=897
12. 0.752 0.752 ↑ 4.1 110 94

Bitmap Index Scan on organizational_assignment_org_unit_id_org_id_idx (cost=0.00..19.64 rows=448 width=0) (actual time=0.008..0.008 rows=110 loops=94)

  • Index Cond: (organizational_unit_id = ou2.id)
13. 10.304 10.304 ↓ 0.0 0 10,304

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=10,304)

  • Index Cond: ((organization_id = organization_assignment.organization_id) AND (state = 'ACTIVE'::text))
14. 0.000 7.682 ↓ 0.0 0 3,841

Nested Loop (cost=0.29..7.31 rows=1 width=16) (actual time=0.002..0.002 rows=0 loops=3,841)

15. 3.841 3.841 ↑ 1.0 1 3,841

Index Scan using person_to_person_type_person_idx on person_to_person_type (cost=0.14..6.83 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=3,841)

  • Index Cond: (person_id = employee.person_id)
16. 3.841 3.841 ↓ 0.0 0 3,841

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=3,841)

  • Index Cond: (id = person_to_person_type.person_type_id)
  • Filter: (base_type = 'INTERNAL'::text)
  • Rows Removed by Filter: 1
17. 11.523 11.523 ↑ 1.0 1 3,841

Seq Scan on person_assignment (cost=0.00..1.44 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=3,841)

  • Filter: ((state = 'ACTIVE'::text) AND (person_id = '8e459ecd-2208-44b9-836a-b9bbf182ec03'::uuid))
  • Rows Removed by Filter: 28
18. 0.167 0.167 ↑ 1.0 1 167

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

  • Index Cond: (id = employee.person_id)
Planning time : 1.155 ms
Execution time : 38.396 ms