explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4asD

Settings
# exclusive inclusive rows x rows loops node
1. 13.812 2,259.590 ↑ 1,396.5 10 1

Gather (cost=13,167.93..75,110.85 rows=13,965 width=606) (actual time=1,422.682..2,259.590 rows=10 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
2. 0.106 2,245.778 ↑ 1,939.7 3 3 / 3

Hash Left Join (cost=12,167.93..72,714.35 rows=5,819 width=606) (actual time=1,411.976..2,245.778 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.245 2,167.750 ↑ 10,315.0 3 3 / 3

Hash Left Join (cost=12,002.57..72,467.76 rows=30,945 width=611) (actual time=1,334.012..2,167.750 rows=3 loops=3)

  • Hash Cond: (auth_user.id = accounts_profile.user_id)
4. 0.296 1,613.925 ↑ 10,315.0 3 3 / 3

Hash Left Join (cost=1,862.11..62,246.06 rows=30,945 width=610) (actual time=780.233..1,613.925 rows=3 loops=3)

  • Hash Cond: (appointments_busy.user_id = auth_user.id)
5. 1,216.312 1,236.510 ↑ 10,315.0 3 3 / 3

Parallel Seq Scan on appointments_busy (cost=340.70..60,643.40 rows=30,945 width=606) (actual time=402.865..1,236.510 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.633 20.198 ↓ 1.6 34 3 / 3

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

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

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

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

  • Index Cond: (employeegroup_id = 1,187)
  • Heap Fetches: 6
10. 12.744 12.744 ↑ 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.354..0.354 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. 2.584 2.584 ↑ 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.076..0.076 rows=1 loops=102)

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

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

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,260kB
13. 187.940 187.940 ↑ 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.061..187.940 rows=28,550 loops=3)

  • Heap Fetches: 134
14. 195.542 553.580 ↑ 1.0 28,465 3 / 3

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

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

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

16. 10.543 77.922 ↑ 1.0 1,515 3 / 3

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

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

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

Planning time : 21.865 ms
Execution time : 2,260.254 ms