explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SkYu

Settings
# exclusive inclusive rows x rows loops node
1. 8.790 2,517.999 ↑ 48.2 17 1

HashAggregate (cost=1,103.05..1,152.19 rows=819 width=27) (actual time=2,517.987..2,517.999 rows=17 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. 27.671 2,509.209 ↓ 25.1 20,544 1

Hash Join (cost=29.85..1,090.76 rows=819 width=19) (actual time=4.553..2,509.209 rows=20,544 loops=1)

  • Hash Cond: (campaign_contact.campaign_id = campaign.id)
3. 6.707 2,481.434 ↓ 25.1 20,544 1

Nested Loop (cost=20.17..1,037.94 rows=819 width=35) (actual time=4.356..2,481.434 rows=20,544 loops=1)

4. 0.017 3.397 ↓ 10.0 10 1

HashAggregate (cost=19.75..19.76 rows=1 width=4) (actual time=3.383..3.397 rows=10 loops=1)

  • Group Key: assignment.id
5. 0.056 3.380 ↓ 10.0 10 1

Hash Join (cost=11.92..19.74 rows=1 width=4) (actual time=3.348..3.380 rows=10 loops=1)

  • Hash Cond: (campaign_1.id = assignment.campaign_id)
6. 0.040 0.040 ↓ 1.1 65 1

Seq Scan on campaign campaign_1 (cost=0.00..7.60 rows=57 width=4) (actual time=0.012..0.040 rows=65 loops=1)

  • Filter: (is_started AND (NOT is_archived) AND (organization_id = 1))
  • Rows Removed by Filter: 152
7. 0.009 3.284 ↓ 3.0 12 1

Hash (cost=11.87..11.87 rows=4 width=8) (actual time=3.282..3.284 rows=12 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
8. 2.442 3.275 ↓ 3.0 12 1

Bitmap Heap Scan on assignment (cost=4.31..11.87 rows=4 width=8) (actual time=1.631..3.275 rows=12 loops=1)

  • Recheck Cond: (user_id = 815)
  • Heap Blocks: exact=4
9. 0.833 0.833 ↓ 3.0 12 1

Bitmap Index Scan on assignment_user_id_index (cost=0.00..4.31 rows=4 width=0) (actual time=0.832..0.833 rows=12 loops=1)

  • Index Cond: (user_id = 815)
10. 2,471.330 2,471.330 ↓ 2.5 2,054 10

Index Scan using campaign_contact_partial_assignment_id_index on campaign_contact (cost=0.42..1,009.99 rows=819 width=35) (actual time=0.482..247.133 rows=2,054 loops=10)

  • Index Cond: (assignment_id = assignment.id)
11. 0.038 0.104 ↓ 1.0 217 1

Hash (cost=7.08..7.08 rows=208 width=23) (actual time=0.103..0.104 rows=217 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
12. 0.066 0.066 ↓ 1.0 217 1

Seq Scan on campaign (cost=0.00..7.08 rows=208 width=23) (actual time=0.011..0.066 rows=217 loops=1)

Planning time : 2.334 ms
Execution time : 2,518.127 ms