explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LBKB

Settings
# exclusive inclusive rows x rows loops node
1. 0.050 58,912.320 ↑ 1.0 1 1

Sort (cost=117.19..117.20 rows=1 width=3,646) (actual time=58,912.320..58,912.320 rows=1 loops=1)

  • Sort Key: e.name_full
  • Sort Method: quicksort Memory: 26kB
2. 0.014 58,912.270 ↑ 1.0 1 1

Nested Loop Left Join (cost=3.25..117.18 rows=1 width=3,646) (actual time=58,910.075..58,912.270 rows=1 loops=1)

3. 0.001 2.301 ↑ 1.0 1 1

Nested Loop Left Join (cost=2.96..91.81 rows=1 width=3,616) (actual time=0.107..2.301 rows=1 loops=1)

4. 0.002 2.291 ↑ 1.0 1 1

Nested Loop Left Join (cost=2.69..83.50 rows=1 width=3,608) (actual time=0.097..2.291 rows=1 loops=1)

  • Join Filter: (e.id = te.employee_id)
5. 0.001 0.100 ↑ 1.0 1 1

Nested Loop Left Join (cost=2.40..68.72 rows=1 width=3,600) (actual time=0.086..0.100 rows=1 loops=1)

6. 0.003 0.092 ↑ 1.0 1 1

Nested Loop Left Join (cost=2.11..60.41 rows=1 width=3,320) (actual time=0.078..0.092 rows=1 loops=1)

  • Join Filter: (ea1.employee_id = e.id)
7. 0.001 0.079 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.69..51.96 rows=1 width=3,312) (actual time=0.067..0.079 rows=1 loops=1)

  • Join Filter: (e.department_id = dep.id)
  • Rows Removed by Join Filter: 1
8. 0.002 0.074 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.69..49.88 rows=1 width=3,298) (actual time=0.062..0.074 rows=1 loops=1)

9. 0.001 0.063 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.42..41.56 rows=1 width=3,273) (actual time=0.052..0.063 rows=1 loops=1)

  • Join Filter: (e.id = ea.employee_id)
10. 0.001 0.049 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.14..33.25 rows=1 width=3,270) (actual time=0.038..0.049 rows=1 loops=1)

  • Join Filter: (e.id = epn1.employee_id)
11. 0.001 0.042 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.85..24.93 rows=1 width=3,259) (actual time=0.031..0.042 rows=1 loops=1)

  • Join Filter: (e.id = epn.employee_id)
12. 0.004 0.033 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.56..16.61 rows=1 width=3,248) (actual time=0.022..0.033 rows=1 loops=1)

  • Join Filter: (e.id = u.employee_id)
13. 0.013 0.013 ↑ 1.0 1 1

Index Scan using pk_employees on employees e (cost=0.28..8.30 rows=1 width=3,244) (actual time=0.011..0.013 rows=1 loops=1)

  • Index Cond: (id = 701)
14. 0.016 0.016 ↑ 1.0 1 1

Index Scan using idx_users_employee_id on users u (cost=0.28..8.30 rows=1 width=8) (actual time=0.008..0.016 rows=1 loops=1)

  • Index Cond: (employee_id = 701)
15. 0.008 0.008 ↑ 1.0 1 1

Index Scan using uk_employee_phone_numbers_phone_number_type_id on employee_phone_numbers epn (cost=0.29..8.30 rows=1 width=15) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: ((employee_id = 701) AND (phone_number_type_id = 1))
16. 0.006 0.006 ↑ 1.0 1 1

Index Scan using uk_employee_phone_numbers_phone_number_type_id on employee_phone_numbers epn1 (cost=0.29..8.30 rows=1 width=15) (actual time=0.006..0.006 rows=1 loops=1)

  • Index Cond: ((employee_id = 701) AND (phone_number_type_id = 4))
17. 0.013 0.013 ↑ 1.0 1 1

Index Scan using uk_employee_addresses_address_type_id on employee_addresses ea (cost=0.29..8.30 rows=1 width=7) (actual time=0.013..0.013 rows=1 loops=1)

  • Index Cond: ((employee_id = 701) AND (address_type_id = 1))
18. 0.009 0.009 ↑ 1.0 1 1

Index Scan using pk_designations on designations des (cost=0.28..8.29 rows=1 width=29) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (e.designation_id = id)
19. 0.004 0.004 ↑ 24.0 2 1

Seq Scan on departments dep (cost=0.00..1.48 rows=48 width=18) (actual time=0.004..0.004 rows=2 loops=1)

20. 0.010 0.010 ↑ 1.0 1 1

Index Scan using idx_employee_applications_employee_id on employee_applications ea1 (cost=0.42..8.44 rows=1 width=12) (actual time=0.009..0.010 rows=1 loops=1)

  • Index Cond: (employee_id = 701)
21. 0.007 0.007 ↓ 0.0 0 1

Index Scan using idx_employee_application_details_employee_application_id on employee_application_details ead (cost=0.29..8.30 rows=1 width=284) (actual time=0.007..0.007 rows=0 loops=1)

  • Index Cond: (employee_application_id = ea1.id)
22. 2.189 2.189 ↑ 1.0 1 1

Index Scan using idx_team_employees_employee_id on team_employees te (cost=0.29..14.77 rows=1 width=12) (actual time=0.010..2.189 rows=1 loops=1)

  • Index Cond: (employee_id = 701)
  • Filter: (is_primary_team = 1)
  • Rows Removed by Filter: 6
23. 0.009 0.009 ↑ 1.0 1 1

Index Scan using pk_teams on teams t (cost=0.28..8.29 rows=1 width=12) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (id = te.team_id)
24. 0.007 0.007 ↑ 1.0 1 1

Index Scan using pk_employees on employees e1 (cost=0.28..8.30 rows=1 width=18) (actual time=0.007..0.007 rows=1 loops=1)

  • Index Cond: (id = te.manager_employee_id)
25.          

SubPlan (for Nested Loop Left Join)

26. 0.004 58,907.739 ↑ 1.0 1 1

Aggregate (cost=8.52..8.53 rows=1 width=8) (actual time=58,907.739..58,907.739 rows=1 loops=1)

27. 58,907.735 58,907.735 ↓ 0.0 0 1

Index Scan using idx_actions_employee_id on actions (cost=0.50..8.52 rows=1 width=4) (actual time=58,907.735..58,907.735 rows=0 loops=1)

  • Index Cond: (e.id = employee_id)
  • Filter: (action_result_id = 110)
28. 0.003 2.209 ↑ 1.0 1 1

Aggregate (cost=8.53..8.54 rows=1 width=8) (actual time=2.209..2.209 rows=1 loops=1)

29. 2.206 2.206 ↓ 0.0 0 1

Index Scan using idx_actions_employee_id on actions actions_1 (cost=0.50..8.52 rows=1 width=4) (actual time=2.206..2.206 rows=0 loops=1)

  • Index Cond: (e.id = employee_id)
  • Filter: ((action_type_id = 208) AND (action_result_id = 110))
Planning time : 3.570 ms