ADA-C01 · Question #52
A Snowflake Administrator is investigating why a query is not re-using the persisted result cache. The Administrator found the two relevant queries from the SNOWFLAKE. ACCOUNT_USAGE. QUERY_HISTORY…
The correct answer is A. The second query includes a CURRENT_TIMESTAMP () function. The inclusion of the CURRENT_TIMESTAMP() function in the second query prevents it from re- using the first query's persisted result cache because this function makes each execution unique due to the constantly changing timestamp. According to the Snowflake documentation, "The…
Question
A Snowflake Administrator is investigating why a query is not re-using the persisted result cache. The Administrator found the two relevant queries from the SNOWFLAKE. ACCOUNT_USAGE. QUERY_HISTORY view:
Why is the second query re-scanning micro-partitions instead of using the first query's persisted result cache?
Options
- AThe second query includes a CURRENT_TIMESTAMP () function.
- BThe second query includes a CURRENT_DATE () function.
- CThe queries are executed with two different virtual warehouses.
- DThe queries are executed with two different roles.
How the community answered
(36 responses)- A69% (25)
- B6% (2)
- C14% (5)
- D11% (4)
Explanation
The inclusion of the CURRENT_TIMESTAMP() function in the second query prevents it from re- using the first query's persisted result cache because this function makes each execution unique due to the constantly changing timestamp. According to the Snowflake documentation, "The query does not include non-reusable functions, which return different results for successive runs of the same query. UUID_STRING, RANDOM, and RANDSTR are good examples of non- reusable functions." The CURRENT_TIMESTAMP() function is another example of a non- reusable function, as it returns the current date and time at the start of query execution, which varies for each run. Therefore, the second query is not identical to the first query, and the result cache is not reused.
Topics
Community Discussion
No community discussion yet for this question.