explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TpG0

Settings
# exclusive inclusive rows x rows loops node
1. 0.441 20,565.186 ↑ 1.0 50 1

Nested Loop (cost=419,078.99..420,949.57 rows=50 width=1,237) (actual time=20,553.723..20,565.186 rows=50 loops=1)

2. 0.067 20,488.995 ↑ 1.0 50 1

Limit (cost=419,078.56..419,078.69 rows=50 width=12) (actual time=20,488.906..20,488.995 rows=50 loops=1)

3. 256.232 20,488.928 ↑ 5,855.2 50 1

Sort (cost=419,078.56..419,810.47 rows=292,762 width=12) (actual time=20,488.902..20,488.928 rows=50 loops=1)

  • Sort Key: (date(timezone('UTC'::text, send_mail_email.created_at))) DESC
  • Sort Method: top-N heapsort Memory: 27kB
4. 19,839.201 20,232.696 ↓ 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=411.426..20,232.696 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
5. 393.495 393.495 ↓ 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=393.495..393.495 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))
6. 34.550 34.550 ↑ 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.691..0.691 rows=1 loops=50)

  • Index Cond: (id = send_mail_email.id)
7.          

SubPlan (forNested Loop)

8. 0.100 6.650 ↑ 1.0 1 50

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

9.          

Initplan (forResult)

10. 6.550 6.550 ↓ 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.131..0.131 rows=0 loops=50)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
11. 0.100 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)

12.          

Initplan (forResult)

13. 0.650 0.650 ↓ 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.013..0.013 rows=0 loops=50)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
14. 33.750 33.750 ↑ 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.674..0.675 rows=1 loops=50)

  • Index Cond: (id = info.campaign_id)
15. 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)