explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 2ugr : Optimization for: Optimization for: plan #CSu5; plan #NFZjw

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 749.601 749.601 ↓ 2.5 20 1

CTE Scan on clt (cost=15,616.13..15,616.29 rows=8 width=56) (actual time=749.582..749.601 rows=20 loops=1)

2.          

CTE clt

3. 0.005 749.594 ↓ 2.5 20 1

Subquery Scan on tmp_crm_last_touches (cost=15,612.00..15,616.13 rows=8 width=56) (actual time=749.580..749.594 rows=20 loops=1)

4. 0.008 749.589 ↓ 2.5 20 1

Unique (cost=15,612.00..15,616.05 rows=8 width=72) (actual time=749.578..749.589 rows=20 loops=1)

5. 0.025 749.581 ↑ 10.9 74 1

Sort (cost=15,612.00..15,614.03 rows=810 width=72) (actual time=749.578..749.581 rows=74 loops=1)

  • Sort Key: c.id, ec.executed_at DESC
  • Sort Method: quicksort Memory: 30kB
6. 36.943 749.556 ↑ 10.9 74 1

Gather (cost=1,053.45..15,572.87 rows=810 width=72) (actual time=31.234..749.556 rows=74 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
7. 297.331 712.613 ↑ 12.9 37 2 / 2

Nested Loop (cost=53.45..14,491.87 rows=476 width=72) (actual time=18.580..712.613 rows=37 loops=2)

  • Join Filter: (c.email && ARRAY[ece.email_address])
  • Rows Removed by Join Filter: 1154773
8. 0.653 3.582 ↓ 1.2 230 2 / 2

Hash Join (cost=53.02..2,394.75 rows=184 width=90) (actual time=0.533..3.582 rows=230 loops=2)

  • Hash Cond: (ec.brand = c.brand)
9. 2.791 2.791 ↑ 1.1 5,799 2 / 2

Parallel Seq Scan on email_campaigns ec (cost=0.00..2,262.82 rows=6,166 width=40) (actual time=0.005..2.791 rows=5,799 loops=2)

  • Filter: ((deleted_at IS NULL) AND (executed_at IS NOT NULL))
  • Rows Removed by Filter: 1158
10. 0.007 0.138 ↓ 2.5 20 2 / 2

Hash (cost=52.92..52.92 rows=8 width=82) (actual time=0.138..0.138 rows=20 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
11. 0.131 0.131 ↓ 2.5 20 2 / 2

Index Scan using contacts_pkey on contacts c (cost=0.43..52.92 rows=8 width=82) (actual time=0.024..0.131 rows=20 loops=2)

  • Index Cond: (id = ANY ('{b5e4b2d3-9089-4775-9f9b-02e6d8c049c7,4f5ded2f-93af-4c2c-a2ae-5e3e20451e72,9576a130-fe87-4018-a2ff-6228ee8c3c01,39532ccf-ee9a-41af-9ebb-0b0c5d5ca54b,2664d729-8370-4bf3-909a-5b7105797c44,8baaeeb3-0b2f-47ae-9270-46117f7c299a,9bf53581-e002-43a5-bb79-7f4a72f79aa2,5521d409-7a02-4b84-b000-32b35bf8df36,e711f35c-fb8a-4bfb-9524-490655f82432,15ef4b0c-09c1-4a96-9463-5a206e58108f,a2710f92-3ec8-4d30-8a1a-e0bbb40a8f21,adbdc076-8613-4c62-b79f-a9a72b585987,37283ce8-5cea-45ac-af76-5ab36bf63e74,098e2294-cec6-4268-9a11-dbd2cdcb3e1c,0ed97581-295b-47f5-8a12-249feef97433,92659f75-b16b-4f71-9779-24c37294a4a3,a62d2605-d7e2-4a27-b826-dc3d95cf3838,6cc9b863-09c8-4679-9ab1-f5d31e298298,9641653a-4f8c-44cf-8527-9ce9eddb1b5a,a391f180-e450-4ee5-964e-57df32cea46d}'::uuid[]))
  • Filter: (deleted_at IS NULL)
12. 411.700 411.700 ↓ 2.9 5,021 460 / 2

Index Scan using email_campaign_emails_campaign_idx on email_campaign_emails ece (cost=0.43..44.36 rows=1,711 width=40) (actual time=0.003..1.790 rows=5,021 loops=460)

  • Index Cond: (campaign = ec.id)
Planning time : 1.192 ms
Execution time : 749.735 ms