explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lYKxw

Settings
# exclusive inclusive rows x rows loops node
1. 3.933 96.465 ↑ 10.4 94 1

HashAggregate (cost=3,301.19..3,359.75 rows=976 width=27) (actual time=96.442..96.465 rows=94 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. 11.577 92.532 ↓ 14.0 13,683 1

Nested Loop (cost=886.97..3,286.55 rows=976 width=19) (actual time=3.204..92.532 rows=13,683 loops=1)

3. 0.978 3.855 ↓ 25.9 6,425 1

Nested Loop (cost=886.41..1,106.19 rows=248 width=31) (actual time=1.536..3.855 rows=6,425 loops=1)

4. 0.025 1.027 ↓ 1.0 25 1

HashAggregate (cost=739.27..739.51 rows=24 width=4) (actual time=1.009..1.027 rows=25 loops=1)

  • Group Key: assignment.id
5. 0.050 1.002 ↓ 1.0 25 1

Hash Join (cost=147.56..739.21 rows=24 width=4) (actual time=0.548..1.002 rows=25 loops=1)

  • Hash Cond: (assignment.campaign_id = campaign_2.id)
6. 0.431 0.431 ↓ 1.3 463 1

Index Scan using assignment_user_id_index on assignment (cost=0.42..591.12 rows=362 width=8) (actual time=0.023..0.431 rows=463 loops=1)

  • Index Cond: (user_id = 3290)
7. 0.034 0.521 ↓ 1.0 257 1

Hash (cost=144.04..144.04 rows=248 width=4) (actual time=0.521..0.521 rows=257 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
8. 0.487 0.487 ↓ 1.0 257 1

Seq Scan on campaign campaign_2 (cost=0.00..144.04 rows=248 width=4) (actual time=0.020..0.487 rows=257 loops=1)

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 3530
9. 0.378 1.850 ↓ 1.0 257 25

Materialize (cost=147.14..292.90 rows=248 width=27) (actual time=0.021..0.074 rows=257 loops=25)

10. 0.295 1.472 ↓ 1.0 257 1

Hash Join (cost=147.14..291.66 rows=248 width=27) (actual time=0.522..1.472 rows=257 loops=1)

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

Seq Scan on campaign (cost=0.00..134.63 rows=3,763 width=23) (actual time=0.003..0.701 rows=3,787 loops=1)

12. 0.034 0.476 ↓ 1.0 257 1

Hash (cost=144.04..144.04 rows=248 width=4) (actual time=0.476..0.476 rows=257 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 18kB
13. 0.442 0.442 ↓ 1.0 257 1

Seq Scan on campaign campaign_1 (cost=0.00..144.04 rows=248 width=4) (actual time=0.018..0.442 rows=257 loops=1)

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 3530
14. 77.100 77.100 ↓ 2.0 2 6,425

Index Scan using todos_partial_idx on campaign_contact (cost=0.56..8.58 rows=1 width=35) (actual time=0.003..0.012 rows=2 loops=6,425)

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