explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Rr2m

Settings
# exclusive inclusive rows x rows loops node
1. 1.504 3,191.939 ↑ 1.1 42 1

Nested Loop (cost=12,182.18..63,414.54 rows=46 width=1,480) (actual time=1,402.150..3,191.939 rows=42 loops=1)

  • Join Filter: (send_mail_email.id = stats.email_id)
2. 0.899 2,957.335 ↑ 1.1 42 1

Nested Loop (cost=12,181.76..62,054.36 rows=46 width=1,229) (actual time=1,360.316..2,957.335 rows=42 loops=1)

3. 0.061 2,919.392 ↑ 1.1 42 1

Limit (cost=12,181.34..61,665.09 rows=46 width=4) (actual time=1,358.841..2,919.392 rows=42 loops=1)

4. 2,754.643 2,919.331 ↑ 1.1 42 1

Bitmap Heap Scan on send_mail_email (cost=12,181.34..61,665.09 rows=46 width=4) (actual time=1,358.838..2,919.331 rows=42 loops=1)

  • Recheck Cond: ((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) AND (status = ANY ('{3}'::integer[])))
  • Filter: ((email)::text ~~* '%thiago.decastro2@gmail.com%'::text)
  • Rows Removed by Filter: 19400
  • Heap Blocks: exact=7017
5. 164.688 164.688 ↓ 1.3 19,442 1

Bitmap Index Scan on send_mail_email_app_id_created_at_asdate_status (cost=0.00..12,181.32 rows=14,510 width=0) (actual time=164.688..164.688 rows=19,442 loops=1)

  • Index Cond: ((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) AND (status = ANY ('{3}'::integer[])))
6. 37.044 37.044 ↑ 1.0 1 42

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.881..0.882 rows=1 loops=42)

  • Index Cond: (id = send_mail_email.id)
7. 156.534 156.534 ↑ 1.0 1 42

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

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

SubPlan (forNested Loop)

9. 0.126 0.294 ↑ 1.0 1 42

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

10.          

Initplan (forResult)

11. 0.168 0.168 ↓ 0.0 0 42

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=42)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
12. 0.084 0.168 ↑ 1.0 1 42

Result (cost=8.17..8.18 rows=1 width=0) (actual time=0.004..0.004 rows=1 loops=42)

13.          

Initplan (forResult)

14. 0.084 0.084 ↓ 0.0 0 42

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=42)

  • Index Cond: (email_id = info.id)
  • Heap Fetches: 0
15. 61.152 61.152 ↓ 0.0 0 42

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

  • Index Cond: (id = info.campaign_id)
16. 14.952 14.952 ↑ 1.0 1 42

Index Scan using mail_template_template_pkey on mail_template_template (cost=0.27..8.29 rows=1 width=32) (actual time=0.355..0.356 rows=1 loops=42)

  • Index Cond: (id = info.template_id)