explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 84Jn

Settings
# exclusive inclusive rows x rows loops node
1. 0.030 76.677 ↑ 1.0 1 1

Aggregate (cost=31,897.25..31,897.26 rows=1 width=8) (actual time=76.676..76.677 rows=1 loops=1)

2. 0.000 76.647 ↑ 50.6 453 1

HashAggregate (cost=31,381.17..31,610.54 rows=22,937 width=4) (actual time=76.488..76.647 rows=453 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 6.284 78.195 ↑ 21.8 1,084 1

Gather (cost=1,241.05..31,322.17 rows=23,602 width=4) (actual time=3.385..78.195 rows=1,084 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 9.141 71.911 ↑ 25.6 542 2 / 2

Hash Join (cost=241.05..27,961.97 rows=13,884 width=4) (actual time=2.243..71.911 rows=542 loops=2)

  • Hash Cond: (action_required_actionrequired.site_team_group_id = accounts_employeegroup.id)
  • Join Filter: (((action_required_actionrequired.is_handed_off OR (clients_client.created_at < '2020-05-19 20:03:03.360374'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT action_required_actionrequired.is_handed_off) AND (clients_client.created_at > '2020-05-19 20:03:03.360374'::timestamp without time zone) AND (hashed SubPlan 2)))
  • Rows Removed by Join Filter: 24211
5. 2.668 61.747 ↓ 1.1 24,753 2 / 2

Nested Loop (cost=7.75..27,668.37 rows=22,904 width=17) (actual time=0.053..61.747 rows=24,753 loops=2)

6. 9.468 9.573 ↓ 1.1 24,753 2 / 2

Parallel Index Scan using tmp_ar_completed_ctype on action_required_actionrequired (cost=7.32..2,327.16 rows=22,904 width=9) (actual time=0.044..9.573 rows=24,753 loops=2)

  • Index Cond: ((action_completed = false) AND (polymorphic_ctype_id = 317))
  • Filter: ((NOT action_completed) AND ((hashed SubPlan 1) OR (NOT is_handed_off)))
  • Rows Removed by Filter: 1254
7.          

SubPlan (for Parallel Index Scan)

8. 0.010 0.105 ↓ 3.0 6 10 / 2

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

9. 0.035 0.035 ↓ 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.005..0.007 rows=6 loops=10)

  • Index Cond: (user_id = 30867)
10. 0.060 0.060 ↑ 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.002..0.002 rows=1 loops=60)

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

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

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

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

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

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

14.          

SubPlan (for Hash Join)

15. 0.004 0.015 ↓ 3.0 6 2 / 2

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

16. 0.005 0.005 ↓ 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.003..0.005 rows=6 loops=2)

  • Index Cond: (user_id = 30867)
17. 0.006 0.006 ↑ 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.001..0.001 rows=1 loops=12)

  • Index Cond: (id = u1_1.employeegroup_id)
  • Heap Fetches: 1
Planning time : 1.030 ms
Execution time : 78.810 ms