explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DkRV

Settings
# exclusive inclusive rows x rows loops node
1. 0.305 17.168 ↑ 1,522.7 32 1

HashAggregate (cost=332,544.48..335,467.98 rows=48,725 width=27) (actual time=17.012..17.168 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. 0.525 16.863 ↑ 95.4 511 1

Hash Join (cost=2,429.44..331,813.60 rows=48,725 width=19) (actual time=3.916..16.863 rows=511 loops=1)

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

Nested Loop (cost=2,246.29..329,066.15 rows=48,725 width=35) (actual time=2.528..14.967 rows=511 loops=1)

4. 0.013 1.737 ↑ 4.1 23 1

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

  • Group Key: assignment.id
5. 0.169 1.724 ↑ 4.1 23 1

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

  • Hash Cond: (assignment.campaign_id = campaign_1.id)
6. 1.066 1.066 ↓ 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.033..1.066 rows=1,604 loops=1)

  • Index Cond: (user_id = 4)
7. 0.024 0.489 ↑ 1.0 231 1

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

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

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

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

Index Scan using campaign_contact_assignment_id_index on campaign_contact (cost=0.57..3,435.08 rows=513 width=35) (actual time=0.482..0.572 rows=22 loops=23)

  • Index Cond: (assignment_id = assignment.id)
  • Filter: (NOT archived)
10. 0.517 1.371 ↓ 1.0 3,830 1

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

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

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

Planning time : 0.760 ms
Execution time : 17.945 ms