QuestionQ54

Perform database monitoring, tuning, and optimization

A sales team at an organization runs the following Snowflake query several times each day:

Question Image

What can the Snowflake Administrator do to optimize use of persisted query results whenever possible?

Explanation

Snowflake can only serve a query from its persisted result cache when the newly submitted query text matches a previously executed query exactly and does not depend on functions such as CURRENT_TIMESTAMP() that are re-evaluated, and therefore change, on every execution; using such non-deterministic, execution-time functions in date logic prevents subsequent identical-looking queries from hitting the cache. Replacing CURRENT_TIMESTAMP-based comparisons with CURRENT_DATE(), which stays constant for all queries run on the same day, lets repeated intraday executions resolve to the same literal value and reuse the cached result.

Community Discussion

No comments yet. Be the first to start the discussion!