explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dSDQ

Settings
# exclusive inclusive rows x rows loops node
1. 8,508.723 11,120.858 ↑ 1.0 141,214 1

Bitmap Heap Scan on public.send_mail_email mail (cost=20,300.63..4,499,954.51 rows=144,578 width=1,231) (actual time=1,211.869..11,120.858 rows=141,214 loops=1)

  • Output: mail.id, mail.app_id, mail.name_sender, mail.email_sender, mail.name_receiver, mail.email, mail.subject, mail.uuid, mail.content, mail.second_content, mail.created_at, mail.send_date, mail.campaign_id, mail.template_id, (SubPlan 2), (SubPlan 4), (...)
  • Recheck Cond: ((mail.app_id = 1) AND (date(timezone('UTC'::text, mail.created_at)) >= '2018-12-12'::date) AND (date(timezone('UTC'::text, mail.created_at)) <= '2019-03-11'::date) AND (mail.status = 2))
  • Filter: (NOT mail.from_system)
  • Heap Blocks: exact=38274
  • Buffers: shared hit=707421 read=39318
2. 1,199.995 1,199.995 ↓ 1.2 177,890 1

Bitmap Index Scan on send_mail_email_app_id_created_at_asdate_from_system_status (cost=0.00..20,264.49 rows=144,578 width=0) (actual time=1,199.995..1,199.995 rows=177,890 loops=1)

  • Index Cond: ((mail.app_id = 1) AND (date(timezone('UTC'::text, mail.created_at)) >= '2018-12-12'::date) AND (date(timezone('UTC'::text, mail.created_at)) <= '2019-03-11'::date) AND (mail.from_system = false) AND (mail.status = 2))
  • Buffers: shared read=2483
3.          

SubPlan (forBitmap Heap Scan)

4. 282.428 423.642 ↑ 1.0 1 141,214

Result (cost=4.18..4.19 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=141,214)

  • Output: $1
  • Buffers: shared hit=141226 read=1
5.          

Initplan (forResult)

6. 141.214 141.214 ↓ 0.0 0 141,214

Index Only Scan using track_linkemail_fdfd0ebf on public.track_linkemail (cost=0.15..8.22 rows=2 width=0) (actual time=0.001..0.001 rows=0 loops=141,214)

  • Index Cond: (track_linkemail.email_id = mail.id)
  • Heap Fetches: 13
  • Buffers: shared hit=141226 read=1
7. 282.428 423.642 ↑ 1.0 1 141,214

Result (cost=8.17..8.18 rows=1 width=0) (actual time=0.002..0.003 rows=1 loops=141,214)

  • Output: $3
  • Buffers: shared hit=141226 read=1
8.          

Initplan (forResult)

9. 141.214 141.214 ↓ 0.0 0 141,214

Index Only Scan using track_mailopen_fdfd0ebf on public.track_mailopen (cost=0.15..8.17 rows=1 width=0) (actual time=0.001..0.001 rows=0 loops=141,214)

  • Index Cond: (track_mailopen.email_id = mail.id)
  • Heap Fetches: 13
  • Buffers: shared hit=141226 read=1
10. 423.642 423.642 ↑ 1.0 1 141,214

Index Scan using campaign_campaign_pkey on public.campaign_campaign (cost=0.28..8.29 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=141,214)

  • Output: campaign_campaign.status
  • Index Cond: (campaign_campaign.id = mail.campaign_id)
  • Buffers: shared hit=422986 read=83
11. 141.214 141.214 ↓ 0.0 0 141,214

Index Scan using mail_template_template_pkey on public.mail_template_template (cost=0.27..8.29 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=141,214)

  • Output: row_to_json(ROW(mail_template_template.name, mail_template_template.slug))
  • Index Cond: (mail_template_template.id = mail.template_id)
  • Buffers: shared hit=452 read=7