explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qPrT

Settings
# exclusive inclusive rows x rows loops node
1. 5.068 12,089.489 ↑ 1.0 1 1

Aggregate (cost=42,253.81..42,253.82 rows=1 width=8) (actual time=12,089.477..12,089.489 rows=1 loops=1)

2. 16.762 12,084.421 ↓ 23.9 693 1

Unique (cost=42,253.30..42,253.45 rows=29 width=4) (actual time=12,056.231..12,084.421 rows=693 loops=1)

3. 23.892 12,067.659 ↓ 59.3 1,719 1

Sort (cost=42,253.30..42,253.38 rows=29 width=4) (actual time=12,056.198..12,067.659 rows=1,719 loops=1)

  • Sort Key: action_required_actionrequired.client_id
  • Sort Method: quicksort Memory: 129kB
4. 348.870 12,043.767 ↓ 59.3 1,719 1

Hash Semi Join (cost=39,759.77..42,252.60 rows=29 width=4) (actual time=10,070.947..12,043.767 rows=1,719 loops=1)

  • Hash Cond: (CASE WHEN action_required_actionrequired.is_handed_off THEN action_required_actionrequired.site_team_group_id WHEN (clients_client.created_at < '2020-05-19 18:01:00.462556'::timestamp without time zone) THEN action_required_actionrequired.site_team_group_id ELSE accounts_employeegroup.central_leasing_team_id END = u0.id)
5. 655.548 11,693.903 ↓ 1.1 48,277 1

Hash Join (cost=39,733.06..41,839.06 rows=43,587 width=21) (actual time=10,067.301..11,693.903 rows=48,277 loops=1)

  • Hash Cond: (action_required_actionrequired.client_id = clients_client.id)
6. 646.606 1,000.947 ↓ 1.1 48,277 1

Hash Join (cost=1,095.43..3,087.01 rows=43,587 width=13) (actual time=26.734..1,000.947 rows=48,277 loops=1)

  • Hash Cond: (action_required_actionrequired.site_team_group_id = accounts_employeegroup.id)
7. 327.752 330.175 ↓ 1.1 48,277 1

Bitmap Heap Scan on action_required_actionrequired (cost=931.19..2,808.02 rows=43,587 width=9) (actual time=2.546..330.175 rows=48,277 loops=1)

  • Recheck Cond: (polymorphic_ctype_id = 317)
  • Filter: (NOT action_completed)
  • Heap Blocks: exact=1329
8. 2.423 2.423 ↓ 1.1 48,277 1

Bitmap Index Scan on action_required_actionre_action_completed_polymor_bc9ca40d_idx (cost=0.00..920.29 rows=43,587 width=0) (actual time=2.417..2.423 rows=48,277 loops=1)

  • Index Cond: ((action_completed = false) AND (polymorphic_ctype_id = 317))
9. 11.620 24.166 ↑ 1.0 1,487 1

Hash (cost=145.22..145.22 rows=1,522 width=8) (actual time=24.160..24.166 rows=1,487 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 70kB
10. 12.546 12.546 ↑ 1.0 1,487 1

Seq Scan on accounts_employeegroup (cost=0.00..145.22 rows=1,522 width=8) (actual time=0.018..12.546 rows=1,487 loops=1)

11. 5,072.486 10,037.408 ↓ 1.0 711,720 1

Hash (cost=29,741.17..29,741.17 rows=711,717 width=12) (actual time=10,037.403..10,037.408 rows=711,720 loops=1)

  • Buckets: 1048576 Batches: 1 Memory Usage: 41554kB
12. 4,964.922 4,964.922 ↓ 1.0 711,720 1

Seq Scan on clients_client (cost=0.00..29,741.17 rows=711,717 width=12) (actual time=0.169..4,964.922 rows=711,720 loops=1)

13. 0.201 0.994 ↓ 4.0 8 1

Hash (cost=26.68..26.68 rows=2 width=8) (actual time=0.988..0.994 rows=8 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.337 0.793 ↓ 4.0 8 1

Nested Loop (cost=0.56..26.68 rows=2 width=8) (actual time=0.141..0.793 rows=8 loops=1)

15. 0.224 0.224 ↓ 4.0 8 1

Index Scan using accounts_employeegroup_employees_e8701ad4 on accounts_employeegroup_employees u1 (cost=0.29..10.08 rows=2 width=4) (actual time=0.026..0.224 rows=8 loops=1)

  • Index Cond: (user_id = 30738)
16. 0.232 0.232 ↑ 1.0 1 8

Index Only Scan using accounts_employeegroup_pkey on accounts_employeegroup u0 (cost=0.28..8.29 rows=1 width=4) (actual time=0.029..0.029 rows=1 loops=8)

  • Index Cond: (id = u1.employeegroup_id)
  • Heap Fetches: 8
Planning time : 2.921 ms
Execution time : 12,091.551 ms