explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4k5i

Settings
# exclusive inclusive rows x rows loops node
1. 2,085.545 2,464.144 ↑ 4.9 22,730 1

Bitmap Heap Scan on public.send_mail_email mail (cost=34,480.65..3,490,354.23 rows=110,710 width=1,241) (actual time=164.397..2,464.144 rows=22,730 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.scheduled_at, mail.sent_at, mail.campaign_id, mail.sended, mail.not_sende (...)
  • 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 = ANY ('{4,5}'::integer[])))
  • Filter: (NOT mail.from_system)
  • Heap Blocks: exact=50804
  • Buffers: shared hit=125892 read=48291 written=56
2. 151.299 151.299 ↓ 2.4 263,875 1

Bitmap Index Scan on send_mail_email_app_id_created_at_asdate_from_system_status (cost=0.00..34,452.98 rows=110,710 width=0) (actual time=151.299..151.299 rows=263,875 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 = ANY ('{4,5}'::integer (...)
  • Buffers: shared hit=9732
3.          

SubPlan (forBitmap Heap Scan)

4. 45.460 68.190 ↑ 1.0 1 22,730

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

  • Output: $1
  • Buffers: shared hit=22730
5.          

Initplan (forResult)

6. 22.730 22.730 ↓ 0.0 0 22,730

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=22,730)

  • Index Cond: (track_linkemail.email_id = mail.id)
  • Heap Fetches: 0
  • Buffers: shared hit=22730
7. 22.730 68.190 ↑ 1.0 1 22,730

Result (cost=8.17..8.18 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=22,730)

  • Output: $3
  • Buffers: shared hit=22730
8.          

Initplan (forResult)

9. 45.460 45.460 ↓ 0.0 0 22,730

Index Only Scan using track_mailopen_fdfd0ebf on public.track_mailopen (cost=0.15..8.17 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=22,730)

  • Index Cond: (track_mailopen.email_id = mail.id)
  • Heap Fetches: 0
  • Buffers: shared hit=22730
10. 68.190 68.190 ↑ 1.0 1 22,730

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

  • Output: campaign_campaign.status
  • Index Cond: (campaign_campaign.id = mail.campaign_id)
  • Buffers: shared hit=68180 read=7
11. 22.730 22.730 ↓ 0.0 0 22,730

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=22,730)

  • Output: row_to_json(ROW(mail_template_template.name, mail_template_template.slug))
  • Index Cond: (mail_template_template.id = mail.template_id)
Planning time : 0.500 ms
Execution time : 2,476.198 ms