explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3Mfz : Optimization for: plan #UHHx

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.016 9,519.922 ↑ 4.0 1 1

Nested Loop (cost=926,991.06..973,792.28 rows=4 width=32) (actual time=9,357.320..9,519.922 rows=1 loops=1)

  • Output: (ec.id)::text
  • Join Filter: (c.email && ARRAY[ecr.email])
  • Rows Removed by Join Filter: 2
  • Buffers: shared hit=3624887 dirtied=1
2. 0.022 0.022 ↑ 1.0 1 1

Index Scan using contacts_pkey on public.contacts c (cost=0.42..2.65 rows=1 width=66) (actual time=0.019..0.022 rows=1 loops=1)

  • Output: c.brand, c.email
  • Index Cond: (c.id = 'adf6fd75-1ead-46bf-acc0-11fa24b165ef'::uuid)
  • Filter: ((c.deleted_at IS NULL) AND (c.brand = 'fca6efa6-2f91-11ea-b7a0-0a653b6fef3e'::uuid))
  • Buffers: shared hit=4
3. 38.173 9,519.884 ↑ 146.0 3 1

Hash Join (cost=926,990.63..973,784.14 rows=438 width=64) (actual time=9,357.293..9,519.884 rows=3 loops=1)

  • Output: ec.id, ec.brand, ecr.email
  • Inner Unique: true
  • Hash Cond: (ecr.campaign = ec.id)
  • Buffers: shared hit=3624883 dirtied=1
4. 424.976 9,481.669 ↑ 4.0 520,580 1

HashAggregate (cost=926,965.68..947,645.74 rows=2,068,006 width=84) (actual time=9,343.927..9,481.669 rows=520,580 loops=1)

  • Output: ecr.campaign, ecr.email, c_1.id, (NULL::uuid), ecr.send_type
  • Group Key: ecr.campaign, ecr.email, c_1.id, (NULL::uuid), ecr.send_type
  • Buffers: shared hit=3624857 dirtied=1
5. 55.253 9,056.693 ↑ 3.7 566,234 1

Append (cost=1,145.30..901,115.60 rows=2,068,006 width=84) (actual time=2.601..9,056.693 rows=566,234 loops=1)

  • Buffers: shared hit=3624857 dirtied=1
6. 84.467 4,978.060 ↑ 242.9 7,291 1

Nested Loop (cost=1,145.30..626,595.41 rows=1,770,689 width=76) (actual time=2.600..4,978.060 rows=7,291 loops=1)

  • Output: ecr.campaign, ecr.email, c_1.id, NULL::uuid, ecr.send_type
  • Buffers: shared hit=844990
7. 25.583 64.268 ↓ 1.8 84,725 1

Hash Join (cost=1,144.31..5,960.93 rows=46,023 width=60) (actual time=2.433..64.268 rows=84,725 loops=1)

  • Output: ec_1.brand, ecr.campaign, ecr.email, ecr.send_type
  • Inner Unique: true
  • Hash Cond: (ecr.campaign = ec_1.id)
  • Buffers: shared hit=3487
8. 36.274 36.274 ↓ 1.8 84,725 1

Seq Scan on public.email_campaigns_recipients ecr (cost=0.00..4,695.70 rows=46,023 width=44) (actual time=0.009..36.274 rows=84,725 loops=1)

  • Output: ecr.id, ecr.created_at, ecr.updated_at, ecr.deleted_at, ecr.campaign, ecr.tag, ecr.list, ecr.contact, ecr.email, ecr.send_type, ecr.recipient_type, ecr.brand, ecr.agent
  • Filter: ((ecr.email IS NOT NULL) AND (ecr.contact IS NULL) AND (ecr.deleted_at IS NULL) AND (ecr.recipient_type = 'Email'::email_campaign_recipient_type))
  • Rows Removed by Filter: 95405
  • Buffers: shared hit=2449
9. 0.726 2.411 ↓ 1.0 4,743 1

