explain.depesz.com

PostgreSQL's explain analyze made readable

Result: A1bB

Settings
# exclusive inclusive rows x rows loops node
1. 0.375 19,305.674 ↑ 1.0 50 1

Nested Loop Left Join (cost=419,079.41..421,171.94 rows=50 width=1,237) (actual time=19,288.367..19,305.674 rows=50 loops=1)

2. 0.959 19,245.399 ↑ 1.0 50 1

Nested Loop (cost=419,078.99..419,501.81 rows=50 width=1,237) (actual time=19,234.904..19,245.399 rows=50 loops=1)

3. 0.604 19,214.640 ↑ 1.0 50 1

Limit (cost=419,078.56..419,078.69 rows=50 width=12) (actual time=19,214.524..19,214.640 rows=50 loops=1)

4. 246.145 19,214.036 ↑ 5,855.2 50 1

Sort (cost=419,078.56..419,810.47 rows=292,762 width=12) (actual time=19,213.990..19,214.036 rows=50 loops=1)

  • Sort Key: (date(timezone('UTC'::text, send_mail_email.created_at))) DESC
  • Sort Method: top-N heapsort Memory: 27kB
5. 18,635.819 18,967.891 ↓ 1.5 426,057 1

Bitmap Heap Scan on send_mail_email (cost=8,253.14..409,353.22 rows=292,762 width=12) (actual time=352.129..18,967.891 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. 332.072 332.072 ↓ 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=332.072..332.072 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. 29.800 29.800 ↑ 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.595..0.596 rows=1 loops=50)

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

Index Only Scan using collector_stats_fc41f286 on collector_stats stats (cost=0.42..4.44 rows=1 width=4) (actual time=0.268..0.268 rows=0 loops=50)

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

SubPlan (forNested Loop Left Join)

10. 0.100 4.750 ↑ 1.0 1 50

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

11.          

Initplan (forResult)

12. 4.650 4.650 ↓ 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.093..0.093 rows=0 loops=50)

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

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

14.          

Initplan (forResult)

15. 1.150 1.150 ↓ 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.023..0.023 rows=0 loops=50)

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