explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Vm5U

Settings
# exclusive inclusive rows x rows loops node
1. 0.018 26.348 ↑ 1.0 1 1

Aggregate (cost=23,902.76..23,902.77 rows=1 width=8) (actual time=26.348..26.348 rows=1 loops=1)

2. 0.000 26.330 ↑ 102.8 167 1

HashAggregate (cost=23,516.48..23,688.16 rows=17,168 width=4) (actual time=26.169..26.330 rows=167 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 3.422 26.970 ↑ 75.5 281 1

Gather (cost=1,237.77..23,463.47 rows=21,202 width=4) (actual time=2.423..26.970 rows=281 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 0.415 23.548 ↑ 89.1 140 2 / 2

Nested Loop (cost=237.77..20,343.27 rows=12,472 width=4) (actual time=3.219..23.548 rows=140 loops=2)

5. 1.150 20.502 ↑ 15.6 877 2 / 2

Hash Join (cost=237.34..2,743.07 rows=13,724 width=4) (actual time=2.341..20.502 rows=877 loops=2)

  • Hash Cond: (action_required_actionrequired.site_team_group_id = accounts_employeegroup.id)
  • Join Filter: (((action_required_actionrequired.is_handed_off OR (action_required_actionrequired.created_at < '2020-05-20 14:20:05.387705'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT action_required_actionrequired.is_handed_off) AND (action_required_actionrequired.created_at >= '2020-05-20 14:20:05.387705'::timestamp without time zone) AND (hashed SubPlan 2)))
  • Rows Removed by Join Filter: 879
6. 17.606 17.786 ↑ 7.9 1,756 2 / 2

Parallel Index Scan using action_required_actionre_action_completed_polymor_bc9ca40d_idx on action_required_actionrequired (cost=6.23..2,475.33 rows=13,914 width=17) (actual time=0.531..17.786 rows=1,756 loops=2)

  • Index Cond: ((action_completed = false) AND (polymorphic_ctype_id = 317))
  • Filter: ((NOT action_completed) AND (((is_handed_off OR (created_at < '2020-05-20 14:20:05.387705'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT is_handed_off) AND (created_at >= '2020-05-20 14:20:05.387705'::timestamp without time zone))))
  • Rows Removed by Filter: 24426
7.          

SubPlan (for Parallel Index Scan)

8. 0.005 0.180 ↓ 4.0 8 10 / 2

Nested Loop (cost=0.56..5.80 rows=2 width=4) (actual time=0.019..0.036 rows=8 loops=10)

9. 0.055 0.055 ↓ 4.0 8 10 / 2

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1 (cost=0.29..3.01 rows=2 width=4) (actual time=0.007..0.011 rows=8 loops=10)

  • Index Cond: (user_id = 30738)
10. 0.120 0.120 ↑ 1.0 1 80 / 2

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

  • Index Cond: (id = u1.employeegroup_id)
  • Heap Fetches: 0
11. 0.288 1.526 ↑ 1.0 1,489 2 / 2

Hash (cost=200.89..200.89 rows=1,489 width=8) (actual time=1.526..1.526 rows=1,489 loops=2)

  • Buckets: 2048 Batches: 1 Memory Usage: 70kB
12. 1.238 1.238 ↑ 1.0 1,489 2 / 2

Seq Scan on accounts_employeegroup (cost=0.00..200.89 rows=1,489 width=8) (actual time=0.007..1.238 rows=1,489 loops=2)

13.          

SubPlan (for Hash Join)

14. 0.003 0.040 ↓ 4.0 8 2 / 2

Nested Loop (cost=0.56..5.80 rows=2 width=4) (actual time=0.022..0.040 rows=8 loops=2)

15. 0.013 0.013 ↓ 4.0 8 2 / 2

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1_1 (cost=0.29..3.01 rows=2 width=4) (actual time=0.008..0.013 rows=8 loops=2)

  • Index Cond: (user_id = 30738)
16. 0.024 0.024 ↑ 1.0 1 16 / 2

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

  • Index Cond: (id = u1_1.employeegroup_id)Heap Fetches: 0
17. 2.631 2.631 ↓ 0.0 0 1,754 / 2

Index Scan using clients_client_pkey on clients_client (cost=0.42..1.28 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=1,754)

  • Index Cond: (id = action_required_actionrequired.client_id)
  • Filter: (status <> 80)
  • Rows Removed by Filter: 1
Planning time : 1.428 ms
Execution time : 27.423 ms