Hash (cost=1,085.25..1,085.25 rows=4,725 width=32) (actual time=2.411..2.411 rows=4,743 loops=1)

  • Output: ec_1.id, ec_1.brand
  • Buckets: 8192 Batches: 1 Memory Usage: 361kB
  • Buffers: shared hit=1038
10. 1.685 1.685 ↓ 1.0 4,743 1

Seq Scan on public.email_campaigns ec_1 (cost=0.00..1,085.25 rows=4,725 width=32) (actual time=0.004..1.685 rows=4,743 loops=1)

  • Output: ec_1.id, ec_1.brand
  • Buffers: shared hit=1038
11. 84.725 4,829.325 ↓ 0.0 0 84,725

Bitmap Heap Scan on public.contacts c_1 (cost=0.99..13.38 rows=11 width=82) (actual time=0.057..0.057 rows=0 loops=84,725)

  • Output: c_1.id, c_1.email, c_1.brand
  • Recheck Cond: ((c_1.brand = ec_1.brand) AND (c_1.email && ARRAY[ecr.email]))
  • Filter: ((c_1.deleted_at IS NULL) AND (c_1.id IS NOT NULL))
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=7959
  • Buffers: shared hit=841503
12. 4,744.600 4,744.600 ↓ 0.0 0 84,725

Bitmap Index Scan on contacts_brand_email_idx (cost=0.00..0.99 rows=20 width=0) (actual time=0.056..0.056 rows=0 loops=84,725)

  • Index Cond: ((c_1.brand = ec_1.brand) AND (c_1.email && ARRAY[ecr.email]))
  • Buffers: shared hit=833544
13. 14.443 185.099 ↓ 26,510.0 26,510 1

Nested Loop (cost=1,294.86..9,975.01 rows=1 width=84) (actual time=9.983..185.099 rows=26,510 loops=1)

  • Output: email_campaigns.id, contacts.email[1], contacts.id, NULL::uuid, email_campaigns_recipients.send_type
  • Inner Unique: true
  • Join Filter: (email_campaigns.brand = contacts.brand)
  • Buffers: shared hit=244814
14. 12.620 117.636 ↓ 981.9 26,510 1

Merge Join (cost=1,294.43..9,951.20 rows=27 width=52) (actual time=9.968..117.636 rows=26,510 loops=1)

  • Output: email_campaigns.id, email_campaigns.brand, email_campaigns_recipients.send_type, crm_lists_members.contact
  • Merge Cond: (email_campaigns_recipients.list = crm_lists_members.list)
  • Buffers: shared hit=138666
15. 0.058 30.561 ↑ 1.6 72 1

Nested Loop (cost=0.70..6,669.66 rows=114 width=52) (actual time=0.020..30.561 rows=72 loops=1)

  • Output: email_campaigns.id, email_campaigns.brand, email_campaigns_recipients.send_type, email_campaigns_recipients.list
  • Inner Unique: true
  • Buffers: shared hit=4537
16. 30.287 30.287 ↑ 1.6 72 1

Index Scan using email_campaigns_recipients_list_idx on public.email_campaigns_recipients (cost=0.42..6,451.76 rows=114 width=36) (actual time=0.010..30.287 rows=72 loops=1)

  • Output: email_campaigns_recipients.id, email_campaigns_recipients.created_at, email_campaigns_recipients.updated_at, email_campaigns_recipients.deleted_at, email_campaigns_recipients.campaign, email_campaigns_recipients.tag, email_campaigns_recipients.list, email_campaigns_recipients.contact, email_campaigns_recipients.email, email_campaigns_recipients.send_type, email_campaigns_recipients.recipient_type, email_campaigns_recipients.brand, email_campaigns_recipients.agent
  • Filter: (email_campaigns_recipients.recipient_type = 'List'::email_campaign_recipient_type)
  • Rows Removed by Filter: 180058
  • Buffers: shared hit=4321
17. 0.216 0.216 ↑ 1.0 1 72

