explain.depesz.com

PostgreSQL's explain analyze made readable

Result: y7ZQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.442 6,809.931 ↑ 1.6 31 1

Nested Loop (cost=0.84..11,465.93 rows=50 width=1,480) (actual time=4,483.538..6,809.931 rows=31 loops=1)

  • Join Filter: (send_mail_email.id = stats.email_id)
2. 0.175 6,654.853 ↑ 1.0 50 1

Nested Loop (cost=0.42..9,987.48 rows=50 width=1,229) (actual time=4,053.134..6,654.853 rows=50 loops=1)

3. 0.053 6,627.428 ↑ 1.0 50 1

Limit (cost=0.00..9,564.36 rows=50 width=4) (actual time=4,053.107..6,627.428 rows=50 loops=1)

4. 6,627.375 6,627.375 ↑ 45.3 50 1

Seq Scan on send_mail_email (cost=0.00..433,647.95 rows=2,267 width=4) (actual time=4,053.106..6,627.375 rows=50 loops=1)

  • Filter: ((send_date IS NOT NULL) AND (status = ANY ('{1}'::integer[])) AND (app_id = 1) AND (date(timezone('UTC'::text, created_at)) >= '2018-02-12'::date) AND (date(timezone('UTC'::text, created_at)) <= '2019-03-11'::date))
  • Rows Removed by Filter: 562483
5. 27.250 27.250 ↑ 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,225) (actual time=0.545..0.545 rows=1 loops=50)

  • Index Cond: (id = send_mail_email.id)
6. 103.300 103.300 ↑ 1.0 1 50

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

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

SubPlan (forNested Loop)

8. 0.093 0.217 ↑ 1.0 1 31

Result (cost=4.18..4.19 rows=1 width=0) (actual time=0.006..0.007 rows=1 loops=31)

9.          

Initplan (forResult)

10. 0.124 0.124 ↓ 0.0 0 31

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

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
11. 0.031 0.093 ↑ 1.0 1 31

Result (cost=8.17..8.18 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=31)

12.          

Initplan (forResult)

13. 0.062 0.062 ↓ 0.0 0 31

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

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

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

  • Index Cond: (id = info.campaign_id)
15. 0.155 0.155 ↓ 0.0 0 31

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

  • Index Cond: (id = info.template_id)