explain.depesz.com

PostgreSQL's explain analyze made readable

Result: O4Gy

Settings
# exclusive inclusive rows x rows loops node
1. 7.122 904.519 ↑ 1,395.0 10 1

Gather (cost=13,167.93..75,103.31 rows=13,950 width=606) (actual time=845.439..904.519 rows=10 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
2. 0.094 897.397 ↑ 1,937.3 3 3 / 3

Hash Left Join (cost=12,167.93..72,708.31 rows=5,812 width=606) (actual time=838.407..897.397 rows=3 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.182 877.318 ↑ 10,303.7 3 3 / 3

Hash Left Join (cost=12,002.57..72,461.81 rows=30,911 width=611) (actual time=818.382..877.318 rows=3 loops=3)

  • Hash Cond: (auth_user.id = accounts_profile.user_id)
4. 0.259 465.938 ↑ 10,303.7 3 3 / 3

Hash Left Join (cost=1,862.11..62,240.19 rows=30,911 width=610) (actual time=407.046..465.938 rows=3 loops=3)

  • Hash Cond: (appointments_busy.user_id = auth_user.id)
5. 100.720 103.460 ↑ 10,303.7 3 3 / 3

Parallel Seq Scan on appointments_busy (cost=340.70..60,637.63 rows=30,911 width=606) (actual time=44.616..103.460 rows=3 loops=3)

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

SubPlan (for Parallel Seq Scan)

7. 0.739 2.740 ↓ 1.6 34 3 / 3

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

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

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

9. 0.306 0.306 ↑ 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.059..0.306 rows=36 loops=3)

  • Index Cond: (employeegroup_id = 1,187)
  • Heap Fetches: 3
10. 0.576 0.576 ↑ 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.016..0.016 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.408 0.408 ↑ 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.012..0.012 rows=1 loops=102)

  • Index Cond: (id = u3.user_id)
  • Filter: is_active
12. 182.419 362.219 ↑ 1.0 28,550 3 / 3

Hash (cost=1,164.54..1,164.54 rows=28,550 width=4) (actual time=362.214..362.219 rows=28,550 loops=3)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,260kB
13. 179.800 179.800 ↑ 1.0 28,550 3 / 3

Index Only Scan using auth_user_pkey on auth_user (cost=0.29..1,164.54 rows=28,550 width=4) (actual time=0.066..179.800 rows=28,550 loops=3)

  • Heap Fetches: 134
14. 190.982 411.198 ↑ 1.0 28,465 3 / 3

Hash (cost=9,784.65..9,784.65 rows=28,465 width=9) (actual time=411.192..411.198 rows=28,465 loops=3)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,396kB
15. 220.216 220.216 ↑ 1.0 28,465 3 / 3

Seq Scan on accounts_profile (cost=0.00..9,784.65 rows=28,465 width=9) (actual time=14.045..220.216 rows=28,465 loops=3)

16. 9.865 19.985 ↑ 1.0 1,515 3 / 3

Hash (cost=146.27..146.27 rows=1,527 width=8) (actual time=19.980..19.985 rows=1,515 loops=3)

  • Buckets: 2,048 Batches: 1 Memory Usage: 76kB
17. 10.120 10.120 ↑ 1.0 1,515 3 / 3

Seq Scan on accounts_employeegroup (cost=0.00..146.27 rows=1,527 width=8) (actual time=0.020..10.120 rows=1,515 loops=3)

Planning time : 3.675 ms
Execution time : 905.292 ms