explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Us9i

Settings
# exclusive inclusive rows x rows loops node
1. 0.029 105.814 ↑ 1.0 1 1

Aggregate (cost=31,920.15..31,920.16 rows=1 width=8) (actual time=105.814..105.814 rows=1 loops=1)

2. 0.000 105.785 ↑ 50.0 446 1

HashAggregate (cost=31,418.63..31,641.53 rows=22,290 width=4) (actual time=105.615..105.785 rows=446 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 3.352 106.074 ↑ 21.1 1,054 1

Gather (cost=1,240.81..31,362.90 rows=22,290 width=4) (actual time=5.053..106.074 rows=1,054 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 12.778 102.722 ↑ 24.9 527 2 / 2

Hash Join (cost=240.81..28,133.90 rows=13,112 width=4) (actual time=4.763..102.722 rows=527 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-19 19:45:14.754996'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT action_required_actionrequired.is_handed_off) AND (clients_client.created_at > '2020-05-19 19:45:14.754996'::timestamp without time zone) AND (hashed SubPlan 2)))
  • Rows Removed by Join Filter: 24278
5. 19.597 88.215 ↓ 1.1 24,806 2 / 2

Nested Loop (cost=7.33..27,842.49 rows=22,014 width=25) (actual time=0.085..88.215 rows=24,806 loops=2)

6. 18.787 19.007 ↓ 1.1 24,806 2 / 2

Parallel Seq Scan on action_required_actionrequired (cost=6.90..3,186.91 rows=22,014 width=17) (actual time=0.071..19.007 rows=24,806 loops=2)

  • Filter: ((NOT action_completed) AND (polymorphic_ctype_id = 317) AND (((is_handed_off OR (created_at < '2020-05-19 19:45:14.754996'::timestamp without time zone)) AND (hashed SubPlan 1)) OR (NOT is_handed_off)))
  • Rows Removed by Filter: 54448
7.          

SubPlan (for Parallel Seq Scan)

8. 0.030 0.220 ↓ 3.0 6 10 / 2

Nested Loop (cost=0.56..6.90 rows=2 width=4) (actual time=0.030..0.044 rows=6 loops=10)

9. 0.070 0.070 ↓ 3.0 6 10 / 2

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1 (cost=0.29..3.00 rows=2 width=4) (actual time=0.009..0.014 rows=6 loops=10)

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

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

  • Index Cond: (id = u1.employeegroup_id)
  • Heap Fetches: 0
11. 49.611 49.611 ↑ 1.0 1 49,611 / 2

Index Scan using clients_client_pkey on clients_client (cost=0.42..1.12 rows=1 width=12) (actual time=0.002..0.002 rows=1 loops=49,611)

  • Index Cond: (id = action_required_actionrequired.client_id)
12. 0.326 1.699 ↑ 1.0 1,489 2 / 2

Hash (cost=200.97..200.97 rows=1,497 width=8) (actual time=1.699..1.699 rows=1,489 loops=2)

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

Seq Scan on accounts_employeegroup (cost=0.00..200.97 rows=1,497 width=8) (actual time=0.008..1.373 rows=1,489 loops=2)

14.          

SubPlan (for Hash Join)

15. 0.007 0.030 ↓ 3.0 6 2 / 2

Nested Loop (cost=0.56..6.90 rows=2 width=4) (actual time=0.020..0.030 rows=6 loops=2)

16. 0.011 0.011 ↓ 3.0 6 2 / 2

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1_1 (cost=0.29..3.00 rows=2 width=4) (actual time=0.009..0.011 rows=6 loops=2)

  • Index Cond: (user_id = 30867)
17. 0.012 0.012 ↑ 1.0 1 12 / 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.002..0.002 rows=1 loops=12)

  • Index Cond: (id = u1_1.employeegroup_id)
  • Heap Fetches: 0
Planning time : 2.670 ms
Execution time : 107.291 ms