explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vqgs

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 218.594 4,480.251 ↓ 25.0 25 1

Limit (cost=1,797,181.85..1,797,181.89 rows=1 width=1,183) (actual time=4,261.593..4,480.251 rows=25 loops=1)

2. 0.062 4,261.657 ↓ 25.0 25 1

Unique (cost=1,797,181.85..1,797,181.89 rows=1 width=1,183) (actual time=4,261.591..4,261.657 rows=25 loops=1)

3. 0.000 4,261.595 ↓ 25.0 25 1

Sort (cost=1,797,181.85..1,797,181.86 rows=1 width=1,183) (actual time=4,261.586..4,261.595 rows=25 loops=1)

  • Sort Key: contacts.created_at DESC, contacts.id, contacts.email, contacts.name, contacts.phone_number, contacts.address_line_1, contacts.address_line_2, contacts.address_city, contacts.address_state, contacts.address_country, contacts.address_zip, contacts.custom_1, contacts.custom_2, contacts.custom_3, contacts.custom_4, contacts.custom_5, contacts.custom_6, contacts.custom_7, contacts.custom_8, contacts.custom_9, contacts.custom_10, contacts.custom_11, contacts.custom_12, contacts.custom_13, contacts.custom_14, contacts.custom_15, contacts.custom_16, contacts.custom_17, contacts.custom_18, contacts.custom_19, contacts.updated_at, contacts.subscribed, contacts.custom_20, contacts.opt_in_ip, contacts.opt_in_at, contacts.opt_out_ip, contacts.opt_out_at, contacts.uuid, contacts.hidden_at, contacts.custom_21, contacts.custom_22, contacts.custom_23, contacts.custom_24, contacts.custom_25, contacts.custom_26, contacts.custom_27, contacts.custom_28, contacts.custom_29, contacts.custom_30, contacts.custom_31, contacts.custom_32, contacts.custom_33, contacts.custom_34, contacts.custom_35, contacts.custom_36, contacts.custom_37, contacts.custom_38, contacts.custom_39, contacts.custom_40, contacts.custom_41, contacts.custom_42, contacts.custom_43, contacts.custom_44, contacts.custom_45, contacts.custom_46, contacts.custom_47, contacts.custom_48, contacts.custom_49, contacts.custom_50, contacts.last_inactivity_triggered_at
  • Sort Method: quicksort Memory: 8187kB
4. 216.608 4,436.535 ↓ 44,937.0 44,937 1

Gather (cost=1,000.11..1,797,181.85 rows=1 width=1,183) (actual time=1.498..4,436.535 rows=44,937 loops=1)

  • Workers Planned: 4
  • Workers Launched: 4
5. 2,869.803 4,219.927 ↓ 8,987.0 8,987 5

Nested Loop Left Join (cost=0.11..1,796,181.75 rows=1 width=1,183) (actual time=4.663..4,219.927 rows=8,987 loops=5)

  • Filter: (not_opened_email_in_last_email_deliveries.id IS NULL)
  • Rows Removed by Filter: 39289
6. 1,349.941 1,349.941 ↑ 1.2 15,584 5

Parallel Seq Scan on contacts (cost=0.00..512,619.67 rows=18,972 width=1,183) (actual time=0.488..1,349.941 rows=15,584 loops=5)

  • Filter: ((hidden_at IS NULL) AND (site_id = 18599))
  • Rows Removed by Filter: 5537444
7. 0.183 0.183 ↑ 1.0 3 77,918

Index Scan using index_email_deliveries_on_recipient_id on email_deliveries not_opened_email_in_last_email_deliveries (cost=0.11..67.65 rows=3 width=8) (actual time=0.096..0.183 rows=3 loops=77,918)

  • Index Cond: (contacts.id = recipient_id)
  • Filter: (opened_at > '2019-02-07 21:17:57.998648'::timestamp without time zone)
  • Rows Removed by Filter: 69
Planning time : 9.529 ms
Execution time : 4,481.391 ms