explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 42Hx

Settings
# exclusive inclusive rows x rows loops node
1. 0.028 21.100 ↑ 1.0 1 1

Aggregate (cost=3,545.43..3,545.44 rows=1 width=8) (actual time=21.100..21.100 rows=1 loops=1)

2. 0.364 21.072 ↑ 38.0 450 1

HashAggregate (cost=3,160.95..3,331.83 rows=17,088 width=4) (actual time=20.923..21.072 rows=450 loops=1)

  • Group Key: action_required_actionrequired.client_id
3. 1.032 20.708 ↑ 21.9 1,064 1

Hash Join (cost=240.62..3,102.58 rows=23,347 width=4) (actual time=1.282..20.708 rows=1,064 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.created_at < '2020-05-19 20:56:57.314224'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT action_required_actionrequired.is_handed_off) AND (action_required_actionrequired.created_at >= '2020-05-19 20:56:57.314224'::timestamp without time zone) AND (hashed SubPlan 2)))
  • Rows Removed by Join Filter: 1819
4. 18.643 18.673 ↑ 8.2 2,883 1

Index Scan using tmp_ar_completed_ctype on action_required_actionrequired (cost=7.32..2,807.00 rows=23,660 width=17) (actual time=0.061..18.673 rows=2,883 loops=1)

  • Index Cond: ((action_completed = false) AND (polymorphic_ctype_id = 317))
  • Filter: ((NOT action_completed) AND (((is_handed_off OR (created_at < '2020-05-19 20:56:57.314224'::timestamp without time zone)) AND (hashed SubPlan 1)) OR ((NOT is_handed_off) AND (created_at >= '2020-05-19 20:56:57.314224'::timestamp without time zone))))
  • Rows Removed by Filter: 49132
5.          

SubPlan (for Index Scan)

6. 0.008 0.030 ↓ 3.0 6 2

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

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

  • Index Cond: (user_id = 30867)
8. 0.012 0.012 ↑ 1.0 1 12

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

  • Index Cond: (id = u1.employeegroup_id)
  • Heap Fetches: 2
9. 0.160 0.986 ↑ 1.0 1,489 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 70kB
10. 0.826 0.826 ↑ 1.0 1,489 1

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

11.          

SubPlan (for Hash Join)

12. 0.005 0.017 ↓ 3.0 6 1

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

13. 0.006 0.006 ↓ 3.0 6 1

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.004..0.006 rows=6 loops=1)

  • Index Cond: (user_id = 30867)
14. 0.006 0.006 ↑ 1.0 1 6

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=6)

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