explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 183.266 183.266 ↓ 0.0 0 1

CTE Scan on clt (cost=812.96..813.12 rows=8 width=56) (actual time=183.266..183.266 rows=0 loops=1)

2.          

CTE clt

3. 0.000 183.264 ↓ 0.0 0 1

Subquery Scan on tmp_crm_last_touches (cost=812.34..812.96 rows=8 width=56) (actual time=183.264..183.264 rows=0 loops=1)

4. 0.001 183.264 ↓ 0.0 0 1

Unique (cost=812.34..812.88 rows=8 width=72) (actual time=183.264..183.264 rows=0 loops=1)

5. 0.004 183.263 ↓ 0.0 0 1

Sort (cost=812.34..812.61 rows=108 width=72) (actual time=183.263..183.263 rows=0 loops=1)

  • Sort Key: contacts.id, microsoft_messages.message_date DESC
  • Sort Method: quicksort Memory: 25kB
6. 0.088 183.259 ↓ 0.0 0 1

Nested Loop (cost=235.51..808.69 rows=108 width=72) (actual time=183.259..183.259 rows=0 loops=1)

7. 0.049 1.411 ↓ 10.0 20 1

Nested Loop (cost=0.70..197.78 rows=2 width=82) (actual time=0.052..1.411 rows=20 loops=1)

8. 0.182 0.182 ↓ 2.5 20 1

Index Scan using contacts_pkey on contacts (cost=0.43..52.92 rows=8 width=82) (actual time=0.014..0.182 rows=20 loops=1)

  • 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)
9. 1.180 1.180 ↑ 1.0 1 20

Index Scan using microsoft_credentials_user_brand_email on microsoft_credentials (cost=0.27..18.10 rows=1 width=32) (actual time=0.032..0.059 rows=1 loops=20)

  • Index Cond: (brand = contacts.brand)
  • Filter: ((deleted_at IS NULL) AND (revoked IS NOT TRUE))
  • Rows Removed by Filter: 1
10. 0.040 181.760 ↓ 0.0 0 20

Bitmap Heap Scan on microsoft_messages (cost=234.81..304.90 rows=55 width=124) (actual time=9.088..9.088 rows=0 loops=20)

  • Recheck Cond: ((microsoft_credential = microsoft_credentials.id) AND (contacts.email && recipients))
  • Filter: (deleted_at IS NULL)
11. 181.720 181.720 ↓ 0.0 0 20

Bitmap Index Scan on microsoft_messages_credential_recipients_idx (cost=0.00..234.79 rows=63 width=0) (actual time=9.086..9.086 rows=0 loops=20)

  • Index Cond: ((microsoft_credential = microsoft_credentials.id) AND (contacts.email && recipients))
Planning time : 0.597 ms
Execution time : 183.333 ms