Question #3
A Data Engineer executes a complex query and wants to make use of Snowflake’s query results caching capabilities to reuse the results.Which conditions must be met? (Choose three.)
- A.
The results must be reused within 72 hours.
- B.
The query must be executed using the same virtual warehouse.
- C.
The USED_CACHED_RESULT parameter must be included in the query.
- D.
The table structure contributing to the query result cannot have changed.
- E.
The new query must have the same syntax as the previously executed query.
- F.
The micro-partitions cannot have changed due to changes to other data in the table.
Answer: DEF
This question evaluates core knowledge of Snowflake query result cache eligibility rules, a critical performance optimization topic for the SnowPro Advanced Data Engineer certification. The query result cache is a cloud services layer resource that stores fully computed results of successful queries to eliminate redundant compute for repeat identical queries. For a new query to reuse cached results, three non-negotiable conditions must be met: the query syntax must exactly match the original, the schema of all referenced tables must be unchanged, and the underlying micro-partitions of referenced tables must not have been modified. These conditions correspond directly to options D, E, and F, the correct answers for this question. Option Analysis:
A. Incorrect. Snowflake retains query results for general automatic reuse for a default 24 hour window, not 72 hours. While results may be retained for up to 7 days for limited use cases such as RESULT_SCAN operations, standard automatic cache reuse is restricted to 24 hours, making this statement invalid.
B. Incorrect. The query result cache is a global cloud services layer resource, independent of the virtual warehouse used to run the original query. Cached results can be accessed using any appropriately sized virtual warehouse with correct permissions, so using the same warehouse is not a requirement.
C. Incorrect. The relevant session parameter is named USE_CACHED_RESULT, not USED_CACHED_RESULT, and this parameter is enabled by default at the account, session, and query levels. No explicit inclusion of the parameter in a query is required to leverage cached results.
D. Correct. Any modification to the structure of tables referenced in the query, including adding or dropping columns, changing data types, or modifying constraints, invalidates the cached result set. Unchanged table structures are a mandatory condition for cache reuse.
E. Correct. The new query must have exactly identical syntax to the original query to match the cached result, including matching capitalization, whitespace, and object reference formatting. Even minor differences in query text will prevent a cache match.
F. Correct. Any change to the underlying micro-partitions of referenced tables, including inserts, updates, deletes, or reclustering operations, invalidates the cached result set because the source data used to generate the original result is no longer consistent. Unmodified micro-partitions for referenced tables are a required condition for cache reuse. Key Concepts:
1. Query Result Cache Architecture: The query result cache is hosted in Snowflake's cloud services layer, separate from compute and storage layers. It stores fully computed query results for 24 hours by default, is accessible across all virtual warehouses in an account, and eliminates the need to reprocess source data for identical repeat queries.
2. Cache Invalidation Rules: Cached results are automatically invalidated if referenced table schemas change, referenced table micro-partitions are modified, the query includes non-deterministic functions, the running user lacks permissions to access the original result, or the query syntax differs from the original executed query.
3. Cache Eligibility Requirements: For a query to reuse cached results, it must have identical syntax to a previously run query, reference unmodified table schemas and source data, exclude non-deterministic and external functions, and be executed by a user with permissions to access the original result set. References:
Using the Query Result Cache, SnowPro Advanced: Data Engineer Exam Guide