explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yaFx : Optimization for: plan #Neu3

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.010 716.229 ↑ 1.0 1 1

Hash Join (cost=114,732.56..114,765.35 rows=1 width=32) (actual time=716.217..716.229 rows=1 loops=1)

  • Output: (ec.id)::text
  • Inner Unique: true
  • Hash Cond: (ecr.campaign = ec.id)
  • Buffers: shared hit=287,125
2. 0.029 716.183 ↑ 76.3 19 1

HashAggregate (cost=114,707.61..114,722.10 rows=1,449 width=84) (actual time=716.173..716.183 rows=19 loops=1)

  • Output: ecr.campaign, ecr.email, c.id, (NULL::uuid), ecr.send_type
  • Group Key: ecr.campaign, ecr.email, c.id, (NULL::uuid), ecr.send_type
  • Buffers: shared hit=287,099
3. 0.009 716.154 ↑ 76.3 19 1

Append (cost=0.70..114,689.49 rows=1,449 width=84) (actual time=48.979..716.154 rows=19 loops=1)

  • Buffers: shared hit=287,099
4. 12.270 59.465 ↑ 38.5 2 1

Nested Loop (cost=0.70..5,242.97 rows=77 width=76) (actual time=48.979..59.465 rows=2 loops=1)

  • Output: ecr.campaign, ecr.email, c.id, NULL::uuid, ecr.send_type
  • Join Filter: (c.email && ARRAY[ecr.email])
  • Rows Removed by Join Filter: 59,113
  • Buffers: shared hit=20,367
5. 0.016 19.186 ↓ 18.5 37 1

Nested Loop (cost=0.28..5,150.04 rows=2 width=60) (actual time=3.159..19.186 rows=37 loops=1)

  • Output: ec_1.brand, ecr.campaign, ecr.email, ecr.send_type
  • Inner Unique: true
  • Buffers: shared hit=2,560
6. 19.059 19.059 ↓ 18.5 37 1

Seq Scan on public.email_campaigns_recipients ecr (cost=0.00..5,145.04 rows=2 width=44) (actual time=3.148..19.059 rows=37 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) AND (ecr.email = 'rezazarinfar@outlook.com'::text))
  • Rows Removed by Filter: 180,092
  • Buffers: shared hit=2,449
7. 0.111 0.111 ↑ 1.0 1 37

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

  • Output: ec_1.id, ec_1.created_at, ec_1.updated_at, ec_1.deleted_at, ec_1.created_by, ec_1.brand, ec_1.subject, ec_1.include_signature, ec_1.html, ec_1.due_at, ec_1.executed_at, ec_1."from", ec_1.individual, ec_1.accepted, ec_1.rejected, ec_1.delivered, ec_1.failed, ec_1.opened, ec_1.clicked, ec_1.unsubscribed, ec_1.complained, ec_1.stored, ec_1.template, ec_1.deal, ec_1.text, ec_1.headers, ec_1.google_credential, ec_1.microsoft_credential, ec_1.thread_key
  • Index Cond: (ec_1.id = ecr.campaign)
  • Buffers: shared hit=111
8. 28.009 28.009 ↓ 1.5 1,598 37

Index Scan using contacts_brand_idx on public.contacts c (cost=0.42..33.02 rows=1,076 width=82) (actual time=0.004..0.757 rows=1,598 loops=37)

  • Output: c.id, c.email, c.brand
  • Index Cond: (c.brand = ec_1.brand)
  • Filter: (c.id IS NOT NULL)
  • Buffers: shared hit=17,807
9. 6.028 200.242 ↓ 0.0 0 1

Merge Join (cost=1,294.86..9,904.21 rows=1 width=84) (actual time=200.242..200.242 rows=0 loops=1)

  • Output: email_campaigns.id, contacts.email[1], contacts.id, NULL::uuid, email_campaigns_recipients.send_type
  • Inner Unique: true
  • Merge Cond: (email_campaigns_recipients.list = crm_lists_members.list)
  • Join Filter: (contacts.id = crm_lists_members.contact)
  • Rows Removed by Join Filter: 9
  • Buffers: shared hit=201,247
10. 0.064 142.332 ↑ 315.3 7 1

Nested Loop (cost=1.12..10,745.78 rows=2,207 width=102) (actual time=64.187..142.332 rows=7 loops=1)

  • Output: email_campaigns.id, email_campaigns_recipients.send_type, email_campaigns_recipients.list, contacts.email, contacts.id
  • Buffers: shared hit=96,421
