explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9rH2

Settings
# exclusive inclusive rows x rows loops node
1. 0.279 184.255 ↑ 151.4 37 1

HashAggregate (cost=5,962.45..6,298.45 rows=5,600 width=27) (actual time=184.220..184.255 rows=37 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. 5.526 183.976 ↑ 7.8 722 1

Nested Loop (cost=2,766.06..5,878.45 rows=5,600 width=19) (actual time=6.850..183.976 rows=722 loops=1)

3. 1.053 5.030 ↓ 28.7 7,540 1

Nested Loop (cost=2,765.49..3,339.65 rows=263 width=31) (actual time=2.631..5.030 rows=7,540 loops=1)

4. 0.028 2.063 ↑ 4.5 29 1

HashAggregate (cost=2,617.87..2,619.17 rows=130 width=4) (actual time=2.042..2.063 rows=29 loops=1)

  • Group Key: assignment.id
5. 0.159 2.035 ↑ 4.5 29 1

Hash Join (cost=148.05..2,617.54 rows=130 width=4) (actual time=0.618..2.035 rows=29 loops=1)

  • Hash Cond: (assignment.campaign_id = campaign_2.id)
6. 1.305 1.305 ↑ 1.2 1,598 1

Index Scan using assignment_user_id_index on assignment (cost=0.42..2,465.00 rows=1,872 width=8) (actual time=0.039..1.305 rows=1,598 loops=1)

  • Index Cond: (user_id = 4)
7. 0.029 0.571 ↑ 1.0 260 1

Hash (cost=144.34..144.34 rows=263 width=4) (actual time=0.571..0.571 rows=260 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
8. 0.542 0.542 ↑ 1.0 260 1

Seq Scan on campaign campaign_2 (cost=0.00..144.34 rows=263 width=4) (actual time=0.063..0.542 rows=260 loops=1)

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 3533
9. 0.417 1.914 ↑ 1.0 260 29

Materialize (cost=147.62..293.76 rows=263 width=27) (actual time=0.020..0.066 rows=260 loops=29)

10. 0.293 1.497 ↑ 1.0 260 1

Hash Join (cost=147.62..292.45 rows=263 width=27) (actual time=0.585..1.497 rows=260 loops=1)

  • Hash Cond: (campaign.id = campaign_1.id)
11. 0.716 0.716 ↓ 1.0 3,793 1

Seq Scan on campaign (cost=0.00..134.87 rows=3,787 width=23) (actual time=0.002..0.716 rows=3,793 loops=1)

12. 0.030 0.488 ↑ 1.0 260 1

Hash (cost=144.34..144.34 rows=263 width=4) (actual time=0.488..0.488 rows=260 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
13. 0.458 0.458 ↑ 1.0 260 1

Seq Scan on campaign campaign_1 (cost=0.00..144.34 rows=263 width=4) (actual time=0.047..0.458 rows=260 loops=1)

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 3533
14. 173.420 173.420 ↓ 0.0 0 7,540

Index Scan using todos_partial_idx on campaign_contact (cost=0.56..8.58 rows=1 width=35) (actual time=0.018..0.023 rows=0 loops=7,540)

  • Index Cond: ((campaign_id = campaign.id) AND (assignment_id = assignment.id))
Planning time : 4.367 ms
Execution time : 184.469 ms