Index Scan using email_campaigns_pkey on public.email_campaigns (cost=0.28..1.91 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=72)

  • Output: email_campaigns.id, email_campaigns.created_at, email_campaigns.updated_at, email_campaigns.deleted_at, email_campaigns.created_by, email_campaigns.brand, email_campaigns.subject, email_campaigns.include_signature, email_campaigns.html, email_campaigns.due_at, email_campaigns.executed_at, email_campaigns."from", email_campaigns.individual, email_campaigns.accepted, email_campaigns.rejected, email_campaigns.delivered, email_campaigns.failed, email_campaigns.opened, email_campaigns.clicked, email_campaigns.unsubscribed, email_campaigns.complained, email_campaigns.stored, email_campaigns.template, email_campaigns.deal, email_campaigns.text, email_campaigns.headers, email_campaigns.google_credential, email_campaigns.microsoft_credential, email_campaigns.thread_key
  • Index Cond: (email_campaigns.id = email_campaigns_recipients.campaign)
  • Buffers: shared hit=216
18. 74.455 74.455 ↓ 1.0 158,549 1

Index Scan using contact_lists_members_pkey on public.crm_lists_members (cost=0.42..9,508.06 rows=153,466 width=32) (actual time=0.008..74.455 rows=158,549 loops=1)

  • Output: crm_lists_members.list, crm_lists_members.contact, crm_lists_members.is_manual, crm_lists_members.created_at, crm_lists_members.deleted_at
  • Filter: (crm_lists_members.deleted_at IS NULL)
  • Rows Removed by Filter: 122107
  • Buffers: shared hit=134129
19. 53.020 53.020 ↑ 1.0 1 26,510

Index Scan using contacts_pkey on public.contacts (cost=0.42..0.87 rows=1 width=82) (actual time=0.002..0.002 rows=1 loops=26,510)

  • Output: contacts.email, contacts.id, contacts.brand
  • Index Cond: ((contacts.id = crm_lists_members.contact) AND (contacts.id IS NOT NULL))
  • Filter: (contacts.deleted_at IS NULL)
  • Buffers: shared hit=106148
20. 426.274 1,419.870 ↓ 30.4 283,875 1

Nested Loop (cost=0.70..27,702.94 rows=9,330 width=84) (actual time=0.052..1,419.870 rows=283,875 loops=1)

  • Output: email_campaigns_1.id, contacts_1.email[1], contacts_1.id, NULL::uuid, email_campaigns_recipients_1.send_type
  • Join Filter: (ARRAY[email_campaigns_recipients_1.tag] <@ contacts_1.tag)
  • Rows Removed by Join Filter: 1115192
  • Buffers: shared hit=608594 dirtied=1
21. 0.580 20.246 ↓ 1.1 515 1

Nested Loop (cost=0.28..5,339.50 rows=485 width=47) (actual time=0.024..20.246 rows=515 loops=1)

  • Output: email_campaigns_1.id, email_campaigns_1.brand, email_campaigns_recipients_1.send_type, email_campaigns_recipients_1.tag
  • Inner Unique: true
  • Buffers: shared hit=3994
22. 18.121 18.121 ↓ 1.1 515 1

Seq Scan on public.email_campaigns_recipients email_campaigns_recipients_1 (cost=0.00..4,695.70 rows=485 width=31) (actual time=0.010..18.121 rows=515 loops=1)

  • Output: email_campaigns_recipients_1.id, email_campaigns_recipients_1.created_at, email_campaigns_recipients_1.updated_at, email_campaigns_recipients_1.deleted_at, email_campaigns_recipients_1.campaign, email_campaigns_recipients_1.tag, email_campaigns_recipients_1.list, email_campaigns_recipients_1.contact, email_campaigns_recipients_1.email, email_campaigns_recipients_1.send_type, email_campaigns_recipients_1.recipient_type, email_campaigns_recipients_1.brand, email_campaigns_recipients_1.agent
  • Filter: (email_campaigns_recipients_1.recipient_type = 'Tag'::email_campaign_recipient_type)
  • Rows Removed by Filter: 179615
  • Buffers: shared hit=2449
23. 1.545 1.545 ↑ 1.0 1 515

