explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uovi

Settings
# exclusive inclusive rows x rows loops node
1. 0.341 20.248 ↑ 1,522.7 32 1

HashAggregate (cost=136,552.76..139,476.26 rows=48,725 width=27) (actual time=20.053..20.248 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.726 19.907 ↑ 95.4 511 1

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

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

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

4. 0.013 1.821 ↑ 4.1 23 1

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

  • Group Key: assignment.id
5. 0.157 1.808 ↑ 4.1 23 1

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

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

  • Index Cond: (user_id = 4)
7. 0.027 0.526 ↑ 1.0 231 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 17kB
8. 0.499 0.499 ↑ 1.0 231 1

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

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 3,599
9. 14.881 14.881 ↑ 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.418..0.647 rows=22 loops=23)

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

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

  • Buckets: 4,096 Batches: 1 Memory Usage: 241kB
11. 0.880 0.880 ↓ 1.0 3,830 1

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

Planning time : 1.451 ms
Execution time : 20.930 ms