explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ps3A

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 339.925 ↑ 1.0 1 1

Aggregate (cost=61,876.78..61,876.79 rows=1 width=8) (actual time=339.925..339.925 rows=1 loops=1)

2. 0.306 339.916 ↑ 353.0 99 1

HashAggregate (cost=61,090.52..61,439.97 rows=34,945 width=4) (actual time=339.698..339.916 rows=99 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 0.539 339.610 ↑ 151.3 231 1

Hash Join (cost=35,118.69..61,003.16 rows=34,945 width=4) (actual time=211.043..339.610 rows=231 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:56:32.198428'::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:56:32.198428'::timestamp without time zone) AND (hashed SubPlan 2)) OR (hashed SubPlan 3))
  • Rows Removed by Join Filter: 825
4. 1.826 337.725 ↑ 33.1 1,056 1

Hash Join (cost=34,828.29..60,620.66 rows=34,960 width=17) (actual time=202.384..337.725 rows=1,056 loops=1)

  • Hash Cond: (action_required_actionrequired.client_id = clients_client.id)
5. 151.050 151.114 ↑ 63.0 2,900 1

Index Scan using action_required_actionre_action_completed_polymor_bc9ca40d_idx on action_required_actionrequired (cost=14.69..25,327.73 rows=182,603 width=17) (actual time=16.595..151.114 rows=2,900 loops=1)

  • Index Cond: (action_completed = false)
  • Filter: ((NOT action_completed) AND ((polymorphic_ctype_id = 317) OR (polymorphic_ctype_id = 339)) AND (((is_handed_off OR (handoff_reference_time < '2020-08-31 15:56:32.198428'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT is_handed_off) AND (handoff_reference_time >= '2020-08-31 15:56:32.198428'::timestamp without time zone)) OR (hashed SubPlan 3)))
  • Rows Removed by Filter: 290,916
6.          

SubPlan (for Index Scan)

7. 0.006 0.030 ↑ 1.0 2 2

Nested Loop (cost=0.56..7.40 rows=2 width=4) (actual time=0.012..0.015 rows=2 loops=2)

8. 0.012 0.012 ↑ 1.0 2 2

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1 (cost=0.29..3.51 rows=2 width=4) (actual time=0.005..0.006 rows=2 loops=2)

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

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

  • Index Cond: (id = u1.employeegroup_id)
  • Heap Fetches: 4
10. 0.000 0.034 ↓ 0.0 0 2

Nested Loop (cost=0.56..6.86 rows=1 width=4) (actual time=0.017..0.017 rows=0 loops=2)

  • Join Filter: (u0_2.id = u1_2.employeegroup_id)
  • Rows Removed by Join Filter: 16
11. 0.018 0.018 ↑ 1.0 8 2

Index Scan using accounts_employeegroup_team_type_a13504aa on accounts_employeegroup u0_2 (cost=0.28..3.10 rows=8 width=4) (actual time=0.005..0.009 rows=8 loops=2)

  • Index Cond: (team_type = 20)
12. 0.011 0.016 ↑ 1.0 2 16

Materialize (cost=0.29..3.52 rows=2 width=4) (actual time=0.001..0.001 rows=2 loops=16)

13. 0.005 0.005 ↑ 1.0 2 1

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

  • Index Cond: (user_id = 30,782)
14. 29.179 184.785 ↑ 1.4 151,867 1

Hash (cost=32,250.27..32,250.27 rows=205,066 width=4) (actual time=184.785..184.785 rows=151,867 loops=1)

  • Buckets: 262,144 Batches: 1 Memory Usage: 7,388kB
15. 155.606 155.606 ↑ 1.4 151,867 1

Index Scan using clients_client_brokerage_id on clients_client (cost=0.43..32,250.27 rows=205,066 width=4) (actual time=0.018..155.606 rows=151,867 loops=1)

  • Index Cond: (brokerage_id = 18,855)
  • Filter: ((status <> ALL ('{50,70}'::integer[])) AND (status <> 80))
  • Rows Removed by Filter: 95,410
16. 0.224 1.302 ↑ 1.0 1,855 1

Hash (cost=245.55..245.55 rows=1,855 width=8) (actual time=1.301..1.302 rows=1,855 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 83kB
17. 1.078 1.078 ↑ 1.0 1,855 1

Seq Scan on accounts_employeegroup (cost=0.00..245.55 rows=1,855 width=8) (actual time=0.005..1.078 rows=1,855 loops=1)

18.          

SubPlan (for Hash Join)

19. 0.002 0.044 ↑ 1.0 2 1

Nested Loop (cost=0.56..7.40 rows=2 width=4) (actual time=0.040..0.044 rows=2 loops=1)

20. 0.014 0.014 ↑ 1.0 2 1

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1_1 (cost=0.29..3.51 rows=2 width=4) (actual time=0.014..0.014 rows=2 loops=1)

  • Index Cond: (user_id = 30,782)
21. 0.028 0.028 ↑ 1.0 1 2

Index Only Scan using accounts_employeegroup_pkey on accounts_employeegroup u0_1 (cost=0.28..1.95 rows=1 width=4) (actual time=0.014..0.014 rows=1 loops=2)

  • Index Cond: (id = u1_1.employeegroup_id)
  • Heap Fetches: 2
Planning time : 2.164 ms
Execution time : 341.026 ms