Index Scan using email_campaigns_pkey on public.email_campaigns email_campaigns_1 (cost=0.28..1.33 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=515)

  • Output: email_campaigns_1.id, email_campaigns_1.created_at, email_campaigns_1.updated_at, email_campaigns_1.deleted_at, email_campaigns_1.created_by, email_campaigns_1.brand, email_campaigns_1.subject, email_campaigns_1.include_signature, email_campaigns_1.html, email_campaigns_1.due_at, email_campaigns_1.executed_at, email_campaigns_1."from", email_campaigns_1.individual, email_campaigns_1.accepted, email_campaigns_1.rejected, email_campaigns_1.delivered, email_campaigns_1.failed, email_campaigns_1.opened, email_campaigns_1.clicked, email_campaigns_1.unsubscribed, email_campaigns_1.complained, email_campaigns_1.stored, email_campaigns_1.template, email_campaigns_1.deal, email_campaigns_1.text, email_campaigns_1.headers, email_campaigns_1.google_credential, email_campaigns_1.microsoft_credential, email_campaigns_1.thread_key
  • Index Cond: (email_campaigns_1.id = email_campaigns_recipients_1.campaign)
  • Buffers: shared hit=1545
24. 973.350 973.350 ↓ 2.5 2,717 515

Index Scan using contacts_brand_idx on public.contacts contacts_1 (cost=0.42..32.76 rows=1,068 width=118) (actual time=0.006..1.890 rows=2,717 loops=515)

  • Output: contacts_1.email, contacts_1.id, contacts_1.tag, contacts_1.brand
  • Index Cond: (contacts_1.brand = email_campaigns_1.brand)
  • Filter: (contacts_1.id IS NOT NULL)
  • Buffers: shared hit=604600 dirtied=1
25. 1.277 364.024 ↓ 9.5 3,546 1

Hash Join (cost=72,636.50..77,834.29 rows=373 width=76) (actual time=335.151..364.024 rows=3,546 loops=1)

  • Output: email_campaigns_2.id, email_campaigns_recipients_2.email, contacts_2.id, NULL::uuid, email_campaigns_recipients_2.send_type
  • Inner Unique: true
  • Hash Cond: ((email_campaigns_recipients_2.campaign = email_campaigns_2.id) AND (contacts_2.brand = email_campaigns_2.brand))
  • Buffers: shared hit=59068
26. 7.979 360.350 ↑ 10.5 4,698 1

Hash Join (cost=71,480.38..76,418.52 rows=49,456 width=76) (actual time=332.736..360.350 rows=4,698 loops=1)

  • Output: email_campaigns_recipients_2.email, email_campaigns_recipients_2.send_type, email_campaigns_recipients_2.campaign, contacts_2.id, contacts_2.brand
  • Inner Unique: true
  • Hash Cond: (email_campaigns_recipients_2.contact = contacts_2.id)
  • Buffers: shared hit=58030
27. 21.619 21.619 ↑ 1.0 90,338 1

Seq Scan on public.email_campaigns_recipients email_campaigns_recipients_2 (cost=0.00..4,695.70 rows=92,360 width=60) (actual time=0.007..21.619 rows=90,338 loops=1)

  • Output: email_campaigns_recipients_2.id, email_campaigns_recipients_2.created_at, email_campaigns_recipients_2.updated_at, email_campaigns_recipients_2.deleted_at, email_campaigns_recipients_2.campaign, email_campaigns_recipients_2.tag, email_campaigns_recipients_2.list, email_campaigns_recipients_2.contact, email_campaigns_recipients_2.email, email_campaigns_recipients_2.send_type, email_campaigns_recipients_2.recipient_type, email_campaigns_recipients_2.brand, email_campaigns_recipients_2.agent
  • Filter: (email_campaigns_recipients_2.recipient_type = 'Email'::email_campaign_recipient_type)
  • Rows Removed by Filter: 89792
  • Buffers: shared hit=2449
28. 114.349 330.752 ↑ 1.0 509,062 1

Hash (cost=65,104.99..65,104.99 rows=510,031 width=32) (actual time=330.752..330.752 rows=509,062 loops=1)

  • Output: contacts_2.id, contacts_2.brand
  • Buckets: 524288 Batches: 1 Memory Usage: 35319kB
  • Buffers: shared hit=55581