11. 0.044 26.492 ↑ 1.6 72 1

Nested Loop (cost=0.70..6,669.66 rows=114 width=52) (actual time=0.015..26.492 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=4,537
12. 26.232 26.232 ↑ 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.009..26.232 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: 180,057
  • Buffers: shared hit=4,321
13. 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
14. 115.776 115.776 ↓ 0.0 0 72

Index Scan using contacts_brand_idx on public.contacts (cost=0.42..35.71 rows=5 width=82) (actual time=1.414..1.608 rows=0 loops=72)

  • Output: contacts.email, contacts.id, contacts.brand
  • Index Cond: (contacts.brand = email_campaigns.brand)
  • Filter: ((contacts.id IS NOT NULL) AND (contacts.email[1] = 'rezazarinfar@outlook.com'::text))
  • Rows Removed by Filter: 2,809
  • Buffers: shared hit=91,884
15. 51.882 51.882 ↑ 1.6 97,232 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.009..51.882 rows=97,232 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: 92,677
  • Buffers: shared hit=104,826
16. 0.017 18.336 ↓ 0.0 0 1

Hash Join (cost=5,404.29..10,591.11 rows=47 width=84) (actual time=18.336..18.336 rows=0 loops=1)

  • Output: email_campaigns_1.id, contacts_1.email[1], contacts_1.id, NULL::uuid, email_campaigns_recipients_1.send_type
  • Hash Cond: (contacts_1.brand = email_campaigns_1.brand)
  • Join Filter: (ARRAY[email_campaigns_recipients_1.tag] <@ contacts_1.tag)
  • Rows Removed by Join Filter: 4
  • Buffers: shared hit=4,003
17. 0.016 0.034 ↑ 285.3 9 1

Bitmap Heap Scan on public.contacts contacts_1 (cost=58.73..5,006.19 rows=2,568 width=119) (actual time=0.023..0.034 rows=9 loops=1)

  • Output: contacts_1.email, contacts_1.id, contacts_1.tag, contacts_1.brand
  • Recheck Cond: (contacts_1.email[1] = 'rezazarinfar@outlook.com'::text)
  • Filter: ((contacts_1.deleted_at IS NULL) AND (contacts_1.id IS NOT NULL))
  • Heap Blocks: exact=6
  • Buffers: shared hit=9
18. 0.018 0.018 ↑ 528.3 9 1

Bitmap Index Scan on contact_primary_email_idx (cost=0.00..58.09 rows=4,755 width=0) (actual time=0.018..0.018 rows=9 loops=1)

  • Index Cond: (contacts_1.email[1] = 'rezazarinfar@outlook.com'::text)
  • Buffers: shared hit=3
19. 0.117 18.285 ↓ 1.1 515 1

Hash (cost=5,339.50..5,339.50 rows=485 width=47) (actual time=18.285..18.285 rows=515 loops=1)

  • Output: email_campaigns_1.id, email_campaigns_1.brand, email_campaigns_recipients_1.send_type, email_campaigns_recipients_1.tag
  • Buckets: 1,024 Batches: 1 Memory Usage: 48kB
  • Buffers: shared hit=3,994
20. 0.340 18.168 ↓ 1.1 515 1

Nested Loop (cost=0.28..5,339.50 rows=485 width=47) (actual time=0.016..18.168 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=3,994
21. 17.313 17.313 ↓ 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.009..17.313 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: 179,614
  • Buffers: shared hit=2,449
22. 0.515 0.515 ↑ 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.001..0.001 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=1,545
23. 0.022 420.154 ↓ 8.5 17 1

Nested Loop (cost=71,961.08..76,980.01 rows=2 width=84) (actual time=404.563..420.154 rows=17 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
  • Join Filter: (contacts_2.brand = email_campaigns_2.brand)
  • Buffers: shared hit=58,530
24. 6.859 420.081 ↑ 14.6 17 1

Hash Join (cost=71,960.80..76,898.95 rows=249 width=126) (actual time=404.548..420.081 rows=17 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)
  • Join Filter: (COALESCE(email_campaigns_recipients_2.email, contacts_2.email[1]) = 'rezazarinfar@outlook.com'::text)
  • Rows Removed by Join Filter: 4,680
  • Buffers: shared hit=58,479
25. 20.992 20.992 ↑ 1.0 90,337 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..20.992 rows=90,337 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: 89,792
  • Buffers: shared hit=2,449
26. 116.915 392.230 ↑ 1.0 509,061 1

Hash (cost=65,540.45..65,540.45 rows=513,628 width=82) (actual time=392.230..392.230 rows=509,061 loops=1)

  • Output: contacts_2.email, contacts_2.id, contacts_2.brand
  • Buckets: 524,288 Batches: 1 Memory Usage: 52,272kB
  • Buffers: shared hit=56,030
27. 275.315 275.315 ↑ 1.0 509,061 1

Seq Scan on public.contacts contacts_2 (cost=0.00..65,540.45 rows=513,628 width=82) (actual time=0.006..275.315 rows=509,061 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: 441,984
  • Buffers: shared hit=56,030
28. 0.051 0.051 ↑ 1.0 1 17

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

  • Output: email_campaigns_2.id, email_campaigns_2.created_at, email_campaigns_2.updated_at, email_campaigns_2.deleted_at, email_campaigns_2.created_by, email_campaigns_2.brand, email_campaigns_2.subject, email_campaigns_2.include_signature, email_campaigns_2.html, email_campaigns_2.due_at, email_campaigns_2.executed_at, email_campaigns_2."from", email_campaigns_2.individual, email_campaigns_2.accepted, email_campaigns_2.rejected, email_campaigns_2.delivered, email_campaigns_2.failed, email_campaigns_2.opened, email_campaigns_2.clicked, email_campaigns_2.unsubscribed, email_campaigns_2.complained, email_campaigns_2.stored, email_campaigns_2.template, email_campaigns_2.deal, email_campaigns_2.text, email_campaigns_2.headers, email_campaigns_2.google_credential, email_campaigns_2.microsoft_credential, email_campaigns_2.thread_key
  • Index Cond: (email_campaigns_2.id = email_campaigns_recipients_2.campaign)
  • Buffers: shared hit=51
29. 0.008 17.936 ↓ 0.0 0 1

Hash Join (cost=5,087.25..10,089.85 rows=1,317 width=84) (actual time=17.936..17.936 rows=0 loops=1)

  • Output: email_campaigns_3.id, contacts_3.email[1], contacts_3.id, NULL::uuid, email_campaigns_recipients_3.send_type
  • Hash Cond: (contacts_3.brand = email_campaigns_3.brand)
  • Buffers: shared hit=2,950
30. 0.021 0.037 ↑ 95.1 9 1

Bitmap Heap Scan on public.contacts contacts_3 (cost=58.30..5,029.54 rows=856 width=82) (actual time=0.023..0.037 rows=9 loops=1)

  • Output: contacts_3.email, contacts_3.id, contacts_3.brand
  • Recheck Cond: (contacts_3.email[1] = 'rezazarinfar@outlook.com'::text)
  • Filter: ((contacts_3.deleted_at IS NULL) AND (contacts_3.id IS NOT NULL) AND (length(contacts_3.email[1]) > 0))
  • Heap Blocks: exact=6
  • Buffers: shared hit=9
31. 0.016 0.016 ↑ 528.3 9 1

Bitmap Index Scan on contact_primary_email_idx (cost=0.00..58.09 rows=4,755 width=0) (actual time=0.016..0.016 rows=9 loops=1)

  • Index Cond: (contacts_3.email[1] = 'rezazarinfar@outlook.com'::text)
  • Buffers: shared hit=3
32. 0.040 17.891 ↑ 1.2 164 1

Hash (cost=5,026.40..5,026.40 rows=204 width=36) (actual time=17.891..17.891 rows=164 loops=1)

  • Output: email_campaigns_3.id, email_campaigns_3.brand, email_campaigns_recipients_3.send_type
  • Buckets: 1,024 Batches: 1 Memory Usage: 19kB
  • Buffers: shared hit=2,941
33. 0.084 17.851 ↑ 1.2 164 1

Nested Loop (cost=0.28..5,026.40 rows=204 width=36) (actual time=0.015..17.851 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=2,941
34. 17.439 17.439 ↑ 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.008..17.439 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: 179,965
  • Buffers: shared hit=2,449
35. 0.328 0.328 ↑ 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.002..0.002 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. 0.000 0.011 ↓ 0.0 0 1

Nested Loop (cost=2.08..1,859.62 rows=4 width=81) (actual time=0.011..0.011 rows=0 loops=1)

  • Output: ec_2.id, u.email, c_1.id, NULL::uuid, ecr_1.send_type
  • Join Filter: (u.id = ba."user")
  • Buffers: shared hit=2
37. 0.000 0.011 ↓ 0.0 0 1

Nested Loop (cost=1.82..1,611.87 rows=11 width=113) (actual time=0.011..0.011 rows=0 loops=1)

  • Output: ec_2.id, ecr_1.send_type, ecr_1.brand, c_1.id, cu."user", u.email, u.id
  • Buffers: shared hit=2
38. 0.001 0.011 ↓ 0.0 0 1

Nested Loop (cost=1.41..1,024.56 rows=156 width=93) (actual time=0.011..0.011 rows=0 loops=1)

  • Output: ec_2.id, c_1.id, cu."user", u.email, u.id
  • Buffers: shared hit=2
39. 0.000 0.010 ↓ 0.0 0 1

Nested Loop (cost=1.12..1,021.77 rows=4 width=93) (actual time=0.010..0.010 rows=0 loops=1)

  • Output: u.email, u.id, cu."user", c_1.id, c_1.brand
  • Inner Unique: true
  • Buffers: shared hit=2
40. 0.001 0.010 ↓ 0.0 0 1

Nested Loop (cost=0.70..1,011.83 rows=8 width=77) (actual time=0.010..0.010 rows=0 loops=1)

  • Output: u.email, u.id, cu."user", cu.contact
  • Buffers: shared hit=2
41. 0.009 0.009 ↓ 0.0 0 1

Index Scan using users_email_key on public.users u (cost=0.28..2.50 rows=1 width=45) (actual time=0.009..0.009 rows=0 loops=1)

  • Output: u.username, u.first_name, u.last_name, u.email, u.phone_number, u.created_at, u.id, u.password, u.address_id, u.cover_image_url, u.profile_image_url, u.updated_at, u.user_status, u.profile_image_thumbnail_url, u.cover_image_thumbnail_url, u.email_confirmed, u.timezone, u.user_type, u.deleted_at, u.phone_confirmed, u.agent, u.secondary_password, u.is_shadow, u.personal_room, u.brand, u.fake_email, u.features, u.last_seen_at, u.last_seen_by, u.email_signature
  • Index Cond: (u.email = 'rezazarinfar@outlook.com'::text)
  • Buffers: shared hit=2
42. 0.000 0.000 ↓ 0.0 0

Index Only Scan using contacts_users_idx on public.contacts_users cu (cost=0.41..1,009.14 rows=19 width=32) (never executed)

  • Output: cu.contact, cu."user
  • Index Cond: (cu."user" = u.id)
  • Heap Fetches: 0
43. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on public.contacts c_1 (cost=0.42..1.24 rows=1 width=32) (never executed)

  • Output: c_1.id, c_1.brand
  • Index Cond: ((c_1.id = cu.contact) AND (c_1.id IS NOT NULL))
  • Filter: (c_1.deleted_at IS NULL)
44. 0.000 0.000 ↓ 0.0 0

Index Scan using email_campaigns_brand_idx on public.email_campaigns ec_2 (cost=0.28..0.55 rows=15 width=32) (never executed)

  • 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.brand = c_1.brand)
45. 0.000 0.000 ↓ 0.0 0

Index Scan using email_campaigns_recipients_campaign_idx on public.email_campaigns_recipients ecr_1 (cost=0.42..3.75 rows=1 width=36) (never executed)

  • 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
  • Index Cond: (ecr_1.campaign = ec_2.id)
  • Filter: ((ecr_1.deleted_at IS NULL) AND (ecr_1.recipient_type = 'Brand'::email_campaign_recipient_type))
46. 0.000 0.000 ↓ 0.0 0

Function Scan on public.get_brand_agents ba (cost=0.25..10.25 rows=1,000 width=16) (never executed)

  • 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)
47. 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
48. 0.001 0.036 ↓ 3.0 3 1

Hash (cost=24.94..24.94 rows=1 width=16) (actual time=0.036..0.036 rows=3 loops=1)

  • Output: ec.id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=26
49. 0.035 0.035 ↓ 3.0 3 1

Index Scan using email_campaigns_brand_idx on public.email_campaigns ec (cost=0.28..24.94 rows=1 width=16) (actual time=0.012..0.035 rows=3 loops=1)

  • Output: ec.id
  • 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.817 ms
Execution time : 716.659 ms