explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6yAp

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.664 12,258.232 ↑ 1.0 1 1

Aggregate (cost=85,736.28..85,736.29 rows=1 width=8) (actual time=12,258.221..12,258.232 rows=1 loops=1)

2. 2.834 12,257.568 ↑ 755.1 108 1

HashAggregate (cost=83,901.36..84,716.88 rows=81,552 width=4) (actual time=12,256.459..12,257.568 rows=108 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 3.650 12,254.734 ↑ 542.1 248 1

Hash Join (cost=63,750.14..83,565.24 rows=134,451 width=4) (actual time=12,088.422..12,254.734 rows=248 loops=1)

  • Hash Cond: (action_required_actionrequired.site_team_group_id = accounts_employeegroup.id)
  • Join Filter: (((action_required_actionrequired.is_handed_off OR (action_required_actionrequired.handoff_reference_time < '2020-08-31 15:42:44.580112'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT action_required_actionrequired.is_handed_off) AND (action_required_actionrequired.handoff_reference_time >= '2020-08-31 15:42:44.580112'::timestamp without time zone) AND (hashed SubPlan 2)) OR (hashed SubPlan 3))
4. 9.056 12,221.322 ↑ 542.1 248 1

Hash Join (cost=63,461.48..82,922.34 rows=134,452 width=17) (actual time=12,058.510..12,221.322 rows=248 loops=1)

  • Hash Cond: (action_required_actionrequired.client_id = clients_client.id)
5. 158.239 173.378 ↑ 166.8 970 1

Bitmap Heap Scan on action_required_actionrequired (cost=4,660.99..23,697.21 rows=161,767 width=17) (actual time=16.725..173.378 rows=970 loops=1)

  • Recheck Cond: (((NOT action_completed) AND (polymorphic_ctype_id = 317)) OR (polymorphic_ctype_id = 339))
  • Filter: ((NOT action_completed) AND (((is_handed_off OR (handoff_reference_time < '2020-08-31 15:42:44.580112'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT is_handed_off) AND (handoff_reference_time >= '2020-08-31 15:42:44.580112'::timestamp without time zone)) OR (hashed SubPlan 3)))
  • Rows Removed by Filter: 230,565
  • Heap Blocks: exact=13,584
6. 0.063 14.328 ↓ 0.0 0 1

BitmapOr (cost=4,610.64..4,610.64 rows=215,689 width=0) (actual time=14.322..14.328 rows=0 loops=1)

7. 14.236 14.236 ↓ 1.1 231,523 1

Bitmap Index Scan on action_required_actionre_action_completed_polymor_bc9ca40d_idx (cost=0.00..4,525.32 rows=215,689 width=0) (actual time=14.231..14.236 rows=231,523 loops=1)

  • Index Cond: ((action_completed = false) AND (polymorphic_ctype_id = 317))
8. 0.029 0.029 ↓ 12.0 12 1

Bitmap Index Scan on action_required_actionrequired_polymorphic_ctype_id_2454fb9d (cost=0.00..4.44 rows=1 width=0) (actual time=0.024..0.029 rows=12 loops=1)

  • Index Cond: (polymorphic_ctype_id = 339)
9.          

SubPlan (for Bitmap Heap Scan)

10. 0.088 0.204 ↑ 1.0 2 2

Nested Loop (cost=0.56..28.08 rows=2 width=4) (actual time=0.045..0.102 rows=2 loops=2)

11. 0.064 0.064 ↑ 1.0 2 2

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1 (cost=0.29..11.48 rows=2 width=4) (actual time=0.014..0.032 rows=2 loops=2)

  • Index Cond: (user_id = 30,782)
12. 0.052 0.052 ↑ 1.0 1 4

Index Only Scan using accounts_employeegroup_pkey on accounts_employeegroup u0 (cost=0.28..8.29 rows=1 width=4) (actual time=0.010..0.013 rows=1 loops=4)

  • Index Cond: (id = u1.employeegroup_id)
  • Heap Fetches: 4
13. 0.305 0.607 ↓ 0.0 0 1

Nested Loop (cost=0.56..22.26 rows=1 width=4) (actual time=0.596..0.607 rows=0 loops=1)

  • Join Filter: (u0_2.id = u1_2.employeegroup_id)
  • Rows Removed by Join Filter: 18
14. 0.095 0.095 ↑ 1.0 9 1

Index Scan using accounts_employeegroup_team_type_a13504aa on accounts_employeegroup u0_2 (cost=0.28..10.50 rows=9 width=4) (actual time=0.020..0.095 rows=9 loops=1)

  • Index Cond: (team_type = 20)
15. 0.173 0.207 ↑ 1.0 2 9

Materialize (cost=0.29..11.49 rows=2 width=4) (actual time=0.008..0.023 rows=2 loops=9)

16. 0.034 0.034 ↑ 1.0 2 1

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1_2 (cost=0.29..11.48 rows=2 width=4) (actual time=0.009..0.034 rows=2 loops=1)

  • Index Cond: (user_id = 30,782)
17. 5,956.094 12,038.888 ↑ 1.0 848,947 1

Hash (cost=48,088.63..48,088.63 rows=856,949 width=4) (actual time=12,038.882..12,038.888 rows=848,947 loops=1)

  • Buckets: 1,048,576 Batches: 1 Memory Usage: 38,038kB
18. 6,082.794 6,082.794 ↑ 1.0 848,947 1

Seq Scan on clients_client (cost=0.00..48,088.63 rows=856,949 width=4) (actual time=0.034..6,082.794 rows=848,947 loops=1)

  • Filter: ((status <> ALL ('{50,70}'::integer[])) AND (status <> 80))
  • Rows Removed by Filter: 182,059
19. 14.644 29.762 ↑ 1.0 1,832 1

Hash (cost=187.32..187.32 rows=1,832 width=8) (actual time=29.756..29.762 rows=1,832 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 82kB
20. 15.118 15.118 ↑ 1.0 1,832 1

Seq Scan on accounts_employeegroup (cost=0.00..187.32 rows=1,832 width=8) (actual time=0.026..15.118 rows=1,832 loops=1)

21.          

SubPlan (for Hash Join)

22. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..28.08 rows=2 width=4) (never executed)

23. 0.000 0.000 ↓ 0.0 0

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1_1 (cost=0.29..11.48 rows=2 width=4) (never executed)

  • Index Cond: (user_id = 30,782)
24. 0.000 0.000 ↓ 0.0 0

Index Only Scan using accounts_employeegroup_pkey on accounts_employeegroup u0_1 (cost=0.28..8.29 rows=1 width=4) (never executed)

  • Index Cond: (id = u1_1.employeegroup_id)
  • Heap Fetches: 0
Planning time : 2.925 ms
Execution time : 12,259.308 ms