29. 216.403 216.403 ↑ 1.0 509,062 1

Seq Scan on public.contacts contacts_2 (cost=0.00..65,104.99 rows=510,031 width=32) (actual time=0.006..216.403 rows=509,062 loops=1)

  • Output: contacts_2.id, contacts_2.brand
  • Filter: ((contacts_2.deleted_at IS NULL) AND (contacts_2.id IS NOT NULL))
  • Rows Removed by Filter: 441984
  • Buffers: shared hit=55581
30. 0.772 2.397 ↓ 1.0 4,743 1

Hash (cost=1,085.25..1,085.25 rows=4,725 width=32) (actual time=2.397..2.397 rows=4,743 loops=1)

  • Output: email_campaigns_2.id, email_campaigns_2.brand
  • Buckets: 8192 Batches: 1 Memory Usage: 361kB
  • Buffers: shared hit=1038
31. 1.625 1.625 ↓ 1.0 4,743 1

Seq Scan on public.email_campaigns email_campaigns_2 (cost=0.00..1,085.25 rows=4,725 width=32) (actual time=0.007..1.625 rows=4,743 loops=1)

  • Output: email_campaigns_2.id, email_campaigns_2.brand
  • Buffers: shared hit=1038
32. 36.834 250.247 ↑ 1.2 216,846 1

Nested Loop (cost=0.70..13,525.08 rows=261,623 width=84) (actual time=0.053..250.247 rows=216,846 loops=1)

  • Output: email_campaigns_3.id, contacts_3.email[1], contacts_3.id, NULL::uuid, email_campaigns_recipients_3.send_type
  • Buffers: shared hit=115567
33. 0.194 18.581 ↑ 1.2 164 1

Nested Loop (cost=0.28..5,026.40 rows=204 width=36) (actual time=0.018..18.581 rows=164 loops=1)

  • Output: email_campaigns_3.id, email_campaigns_3.brand, email_campaigns_recipients_3.send_type
  • Inner Unique: true
  • Buffers: shared hit=2941
34. 17.895 17.895 ↑ 1.2 164 1

Seq Scan on public.email_campaigns_recipients email_campaigns_recipients_3 (cost=0.00..4,695.70 rows=204 width=20) (actual time=0.007..17.895 rows=164 loops=1)

  • Output: email_campaigns_recipients_3.id, email_campaigns_recipients_3.created_at, email_campaigns_recipients_3.updated_at, email_campaigns_recipients_3.deleted_at, email_campaigns_recipients_3.campaign, email_campaigns_recipients_3.tag, email_campaigns_recipients_3.list, email_campaigns_recipients_3.contact, email_campaigns_recipients_3.email, email_campaigns_recipients_3.send_type, email_campaigns_recipients_3.recipient_type, email_campaigns_recipients_3.brand, email_campaigns_recipients_3.agent
  • Filter: (email_campaigns_recipients_3.recipient_type = 'AllContacts'::email_campaign_recipient_type)
  • Rows Removed by Filter: 179966
  • Buffers: shared hit=2449
35. 0.492 0.492 ↑ 1.0 1 164

Index Scan using email_campaigns_pkey on public.email_campaigns email_campaigns_3 (cost=0.28..1.62 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=164)

  • Output: email_campaigns_3.id, email_campaigns_3.created_at, email_campaigns_3.updated_at, email_campaigns_3.deleted_at, email_campaigns_3.created_by, email_campaigns_3.brand, email_campaigns_3.subject, email_campaigns_3.include_signature, email_campaigns_3.html, email_campaigns_3.due_at, email_campaigns_3.executed_at, email_campaigns_3."from", email_campaigns_3.individual, email_campaigns_3.accepted, email_campaigns_3.rejected, email_campaigns_3.delivered, email_campaigns_3.failed, email_campaigns_3.opened, email_campaigns_3.clicked, email_campaigns_3.unsubscribed, email_campaigns_3.complained, email_campaigns_3.stored, email_campaigns_3.template, email_campaigns_3.deal, email_campaigns_3.text, email_campaigns_3.headers, email_campaigns_3.google_credential, email_campaigns_3.microsoft_credential, email_campaigns_3.thread_key
  • Index Cond: (email_campaigns_3.id = email_campaigns_recipients_3.campaign)
  • Buffers: shared hit=492
