Snowflake Caching of Query results
Snowflake offers to cache the results of the SQL Queries. If a user repeats a query that has already been run, and the data in the table(s) hasn’t changed since the last time that the query was run, then the result of the query is the same. Instead of running the query again, Snowflake will simply return the same result that it returned previously.
Typically, query results can be re-used if:
- The new query syntactically matches the previously-executed query.
- The table data contributing to the query result has not changed.
- The query does not include functions that must be evaluated at execution (e.g. /sql-reference/function/current_timestamp).
- The table’s micro-partitions have not changed (e.g. been re-clustered or consolidated) due to changes to other data in the table.
Of course, assuming the user executing the query has the necessary access privileges for all the tables used in the query
How long are the query results cached?
Each time the persisted result for a query is reused, Snowflake resets the 24-hour retention period for the result, up to a maximum of 31 days from the date and time that the query was first executed. After 31 days, the result is purged and the next time the query is submitted, a new result is generated and persisted
Enjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds