explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Gcbx

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 559.985 ↑ 1.0 1 1

Aggregate (cost=91,015.94..91,015.95 rows=1 width=8) (actual time=559.985..559.985 rows=1 loops=1)

2. 0.526 559.975 ↑ 925.1 99 1

HashAggregate (cost=88,955.19..89,871.08 rows=91,589 width=4) (actual time=559.544..559.975 rows=99 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 0.901 559.449 ↑ 657.0 231 1

Hash Join (cost=62,380.35..88,575.75 rows=151,777 width=4) (actual time=428.399..559.449 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: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))
  • Rows Removed by Join Filter: 1,721
4. 4.521 557.214 ↑ 77.8 1,952 1

Hash Join (cost=62,089.95..87,885.32 rows=151,843 width=17) (actual time=419.103..557.214 rows=1,952 loops=1)

  • Hash Cond: (action_required_actionrequired.client_id = clients_client.id)
5. 153.614 153.686 ↑ 62.3 2,931 1

Index Scan using action_required_actionre_action_completed_polymor_bc9ca40d_idx on action_required_actionrequired (cost=14.69..25,330.67 rows=182,624 width=17) (actual time=16.547..153.686 rows=2,931 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: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: 290,902
6.          

SubPlan (for Index Scan)

7. 0.002 0.038 ↑ 1.0 2 2

Nested Loop (cost=0.56..7.40 rows=2 width=4) (actual time=0.016..0.019 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.024 0.024 ↑ 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.006..0.006 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.010 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.006 0.006 ↑ 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.006 rows=2 loops=1)

  • Index Cond: (user_id = 30,782)
14. 187.137 399.007 ↓ 1.0 893,748 1

Hash (cost=50,943.29..50,943.29 rows=890,558 width=4) (actual time=399.007..399.007 rows=893,748 loops=1)

  • Buckets: 1,048,576 Batches: 1 Memory Usage: 39,613kB
15. 211.870 211.870 ↓ 1.0 893,748 1

Seq Scan on clients_client (cost=0.00..50,943.29 rows=890,558 width=4) (actual time=0.008..211.870 rows=893,748 loops=1)

  • Filter: ((status <> ALL ('{50,70}'::integer[])) AND (status <> 80))
  • Rows Removed by Filter: 192,153
16. 0.229 1.302 ↑ 1.0 1,855 1

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

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

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

18.          

SubPlan (for Hash Join)

19. 0.004 0.032 ↑ 1.0 2 1

Nested Loop (cost=0.56..7.40 rows=2 width=4) (actual time=0.027..0.032 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.013..0.014 rows=2 loops=1)

  • Index Cond: (user_id = 30,782)
21. 0.014 0.014 ↑ 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.007..0.007 rows=1 loops=2)

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