explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0ECH0

Settings
# exclusive inclusive rows x rows loops node
1. 0.522 25,638.218 ↑ 1.0 50 1

Nested Loop Left Join (cost=20,335.87..22,624.54 rows=50 width=1,488) (actual time=25,600.928..25,638.218 rows=50 loops=1)

2. 1.698 25,549.896 ↑ 1.0 50 1

Nested Loop (cost=20,335.45..20,758.28 rows=50 width=1,237) (actual time=25,532.421..25,549.896 rows=50 loops=1)

3. 0.053 25,512.548 ↑ 1.0 50 1

Limit (cost=20,335.03..20,335.15 rows=50 width=12) (actual time=25,512.465..25,512.548 rows=50 loops=1)

4. 174.264 25,512.495 ↑ 18.8 50 1

Sort (cost=20,335.03..20,337.37 rows=938 width=12) (actual time=25,512.460..25,512.495 rows=50 loops=1)

  • Sort Key: send_mail_email.created_at DESC
  • Sort Method: top-N heapsort Memory: 27kB
5. 25,215.149 25,338.231 ↓ 264.2 247,814 1

Bitmap Heap Scan on send_mail_email (cost=12,080.66..20,303.87 rows=938 width=12) (actual time=133.677..25,338.231 rows=247,814 loops=1)

  • Recheck Cond: ((app_id = ANY ('{1}'::integer[])) AND (date(timezone('UTC'::text, created_at)) >= '2018-12-16'::date) AND (date(timezone('UTC'::text, created_at)) <= '2019-03-16'::date))
  • Rows Removed by Index Recheck: 31616
  • Filter: ((email_sender)::text ~~* '%foo@alterdata.com.br%'::text)
  • Rows Removed by Filter: 178232
  • Heap Blocks: exact=34908 lossy=53015
6. 123.082 123.082 ↓ 197.0 426,046 1

Bitmap Index Scan on send_mail_email_app_id_status_created_at_asdate (cost=0.00..12,080.42 rows=2,163 width=0) (actual time=123.082..123.082 rows=426,046 loops=1)

  • Index Cond: ((app_id = ANY ('{1}'::integer[])) AND (date(timezone('UTC'::text, created_at)) >= '2018-12-16'::date) AND (date(timezone('UTC'::text, created_at)) <= '2019-03-16'::date))
7. 35.650 35.650 ↑ 1.0 1 50

Index Scan using send_mail_email_pkey on send_mail_email info (cost=0.42..8.44 rows=1 width=1,233) (actual time=0.712..0.713 rows=1 loops=50)

  • Index Cond: (id = send_mail_email.id)
8. 46.700 46.700 ↑ 1.0 1 50

Index Scan using collector_stats_fc41f286 on collector_stats stats (cost=0.42..8.36 rows=1 width=255) (actual time=0.934..0.934 rows=1 loops=50)

  • Index Cond: (email_id = send_mail_email.id)
9.          

SubPlan (forNested Loop Left Join)

10. 0.100 8.600 ↑ 1.0 1 50

Result (cost=4.18..4.19 rows=1 width=0) (actual time=0.172..0.172 rows=1 loops=50)

11.          

Initplan (forResult)

12. 8.500 8.500 ↓ 0.0 0 50

Index Only Scan using track_linkemail_fdfd0ebf on track_linkemail (cost=0.15..8.22 rows=2 width=0) (actual time=0.170..0.170 rows=0 loops=50)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
13. 0.050 0.750 ↑ 1.0 1 50

Result (cost=8.17..8.18 rows=1 width=0) (actual time=0.015..0.015 rows=1 loops=50)

14.          

Initplan (forResult)

15. 0.700 0.700 ↓ 0.0 0 50

Index Only Scan using track_mailopen_fdfd0ebf on track_mailopen (cost=0.15..8.17 rows=1 width=0) (actual time=0.014..0.014 rows=0 loops=50)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
16. 31.700 31.700 ↑ 1.0 1 50

Index Scan using campaign_campaign_pkey on campaign_campaign (cost=0.28..8.29 rows=1 width=4) (actual time=0.634..0.634 rows=1 loops=50)

  • Index Cond: (id = info.campaign_id)
17. 0.050 0.050 ↓ 0.0 0 50

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

  • Index Cond: (id = info.template_id)