10 Dec 18 · Asran ·       Add to Favorites   Report

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

Asran

posted on 10 Dec 18

Read great educational content like this and a lot more !

Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too

Copied