36. 194.832 194.832 ↓ 3.7 1,322 164

Index Scan using contacts_brand_idx on public.contacts contacts_3 (cost=0.42..38.10 rows=356 width=82) (actual time=0.025..1.188 rows=1,322 loops=164)

  • Output: contacts_3.email, contacts_3.id, contacts_3.brand
  • Index Cond: (contacts_3.brand = email_campaigns_3.brand)
  • Filter: ((contacts_3.id IS NOT NULL) AND (length(contacts_3.email[1]) > 0))
  • Rows Removed by Filter: 387
  • Buffers: shared hit=112626
37. 49.030 1,804.139 ↓ 1.1 28,166 1

Hash Join (cost=75,066.38..114,462.79 rows=25,989 width=81) (actual time=205.821..1,804.139 rows=28,166 loops=1)

  • Output: ec_2.id, u.email, c_2.id, NULL::uuid, ecr_1.send_type
  • Hash Cond: ((ba."user" = u.id) AND (ec_2.brand = c_2.brand))
  • Buffers: shared hit=1751824
38. 25.308 1,558.078 ↑ 1.6 208,146 1

Nested Loop (cost=0.53..12,005.45 rows=341,000 width=52) (actual time=8.701..1,558.078 rows=208,146 loops=1)

  • Output: ec_2.id, ec_2.brand, ecr_1.send_type, ba."user
  • Buffers: shared hit=1519139
39. 0.250 21.038 ↑ 1.2 284 1

Nested Loop (cost=0.28..5,185.20 rows=341 width=52) (actual time=0.022..21.038 rows=284 loops=1)

  • Output: ec_2.id, ec_2.brand, ecr_1.send_type, ecr_1.brand
  • Inner Unique: true
  • Buffers: shared hit=3301
40. 19.652 19.652 ↑ 1.2 284 1

Seq Scan on public.email_campaigns_recipients ecr_1 (cost=0.00..4,695.70 rows=341 width=36) (actual time=0.009..19.652 rows=284 loops=1)

  • Output: ecr_1.id, ecr_1.created_at, ecr_1.updated_at, ecr_1.deleted_at, ecr_1.campaign, ecr_1.tag, ecr_1.list, ecr_1.contact, ecr_1.email, ecr_1.send_type, ecr_1.recipient_type, ecr_1.brand, ecr_1.agent
  • Filter: ((ecr_1.deleted_at IS NULL) AND (ecr_1.recipient_type = 'Brand'::email_campaign_recipient_type))
  • Rows Removed by Filter: 179846
  • Buffers: shared hit=2449
41. 1.136 1.136 ↑ 1.0 1 284

Index Scan using email_campaigns_pkey on public.email_campaigns ec_2 (cost=0.28..1.44 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=284)

  • Output: ec_2.id, ec_2.created_at, ec_2.updated_at, ec_2.deleted_at, ec_2.created_by, ec_2.brand, ec_2.subject, ec_2.include_signature, ec_2.html, ec_2.due_at, ec_2.executed_at, ec_2."from", ec_2.individual, ec_2.accepted, ec_2.rejected, ec_2.delivered, ec_2.failed, ec_2.opened, ec_2.clicked, ec_2.unsubscribed, ec_2.complained, ec_2.stored, ec_2.template, ec_2.deal, ec_2.text, ec_2.headers, ec_2.google_credential, ec_2.microsoft_credential, ec_2.thread_key
  • Index Cond: (ec_2.id = ecr_1.campaign)
  • Buffers: shared hit=852
42. 1,511.732 1,511.732 ↑ 1.4 733 284

