We have a weird problem with query performance against Snowflake -
It sounds like this query actually performs much better with query caching disabled (they issue an alter session statement to set USE_CACHED_RESULT = FALSE) than it does using query caching enabled. This is somewhat counterintuitive. I am not sure that we have confirmed it uses query caching in the first place. (seems like if it were not, then issuing the alter session statement to bypass snowflake’s query caching feature would result in no change in performance).
The problem is, we can’t disable query caching, as when this query moves to production it will be using a much bigger volume of data / plus it would affect all queries running against the corresponding universe.
It appears that in Snowflake the query resolves quite quickly, but the latency required for the bobj report to complete is really unacceptable.
Has anyone out there had experience with this kind of performance issue and what can be done to improve our throughput?
I don’t have the actual query text being constructed by bobj (and bobj can produce some pretty wild query syntax), but I am aware that there are some restrictions to query caching, and we are adhering to all of the qualifications for access to cached query result set in Snowflake. *however I have read that even satisfying these does not guarantee that query caching will be used.
- The new query syntactically matches the previously-executed query.
- The query does not include functions that must be evaluated at execution time (e.g. CURRENT_TIMESTAMP() and UUID_STRING()). Note that the CURRENT_DATE() function is an exception to this rule; even though CURRENT_DATE() is evaluated at execution time, queries that use CURRENT_DATE() can still use the query reuse feature.
- The query does not include external functions.
- The table data contributing to the query result has not changed.
- The persisted result for the previous query is still available.
- The role accessing the cached results has the required privileges.
- If the query was a SELECT query, the role executing the query must have the necessary access privileges for all the tables used in the cached query.
- Any configuration options that affect how the result was produced have not changed.
- The table’s micro-partitions have not changed (e.g. been reclustered or consolidated) due to changes to other data in the table.
Any advice would be really helpful to us.
Thanks!
Dave Hays