ADA-C01 · Question #79
A Snowflake user runs a complex SQL query on a dedicated virtual warehouse that reads a large amount of data from micro-partitions. The same user wants to run another query that uses the same data…
The correct answer is D. Use the RESULT_SCAN function to post-process the output of the first query. According to the Using Persisted Query Results documentation, the RESULT_SCAN function allows you to query the result set of a previous command as if it were a table. This can improve the performance of the second query by avoiding reading the same data from micro-partitions…
Question
A Snowflake user runs a complex SQL query on a dedicated virtual warehouse that reads a large amount of data from micro-partitions. The same user wants to run another query that uses the same data set. Which action would provide optimal performance for the second SQL query?
Options
- AAssign additional clusters to the virtual warehouse.
- BIncrease the STATEMENT_TIMEOUT_IN_SECONDS parameter in the session.
- CPrevent the virtual warehouse from suspending between the running of the first and second
- DUse the RESULT_SCAN function to post-process the output of the first query.
How the community answered
(41 responses)- A5% (2)
- B2% (1)
- C15% (6)
- D78% (32)
Explanation
According to the Using Persisted Query Results documentation, the RESULT_SCAN function allows you to query the result set of a previous command as if it were a table. This can improve the performance of the second query by avoiding reading the same data from micro-partitions again. The other actions do not provide optimal performance for the second query because: - Assigning additional clusters to the virtual warehouse does not affect the data access speed, but only the query execution speed. It also increases the cost of the warehouse. - Increasing the STATEMENT_TIMEOUT_IN_SECONDS parameter in the session does not improve the performance of the query, but only allows it to run longer before timing out. It also increases the risk of resource contention and deadlock. - Preventing the virtual warehouse from suspending between the running of the first and second queries does not guarantee that the data will be cached in memory, as Snowflake uses a least recently used (LRU) cache eviction policy. It also increases the cost of the warehouse.
Topics
Community Discussion
No community discussion yet for this question.