Function Scan on public.get_brand_agents ba (cost=0.25..10.25 rows=1,000 width=16) (actual time=5.281..5.323 rows=733 loops=284)

  • Output: ba."user", ba.agent, ba.mui, ba.mls, ba.brand_user, ba.brand_role, ba.brand, ba.enabled
  • Function Call: get_brand_agents(ecr_1.brand)
  • Buffers: shared hit=1515838
43. 11.805 197.031 ↑ 1.2 25,862 1

Hash (cost=74,604.24..74,604.24 rows=30,774 width=93) (actual time=197.031..197.031 rows=25,862 loops=1)

  • Output: u.email, u.id, cu."user", c_2.id, c_2.brand
  • Buckets: 32768 Batches: 1 Memory Usage: 3336kB
  • Buffers: shared hit=232685
44. 10.093 185.226 ↓ 1.3 38,572 1

Hash Join (cost=2,246.18..74,604.24 rows=30,774 width=93) (actual time=3.746..185.226 rows=38,572 loops=1)

  • Output: u.email, u.id, cu."user", c_2.id, c_2.brand
  • Inner Unique: true
  • Hash Cond: (cu."user" = u.id)
  • Buffers: shared hit=232685
45. 0.000 171.419 ↓ 1.3 38,572 1

Nested Loop (cost=0.42..72,277.66 rows=30,774 width=48) (actual time=0.023..171.419 rows=38,572 loops=1)

  • Output: cu."user", c_2.id, c_2.brand
  • Inner Unique: true
  • Buffers: shared hit=230599
46. 4.496 4.496 ↑ 1.0 57,471 1

Seq Scan on public.contacts_users cu (cost=0.00..998.72 rows=57,472 width=32) (actual time=0.006..4.496 rows=57,471 loops=1)

  • Output: cu.contact, cu."user
  • Buffers: shared hit=424
47. 172.413 172.413 ↑ 1.0 1 57,471

Index Scan using contacts_pkey on public.contacts c_2 (cost=0.42..1.24 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=57,471)

  • Output: c_2.id, c_2.brand
  • Index Cond: ((c_2.id = cu.contact) AND (c_2.id IS NOT NULL))
  • Filter: (c_2.deleted_at IS NULL)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=230175
48. 1.190 3.714 ↑ 1.0 7,100 1

Hash (cost=2,157.00..2,157.00 rows=7,100 width=45) (actual time=3.714..3.714 rows=7,100 loops=1)

  • Output: u.email, u.id
  • Buckets: 8192 Batches: 1 Memory Usage: 601kB
  • Buffers: shared hit=2086
49. 2.524 2.524 ↑ 1.0 7,100 1

Seq Scan on public.users u (cost=0.00..2,157.00 rows=7,100 width=45) (actual time=0.003..2.524 rows=7,100 loops=1)

  • Output: u.email, u.id
  • Buffers: shared hit=2086
50. 0.001 0.001 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=75) (actual time=0.001..0.001 rows=0 loops=1)

  • Output: id, email, NULL::uuid, agent, send_type
  • One-Time Filter: false
51. 0.003 0.042 ↓ 3.0 3 1

Hash (cost=24.94..24.94 rows=1 width=32) (actual time=0.042..0.042 rows=3 loops=1)

  • Output: ec.id, ec.brand
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=26
52. 0.039 0.039 ↓ 3.0 3 1

Index Scan using email_campaigns_brand_idx on public.email_campaigns ec (cost=0.28..24.94 rows=1 width=32) (actual time=0.014..0.039 rows=3 loops=1)

  • Output: ec.id, ec.brand
  • Index Cond: (ec.brand = 'fca6efa6-2f91-11ea-b7a0-0a653b6fef3e'::uuid)
  • Filter: ((ec.deleted_at IS NULL) AND (ec.executed_at IS NULL) AND (ec.due_at IS NOT NULL) AND (ec.due_at >= '2020-01-07 20:29:59.79+00'::timestamp with time zone) AND (ec.due_at <= '2020-03-31 23:59:59.999+00'::timestamp with time zone))
  • Rows Removed by Filter: 21
  • Buffers: shared hit=26
Planning time : 4.708 ms
Execution time : 9,577.196 ms