Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Snowflake · SnowPro Core

Result, Metadata, and Warehouse Caches

SnowPro Core · Lesson 22 of 27 · 2:44:32

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the SnowPro Core Certification exam (COF-C03). In this lesson: the query result cache, the metadata cache, the warehouse cache, and how auto-suspend affects caching. Follows Foxglove Apparel, a fictional online clothing retailer. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Fast, then slow, then fast

At eight in the morning, Foxglove's sales dashboard takes thirty seconds to open, and a minute later it opens in under one. After lunch, a new filter takes ten seconds, and the next morning everything is slow again. Three different caches explain all of it.

The query result cache

When a query runs, Snowflake keeps its result for twenty-four hours. If the same query runs again and nothing has changed, Snowflake skips execution entirely and returns the stored result. Each reuse resets the twenty-four hours, up to thirty-one days after the first run, and then the result is purged. Other users can reuse a result too, as long as their role has the required privileges on every table in the query.

When results are reused

The new query must match the earlier one exactly, so a different table alias, or a change of case, prevents reuse. Functions that return a new value on each run, such as RANDOM or UUID_STRING, prevent reuse, and so do external functions and hybrid tables. The data behind the result must be unchanged, and so must its micro-partitions, which reclustering can rewrite. The USE_CACHED_RESULT parameter turns reuse off for an account, a user, or a session, and the RESULT_SCAN function lets you query a previous result as a table.

The metadata cache

For every micro-partition, Snowflake keeps metadata, such as the range of values in each column and the number of distinct values. This metadata, held in the cloud services layer, is what pruning relies on to skip partitions. Some queries are answered from metadata alone, such as counting all the rows of a table, so no virtual warehouse is needed. The Query Profile then shows a single metadata-based result operator.

The warehouse cache

A running warehouse keeps the table data it has read on its local disk. Later queries on the same warehouse read that data from the cache, instead of from remote storage, which is much faster. The Query Profile, and QUERY_HISTORY, show the percentage of data scanned from the cache. But the cache is dropped when the warehouse suspends, so the first queries after a resume read from remote storage again.

Tuning auto-suspend

Snowflake recommends suspending warehouses that run tasks immediately, since their queries rarely repeat. For DevOps, DataOps, and data science, about five minutes is enough, because ad hoc queries gain little from the cache. For reporting and BI, keep at least ten minutes, so users keep a warm cache. But a running warehouse consumes credits even when idle, so if queries arrive every thirty minutes, a ten-minute setting buys nothing.

Three caches compared

The result cache sits in the cloud services layer, and it returns a whole result without running the query. The metadata cache also sits in the cloud services layer, and it answers some questions without reading any data. The warehouse cache sits in the warehouse, and it speeds up reads of data that has already been scanned. Only the warehouse cache disappears when the warehouse suspends.

Recap

Let's recap. The result cache keeps results for twenty-four hours, renewed on reuse, up to thirty-one days. Reuse needs an identical query, unchanged data, no functions such as RANDOM, and a role with the right privileges. Metadata answers some queries, such as a row count, without a warehouse. The warehouse cache keeps scanned data on local disk, and it is lost on suspend. And auto-suspend balances a warm cache against idle credits.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. An analyst at Foxglove compares warehouse sizes, but every second run of the test query returns in milliseconds, and the profile shows query result reuse. What gives a fair comparison?

    • Suspend and resume the warehouse
    • Run the second test on another warehouse
    • Wait ten minutes between the two runs
    • Set USE_CACHED_RESULT to FALSE
    Show the answer

    Set USE_CACHED_RESULT to FALSE

    Turning off USE_CACHED_RESULT in the session makes every run execute the query. “Suspend and resume the warehouse” only empties the warehouse cache, and the stored result is still reused. “Run the second test on another warehouse” does not help, because results are not tied to a warehouse. And “Wait ten minutes between the two runs” changes nothing, since a result stays available for 24 hours.

  2. Foxglove’s reporting warehouse suspends after sixty seconds with no activity, while users open dashboards every few minutes all day. Each query reads almost everything from remote storage. What helps most?

    • Set auto-suspend to ten minutes or more
    • Increase the warehouse size
    • Enable the query acceleration service
    • Set USE_CACHED_RESULT to FALSE
    Show the answer

    Set auto-suspend to ten minutes or more

    A longer auto-suspend, ten minutes or more, keeps the warehouse cache warm between dashboard queries. “Increase the warehouse size” adds compute, but the cache would still be dropped every minute. “Enable the query acceleration service” targets outlier queries, not cold caches. And “Set USE_CACHED_RESULT to FALSE” would stop result reuse, which only makes things slower.

  3. None of these queries has run before. Which one can Snowflake answer from metadata alone, without a virtual warehouse?

    • SELECT * FROM orders WHERE region = 'EU';
    • SELECT AVG(price) FROM orders;
    • SELECT COUNT(*) FROM orders;
    • SELECT RANDOM() FROM orders LIMIT 1;
    Show the answer

    SELECT COUNT(*) FROM orders;

    The row count of a table is recorded in metadata, so no data is read. “SELECT * FROM orders WHERE region = 'EU';” must read the region column and return the matching rows. “SELECT AVG(price) FROM orders;” must read every price to compute the average. And “SELECT RANDOM() FROM orders LIMIT 1;” reads data, and RANDOM returns a new value on each run.