Snowflake

How Snowflake Caching Works: Result Cache, Metadata Cache, Warehouse Cache

2026-03-21
更新: 2026-03-27
NicheeLab Editorial Team

Snowflake automatically manages 3 caches to optimize query performance: the Result Cache (Cloud Services layer), the Metadata Cache (Cloud Services layer), and the Warehouse Cache (SSD on the compute layer). Understanding exactly which layer each cache runs in and what invalidates it matters both for performance tuning and for the SnowPro exams.

The 3 Caches Side by Side

AttributeResult CacheMetadata CacheWarehouse Cache
Also known asQuery Result CacheCloud Services CacheLocal Disk Cache / SSD Cache
LayerCloud Services layerCloud Services layerCompute layer (SSD inside the warehouse)
What is cachedFinal query result setTable metadata (row count, MIN/MAX, etc.)Raw micro-partition data
Retention24 hours (extended on reuse)Persistent (until data changes)Only while the warehouse is running
Warehouse required?No (served without a warehouse)No (served without a warehouse)Yes (SSD on the warehouse)
Credit consumptionNone (within the Cloud Services allowance)None (within the Cloud Services allowance)Consumes warehouse credits
InvalidationTable changed / 24 hours elapsed / SQL differsDDL or DML changes to the tableWarehouse suspension

Result Cache (Query Result Cache)

The Result Cache stores the result set of any identical SQL query executed within the past 24 hours, and instantly returns it on a re-run without going through a warehouse.

Query execution flow (with Result Cache):

[SQL: SELECT region, SUM(amount) FROM sales GROUP BY region]
       |
       v
[Cloud Services layer]
       |
       +- Hit in Result Cache?
       |     |
       |     +- YES -> Return from cache instantly (no warehouse, no credits)
       |     |
       |     +- NO  -> Execute on the warehouse
       |                    |
       |                    +- Return result + store in Result Cache (24 hours)
       v
[Query result]

Conditions for a Result Cache hit

  • The SQL text matches exactly (including case, whitespace, and comments)
  • The target table's data has not changed
  • The last execution was within 24 hours
  • Run by the same role (different roles do not hit the cache)
  • Session parameter USE_CACHED_RESULT = TRUE (the default)

What invalidates the Result Cache

Invalidation triggerDetail
Table data changesWhen INSERT/UPDATE/DELETE/MERGE changes data in the target table
24 hours elapsed24 hours since the last execution (each reuse extends the window by 24 hours)
SQL text differsEven a one-character difference in whitespace, comments, or case
USE_CACHED_RESULT = FALSEExplicitly disabled via the session parameter
Non-deterministic functionsQueries containing CURRENT_TIMESTAMP(), RANDOM(), UUID_STRING(), etc.
External functionsQueries that call an External Function
-- Disable the Result Cache and run the query
ALTER SESSION SET USE_CACHED_RESULT = FALSE;

SELECT region, SUM(amount) FROM sales GROUP BY region;
-- -> Always re-executed on the warehouse

-- Re-enable the Result Cache
ALTER SESSION SET USE_CACHED_RESULT = TRUE;

Metadata Cache

The Metadata Cache stores table metadata (row count, byte size, MIN/MAX values per micro-partition, etc.) in the Cloud Services layer. Queries that can be answered from metadata alone return results without using a warehouse.

-- Queries answered instantly from the Metadata Cache
SELECT COUNT(*) FROM large_table;      -- row count is in metadata
SELECT MIN(id) FROM large_table;       -- MIN/MAX are in partition metadata
SELECT MAX(created_at) FROM large_table;

-- These queries run even when the warehouse is SUSPENDED
-- Query Profile shows "METADATA-BASED RESULT"

What the Metadata Cache stores

  • Table row count (ROW_COUNT)
  • Table byte size
  • MIN/MAX per micro-partition (used for partition pruning)
  • NULL counts and approximate DISTINCT values per micro-partition
  • Table schema definitions

Warehouse Cache (Local Disk Cache)

The Warehouse Cache caches raw micro-partition data on the SSDs of the warehouse's compute nodes. This reduces I/O to remote storage (S3 / Azure Blob / GCS) and shortens query execution time.

Query execution flow (with Warehouse Cache):

[SQL: SELECT * FROM sales WHERE region = 'APAC']
       |
       v
[Warehouse compute node]
       |
       +- Are the required micro-partitions already on SSD?
       |     |
       |     +- YES -> Read locally from SSD (fast)
       |     |
       |     +- NO  -> Read from remote storage (S3, etc.)
       |                    |
       |                    +- Cache the loaded data on SSD
       v
[Query result]

Warehouse Cache behavior

BehaviorDescription
Cache persistenceCache is retained while the warehouse is RUNNING
On suspendSuspending the warehouse clears the cache
On resizeScaling up adds nodes with empty caches; existing nodes keep their cache
LRU evictionOnce SSD capacity is reached, the least recently accessed data is evicted to make room
Multi-clusterEach cluster has its own independent cache

Cache evaluation order at query time

Cache evaluation priority:

[Incoming SQL query]
       |
       v
