explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5nIq

Settings
# exclusive inclusive rows x rows loops node
1. 0.290 6.511 ↑ 1,522.7 32 1

HashAggregate (cost=136,552.76..139,476.26 rows=48,725 width=27) (actual time=6.364..6.511 rows=32 loops=1)

  • Group Key: campaign_contact.assignment_id, campaign_contact.campaign_id, campaign_contact.message_status, campaign_contact.is_opted_out, COALESCE(((((campaign_contact.timezone)::text IS NULL) AND (date_part('hour'::text, timezone(campaign.timezone, CURRENT_TIMESTAMP)) < (campaign.texting_hours_end)::double precision) AND (date_part('hour'::text, timezone(campaign.timezone, CURRENT_TIMESTAMP)) > (campaign.texting_hours_start)::double precision)) OR ((date_part('hour'::text, timezone((campaign_contact.timezone)::text, CURRENT_TIMESTAMP)) >= (campaign.texting_hours_start)::double precision) AND (date_part('hour'::text, timezone((campaign_contact.timezone)::text, CURRENT_TIMESTAMP)) < (campaign.texting_hours_end)::double precision))), false)
2. 1.796 6.221 ↑ 95.4 511 1

Hash Join (cost=2,429.44..135,821.89 rows=48,725 width=19) (actual time=3.850..6.221 rows=511 loops=1)

  • Hash Cond: (campaign_contact.campaign_id = campaign.id)
3. 0.070 2.820 ↑ 95.4 511 1

Nested Loop (cost=2,246.28..133,074.44 rows=48,725 width=35) (actual time=2.009..2.820 rows=511 loops=1)

4. 0.013 1.991 ↑ 4.1 23 1

HashAggregate (cost=2,245.72..2,246.67 rows=95 width=4) (actual time=1.986..1.991 rows=23 loops=1)

  • Group Key: assignment.id
5. 0.164 1.978 ↑ 4.1 23 1

Hash Join (cost=148.26..2,245.48 rows=95 width=4) (actual time=0.610..1.978 rows=23 loops=1)

  • Hash Cond: (assignment.campaign_id = campaign_1.id)
6. 1.253 1.253 ↓ 1.1 1,604 1

Index Scan using assignment_user_id_index on assignment (cost=0.42..2,093.65 rows=1,521 width=8) (actual time=0.043..1.253 rows=1,604 loops=1)

  • Index Cond: (user_id = 4)
7. 0.028 0.561 ↑ 1.0 231 1

Hash (cost=144.86..144.86 rows=238 width=4) (actual time=0.561..0.561 rows=231 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 17kB
8. 0.533 0.533 ↑ 1.0 231 1

Seq Scan on campaign campaign_1 (cost=0.00..144.86 rows=238 width=4) (actual time=0.068..0.533 rows=231 loops=1)

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 3599
9. 0.759 0.759 ↑ 23.3 22 23

Index Scan using new_todos_partial_idx on campaign_contact (cost=0.56..1,372.00 rows=513 width=35) (actual time=0.008..0.033 rows=22 loops=23)

  • Index Cond: (assignment_id = assignment.id)
10. 0.627 1.605 ↓ 1.0 3,830 1

Hash (cost=135.29..135.29 rows=3,829 width=23) (actual time=1.605..1.605 rows=3,830 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 241kB
11. 0.978 0.978 ↓ 1.0 3,830 1

Seq Scan on campaign (cost=0.00..135.29 rows=3,829 width=23) (actual time=0.010..0.978 rows=3,830 loops=1)

Planning time : 0.942 ms
Execution time : 7.396 ms