explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9pTU

Settings
# exclusive inclusive rows x rows loops node
1. 11.383 114.009 ↓ 0.0 0 1

Gather (cost=13,167.93..74,945.57 rows=12,607 width=625) (actual time=111.539..114.009 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
2. 0.015 102.626 ↓ 0.0 0 3 / 3

Hash Left Join (cost=12,167.93..72,684.87 rows=5,253 width=625) (actual time=102.621..102.626 rows=0 loops=3)

  • Hash Cond: (appointments_busy.employee_group_id = accounts_employeegroup.id)
  • Filter: (((accounts_profile.management_company_id = 18,855) AND accounts_profile.is_active) OR (accounts_employeegroup.company_id = 18,855))
3. 0.015 102.611 ↓ 0.0 0 3 / 3

Hash Left Join (cost=12,002.57..72,446.18 rows=27,935 width=630) (actual time=102.605..102.611 rows=0 loops=3)

  • Hash Cond: (auth_user.id = accounts_profile.user_id)
4. 0.017 102.596 ↓ 0.0 0 3 / 3

Hash Left Join (cost=1,862.11..62,232.38 rows=27,935 width=629) (actual time=102.590..102.596 rows=0 loops=3)

  • Hash Cond: (appointments_busy.user_id = auth_user.id)
5. 99.133 102.579 ↓ 0.0 0 3 / 3

Parallel Seq Scan on appointments_busy (cost=340.70..60,637.63 rows=27,935 width=625) (actual time=102.574..102.579 rows=0 loops=3)

  • Filter: (("end" > '2020-08-30 00:00:00'::timestamp without time zone) AND (start < '2020-08-30 23:59:59.999999'::timestamp without time zone) AND (((employee_group_id IS NULL) AND (hashed SubPlan 1)) OR (employee_group_id = 1,187)))
  • Rows Removed by Filter: 212,917
6.          

SubPlan (for Parallel Seq Scan)

7. 0.815 3.446 ↓ 1.6 34 3 / 3

Nested Loop (cost=0.98..340.64 rows=21 width=4) (actual time=0.162..3.446 rows=34 loops=3)

  • Join Filter: (u1.user_id = u0.id)
8. 0.941 2.087 ↓ 1.4 34 3 / 3

Nested Loop (cost=0.70..325.29 rows=24 width=8) (actual time=0.112..2.087 rows=34 loops=3)

9. 0.498 0.498 ↑ 1.1 36 3 / 3

Index Only Scan using accounts_employeegroup_employees_employeegroup_id_user_id_key on accounts_employeegroup_employees u1 (cost=0.29..8.95 rows=38 width=4) (actual time=0.056..0.498 rows=36 loops=3)

  • Index Cond: (employeegroup_id = 1,187)
  • Heap Fetches: 3
10. 0.648 0.648 ↑ 1.0 1 108 / 3

Index Scan using accounts_profile_user_id_key on accounts_profile u3 (cost=0.41..8.32 rows=1 width=4) (actual time=0.018..0.018 rows=1 loops=108)

  • Index Cond: (user_id = u1.user_id)
  • Filter: (is_active AND (NOT disable_user_assignment))
  • Rows Removed by Filter: 0
11. 0.544 0.544 ↑ 1.0 1 102 / 3

Index Scan using auth_user_pkey on auth_user u0 (cost=0.29..0.63 rows=1 width=4) (actual time=0.016..0.016 rows=1 loops=102)

  • Index Cond: (id = u3.user_id)
  • Filter: is_active
12. 0.000 0.000 ↓ 0.0 0 / 3

Hash (cost=1,164.54..1,164.54 rows=28,550 width=4) (never executed)

13. 0.000 0.000 ↓ 0.0 0 / 3

Index Only Scan using auth_user_pkey on auth_user (cost=0.29..1,164.54 rows=28,550 width=4) (never executed)

  • Heap Fetches: 0
14. 0.000 0.000 ↓ 0.0 0 / 3

Hash (cost=9,784.65..9,784.65 rows=28,465 width=9) (never executed)

15. 0.000 0.000 ↓ 0.0 0 / 3

Seq Scan on accounts_profile (cost=0.00..9,784.65 rows=28,465 width=9) (never executed)

16. 0.000 0.000 ↓ 0.0 0 / 3

Hash (cost=146.27..146.27 rows=1,527 width=8) (never executed)

17. 0.000 0.000 ↓ 0.0 0 / 3

Seq Scan on accounts_employeegroup (cost=0.00..146.27 rows=1,527 width=8) (never executed)

Planning time : 2.400 ms
Execution time : 114.455 ms