explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JX2C

Settings
# exclusive inclusive rows x rows loops node
1. 1.047 22,005.622 ↑ 1.0 50 1

Nested Loop Left Join (cost=417,615.60..419,904.26 rows=50 width=1,488) (actual time=21,937.287..22,005.622 rows=50 loops=1)

2. 0.109 21,947.225 ↑ 1.0 50 1

Nested Loop (cost=417,615.18..418,038.00 rows=50 width=1,237) (actual time=21,879.956..21,947.225 rows=50 loops=1)

3. 0.055 21,832.766 ↑ 1.0 50 1

Limit (cost=417,614.75..417,614.88 rows=50 width=12) (actual time=21,832.679..21,832.766 rows=50 loops=1)

4. 259.626 21,832.711 ↑ 5,855.2 50 1

Sort (cost=417,614.75..418,346.66 rows=292,762 width=12) (actual time=21,832.676..21,832.711 rows=50 loops=1)

  • Sort Key: send_mail_email.created_at DESC
  • Sort Method: top-N heapsort Memory: 27kB
5. 21,175.169 21,573.085 ↓ 1.5 426,057 1

Bitmap Heap Scan on send_mail_email (cost=8,253.14..407,889.41 rows=292,762 width=12) (actual time=409.830..21,573.085 rows=426,057 loops=1)

  • Recheck Cond: ((app_id = ANY ('{1}'::integer[])) AND (date(timezone('UTC'::text, created_at)) >= '2018-12-15'::date) AND (date(timezone('UTC'::text, created_at)) <= '2019-03-15'::date))
  • Rows Removed by Index Recheck: 28083
  • Heap Blocks: exact=34944 lossy=52985
6. 397.916 397.916 ↓ 1.5 426,057 1

Bitmap Index Scan on send_mail_email_app_id_created_at_asdate_status (cost=0.00..8,179.95 rows=292,762 width=0) (actual time=397.916..397.916 rows=426,057 loops=1)

  • Index Cond: ((app_id = ANY ('{1}'::integer[])) AND (date(timezone('UTC'::text, created_at)) >= '2018-12-15'::date) AND (date(timezone('UTC'::text, created_at)) <= '2019-03-15'::date))
7. 114.350 114.350 ↑ 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=2.286..2.287 rows=1 loops=50)

  • Index Cond: (id = send_mail_email.id)
8. 17.550 17.550 ↓ 0.0 0 50

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

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

SubPlan (forNested Loop Left Join)

10. 0.100 0.500 ↑ 1.0 1 50

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

11.          

Initplan (forResult)

12. 0.400 0.400 ↓ 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.008..0.008 rows=0 loops=50)

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

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

14.          

Initplan (forResult)

15. 0.350 0.350 ↓ 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.007..0.007 rows=0 loops=50)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
16. 38.800 38.800 ↑ 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.775..0.776 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)