explain.depesz.com

PostgreSQL's explain analyze made readable

Result: t6R1

Settings
# exclusive inclusive rows x rows loops node
1. 1.630 389.183 ↑ 8.3 6 1

Nested Loop (cost=1.13..2,577.85 rows=50 width=1,488) (actual time=377.790..389.183 rows=6 loops=1)

  • Join Filter: (send_mail_email.id = stats.email_id)
2. 1.318 298.697 ↑ 1.2 43 1

Nested Loop (cost=0.71..1,100.45 rows=50 width=1,237) (actual time=241.064..298.697 rows=43 loops=1)

3. 0.054 267.322 ↑ 1.2 43 1

Limit (cost=0.28..677.32 rows=50 width=4) (actual time=237.166..267.322 rows=43 loops=1)

4. 267.268 267.268 ↑ 22.5 43 1

Index Scan using send_mail_email_send_date_isnotnull_sent_at_isnull on send_mail_email (cost=0.28..13,121.33 rows=969 width=4) (actual time=237.156..267.268 rows=43 loops=1)

  • Index Cond: ((send_date IS NOT NULL) AND (sent_at IS NULL))
  • Filter: ((status = ANY ('{1}'::integer[])) AND (app_id = 1) AND (date(timezone('UTC'::text, created_at)) >= '2018-12-12'::date) AND (date(timezone('UTC'::text, created_at)) <= '2019-03-15'::date))
  • Rows Removed by Filter: 5988
5. 30.057 30.057 ↑ 1.0 1 43

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.699..0.699 rows=1 loops=43)

  • Index Cond: (id = send_mail_email.id)
6. 40.076 40.076 ↓ 0.0 0 43

Index Scan using collector_stats_fc41f286 on collector_stats stats (cost=0.42..0.58 rows=1 width=255) (actual time=0.932..0.932 rows=0 loops=43)

  • Index Cond: (email_id = info.id)
7.          

SubPlan (forNested Loop)

8. 0.018 17.664 ↑ 1.0 1 6

Result (cost=4.18..4.19 rows=1 width=0) (actual time=2.944..2.944 rows=1 loops=6)

9.          

Initplan (forResult)

10. 17.646 17.646 ↓ 0.0 0 6

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

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
11. 0.012 7.374 ↑ 1.0 1 6

Result (cost=8.17..8.18 rows=1 width=0) (actual time=1.229..1.229 rows=1 loops=6)

12.          

Initplan (forResult)

13. 7.362 7.362 ↓ 0.0 0 6

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

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
14. 0.006 0.006 ↓ 0.0 0 6

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

  • Index Cond: (id = info.campaign_id)
15. 23.736 23.736 ↑ 1.0 1 6

Index Scan using mail_template_template_pkey on mail_template_template (cost=0.27..8.29 rows=1 width=32) (actual time=3.955..3.956 rows=1 loops=6)

  • Index Cond: (id = info.template_id)