explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UHHx

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.014 79,170.256 ↑ 4.0 1 1

Nested Loop (cost=928,303.63..975,577.13 rows=4 width=32) (actual time=78,996.075..79,170.256 rows=1 loops=1)

  • Output: (ec.id)::text
  • Join Filter: (c.email && ARRAY[ecr.email])
  • Rows Removed by Join Filter: 2
  • Buffers: shared hit=7187134 dirtied=2
2. 0.023 0.023 ↑ 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.023 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. 42.050 79,170.219 ↑ 147.3 3 1

Hash Join (cost=928,303.21..975,568.94 rows=442 width=64) (actual time=78,996.049..79,170.219 rows=3 loops=1)

  • Output: ec.id, ec.brand, ecr.email
  • Inner Unique: true
  • Hash Cond: (ecr.campaign = ec.id)
  • Buffers: shared hit=7187130 dirtied=2
4. 431.669 79,128.127 ↑ 4.0 520,638 1

HashAggregate (cost=928,278.25..949,167.01 rows=2,088,876 width=84) (actual time=78,981.507..79,128.127 rows=520,638 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=7187106 dirtied=2
5. 45.842 78,696.458 ↑ 3.7 566,292 1

Append (cost=1,145.30..902,167.30 rows=2,088,876 width=84) (actual time=5.082..78,696.458 rows=566,292 loops=1)

  • Buffers: shared hit=7187106 dirtied=2
6. 41.452 74,757.996 ↑ 245.2 7,293 1

Nested Loop (cost=1,145.30..626,629.67 rows=1,788,606 width=76) (actual time=5.080..74,757.996 rows=7,293 loops=1)

  • Output: ecr.campaign, ecr.email, c_1.id, NULL::uuid, ecr.send_type
  • Buffers: shared hit=4403485 dirtied=1
7. 28.327 73.819 ↓ 1.8 84,725 1

Hash Join (cost=1,144.31..5,960.93 rows=46,023 width=60) (actual time=2.975..73.819 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. 42.570 42.570 ↓ 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.008..42.570 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: 95402
  • Buffers: shared hit=2449
9. 1.094 2.922 ↓ 1.0 4,740 1

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

  • Output: ec_1.id, ec_1.brand
  • Buckets: 8192 Batches: 1 Memory Usage: 361kB
  • Buffers: shared hit=1038
10. 1.828 1.828 ↓ 1.0 4,740 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.828 rows=4,740 loops=1)

  • Output: ec_1.id, ec_1.brand
  • Buffers: shared hit=1038
11. 84.725 74,642.725 ↓ 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.880..0.881 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=8251
  • Buffers: shared hit=4399998 dirtied=1
12. 74,558.000 74,558.000 ↓ 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.880..0.880 rows=0 loops=84,725)

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