[1] Check the Metadata Cache
       |  Can metadata alone answer this? (COUNT(*), MIN, MAX, etc.)
       |     +- YES -> Return instantly (no warehouse)
       |     +- NO  -> Continue
       v
[2] Check the Result Cache
       |  Same SQL + same role + within 24 hours + data unchanged?
       |     +- YES -> Return cached result (no warehouse)
       |     +- NO  -> Continue
       v
[3] Execute on the warehouse (leveraging the Warehouse Cache)
       |  If the needed micro-partitions are on SSD, read them locally (fast)
       |  Otherwise read from remote storage and cache to SSD
       v
[Return result + store in Result Cache]

AUTO_SUSPEND and the cache

A warehouse's AUTO_SUSPEND setting has a major impact on how effective the Warehouse Cache is.

  • Short AUTO_SUSPEND (e.g. 60 seconds): the warehouse suspends often and the Warehouse Cache is cleared frequently
  • Long AUTO_SUSPEND (e.g. 600 seconds): the cache lasts longer but idle credit consumption goes up
  • For batch workloads, prioritize cost savings by letting the warehouse suspend
  • For interactive queries, set AUTO_SUSPEND a bit longer to preserve the cache

Inspecting caches in Query Profile

-- Cache-related signals in Query Profile

Result Cache hit:
  -> Query Profile shows "QUERY RESULT REUSE"
  -> No warehouse processing nodes are shown

Metadata Cache hit:
  -> Query Profile shows "METADATA-BASED RESULT"

Warehouse Cache in use:
  -> Check the Statistics tab for:
     - Percentage Scanned from Cache: share of reads from SSD cache
     - Bytes Scanned from Cache: bytes read from cache

-- Comparing Warehouse Cache effectiveness
-- 1st run: read from remote storage (Percentage Scanned from Cache = 0%)
-- 2nd run: read from SSD cache (Percentage Scanned from Cache ~ 100%)

Exam takeaways

  • Result Cache is retained for 24 hours and serves results without a warehouse
  • Result Cache requires the same role; a different role will not hit the cache
  • Metadata Cache applies to queries answerable from metadata alone, such as COUNT(*)/MIN/MAX
  • Warehouse Cache holds raw data on SSD and is cleared on SUSPEND
  • Queries with non-deterministic functions (CURRENT_TIMESTAMP, etc.) are excluded from the Result Cache
  • Any DML change to the table invalidates the Result Cache
  • AUTO_SUSPEND settings directly affect how effective the Warehouse Cache is

Sample question

Cache

問題 1

A user ran the same SELECT statement 5 minutes ago using ROLE_A and is now re-running it under ROLE_B. The target table's data has not changed. What is the correct Result Cache behavior?

  1. A. The SQL is identical and within 24 hours, so the Result Cache returns the result
  2. B. The executing role is different, so the Result Cache does not apply and the query re-runs on the warehouse
  3. C. The Result Cache returns a result with the role information stripped out
  4. D. The Result Cache returns a result filtered by ROLE_B's permissions

正解: B

The Result Cache is keyed by the executing role. Even with identical SQL, running under a different role does not hit the cache and the query re-runs on the warehouse. This is because Row Access Policies and Masking Policies can produce different results per role.

Frequently Asked Questions

Does returning a query result from the Result Cache consume warehouse credits?

No. The Result Cache (Query Result Cache) is managed in the Cloud Services layer and returns results without going through a warehouse, so no warehouse credits are consumed. However, Cloud Services usage that exceeds 10% of warehouse credit consumption is billable, so it is not entirely free.

When does the Result Cache become invalidated?

The Result Cache is invalidated in the following situations: (1) target table data is changed (INSERT/UPDATE/DELETE/MERGE), (2) 24 hours have elapsed, (3) the SQL text differs by even a single character, or (4) the user sets USE_CACHED_RESULT = FALSE. Queries that include random functions (e.g. RANDOM()) or non-deterministic functions (e.g. CURRENT_TIMESTAMP()) are also excluded from the Result Cache.

What is the difference between the Warehouse Cache and the Result Cache?

The Result Cache stores the final result set of a query in the Cloud Services layer for 24 hours and returns it instantly when the same SQL is re-run. The Warehouse Cache (Local Disk Cache) caches raw micro-partition data on the warehouse's SSD, reducing I/O to remote storage when different queries access the same table data. The Warehouse Cache is only active while the warehouse is running and is cleared when it is suspended.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Snowflake

Snowflake Certifications: All 11 Exams Explained (2026)

Every SnowPro certification — Associate, Core, Specialty, Ad...

Snowflake

Snowflake Exam Difficulty Ranking: All 11 Certs Compared (2026)

All 11 SnowPro exams ranked by difficulty with study-time es...

Snowflake

Snowflake Study Guide: Fastest Pass Route by Exam (2026)

How to pass SnowPro certifications efficiently — official ma...

Snowflake

SnowPro Core (COF-C03): Complete Exam Guide (2026)

Pass the SnowPro Core exam — six domains, scope, sample ques...

Snowflake

SnowPro Associate Platform (SOL-C01): Complete Guide (2026)

The entry-level SnowPro Associate exam — scope, weighting, s...

Browse all Snowflake articles (103)
© 2026 NicheeLab All rights reserved.