Nested Loop (cost=1,294.86..9,975.06 rows=1 width=84) (actual time=9.999..176.771 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=244793
14. 12.498 112.626 ↓ 981.9 26,510 1

Merge Join (cost=1,294.43..9,951.20 rows=27 width=52) (actual time=9.984..112.626 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=138669
15. 0.039 27.119 ↑ 1.6 72 1

Nested Loop (cost=0.70..6,669.66 rows=114 width=52) (actual time=0.021..27.119 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. 26.864 26.864 ↑ 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.011..26.864 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: 180055
  • 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. 73.009 73.009 ↓ 1.0 158,561 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.007..73.009 rows=158,561 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: 122095
  • Buffers: shared hit=134132
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=106124
20. 352.734 1,191.565 ↓ 30.1 283,923 1

Nested Loop (cost=0.70..27,909.72 rows=9,424 width=84) (actual time=0.052..1,191.565 rows=283,923 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: 1115119
  • Buffers: shared hit=610999 dirtied=1
21. 0.245 21.526 ↓ 1.1 515 1

Nested Loop (cost=0.28..5,339.50 rows=485 width=47) (actual time=0.021..21.526 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. 19.736 19.736 ↓ 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..19.736 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: 179612
  • 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. 817.305 817.305 ↓ 2.5 2,717 515

Index Scan using contacts_brand_idx on public.contacts contacts_1 (cost=0.42..33.04 rows=1,080 width=119) (actual time=0.005..1.587 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=607005 dirtied=1
25. 1.369 441.939 ↓ 9.4 3,552 1

Hash Join (cost=72,981.29..78,181.31 rows=376 width=84) (actual time=412.942..441.939 rows=3,552 loops=1)

  • Output: email_campaigns_2.id, COALESCE(email_campaigns_recipients_2.email, contacts_2.email[1]), 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=59324
26. 8.219 438.171 ↑ 10.6 4,704 1

Hash Join (cost=71,825.16..76,763.31 rows=49,881 width=126) (actual time=410.502..438.171 rows=4,704 loops=1)

  • Output: email_campaigns_recipients_2.email, email_campaigns_recipients_2.send_type, email_campaigns_recipients_2.campaign, contacts_2.email, contacts_2.id, contacts_2.brand
  • Inner Unique: true
  • Hash Cond: (email_campaigns_recipients_2.contact = contacts_2.id)
  • Buffers: shared hit=58286
27. 21.404 21.404 ↑ 1.0 90,335 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.006..21.404 rows=90,335 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. 137.891 408.548 ↑ 1.0 509,080 1

Hash (cost=65,381.70..65,381.70 rows=515,477 width=82) (actual time=408.548..408.548 rows=509,080 loops=1)

  • Output: contacts_2.email, contacts_2.id, contacts_2.brand
  • Buckets: 524288 Batches: 1 Memory Usage: 52273kB
  • Buffers: shared hit=55837
29. 270.657 270.657 ↑ 1.0 509,080 1

Seq Scan on public.contacts contacts_2 (cost=0.00..65,381.70 rows=515,477 width=82) (actual time=0.007..270.657 rows=509,080 loops=1)

  • Output: contacts_2.email, contacts_2.id, contacts_2.brand
  • Filter: ((contacts_2.deleted_at IS NULL) AND (contacts_2.id IS NOT NULL))
  • Rows Removed by Filter: 441926
  • Buffers: shared hit=55837
30. 0.885 2.399 ↓ 1.0 4,740 1

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

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

Seq Scan on public.email_campaigns email_campaigns_2 (cost=0.00..1,085.25 rows=4,725 width=32) (actual time=0.008..1.514 rows=4,740 loops=1)

  • Output: email_campaigns_2.id, email_campaigns_2.brand
  • Buffers: shared hit=1038
32. 35.579 278.280 ↑ 1.2 216,848 1

Nested Loop (cost=0.70..13,601.85 rows=264,271 width=84) (actual time=0.044..278.280 rows=216,848 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=116141
33. 0.250 18.677 ↑ 1.2 164 1

Nested Loop (cost=0.28..5,026.40 rows=204 width=36) (actual time=0.025..18.677 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.935 17.935 ↑ 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.009..17.935 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: 179963
  • 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. 224.024 224.024 ↓ 3.7 1,322 164

Index Scan using contacts_brand_idx on public.contacts contacts_3 (cost=0.42..38.44 rows=360 width=82) (actual time=0.016..1.366 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=113200
37. 50.423 1,804.064 ↓ 1.1 28,166 1

Hash Join (cost=75,139.25..114,536.56 rows=26,197 width=81) (actual time=219.723..1,804.064 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=1752364
38. 24.540 1,543.696 ↑ 1.6 208,146 1

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

  • Output: ec_2.id, ec_2.brand, ecr_1.send_type, ba."user
  • Buffers: shared hit=1519688
39. 0.262 21.056 ↑ 1.2 284 1

Nested Loop (cost=0.28..5,185.20 rows=341 width=52) (actual time=0.024..21.056 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.658 19.658 ↑ 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.011..19.658 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: 179843
  • 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,498.100 1,498.100 ↑ 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.233..5.275 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=1516387
43. 12.854 209.945 ↑ 1.2 25,861 1

Hash (cost=74,673.13..74,673.13 rows=31,039 width=93) (actual time=209.945..209.945 rows=25,861 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=232676
44. 10.874 197.091 ↓ 1.2 38,571 1

Hash Join (cost=2,246.18..74,673.13 rows=31,039 width=93) (actual time=3.622..197.091 rows=38,571 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=232676
45. 5.191 182.637 ↓ 1.2 38,571 1

Nested Loop (cost=0.42..72,345.86 rows=31,039 width=48) (actual time=0.032..182.637 rows=38,571 loops=1)

  • Output: cu."user", c_2.id, c_2.brand
  • Inner Unique: true
  • Buffers: shared hit=230590
46. 5.039 5.039 ↑ 1.0 57,469 1

Seq Scan on public.contacts_users cu (cost=0.00..998.72 rows=57,472 width=32) (actual time=0.013..5.039 rows=57,469 loops=1)

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

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,469)

  • 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=230166
48. 1.140 3.580 ↑ 1.0 7,100 1

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

  • Output: u.email, u.id
  • Buckets: 8192 Batches: 1 Memory Usage: 601kB
  • Buffers: shared hit=2086
49. 2.440 2.440 ↑ 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.440 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.005 0.042 ↓ 3.0 3 1

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

  • Output: ec.id, ec.brand
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=24
52. 0.037 0.037 ↓ 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.013..0.037 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: 19
  • Buffers: shared hit=24
Planning time : 7.801 ms
Execution time : 79,235.752 ms