ADA-C01 · Question #39
If the query matches the definition, will Snowflake always dynamically rewrite the query to use a materialized view?
The correct answer is B. No, because the optimizer might decide against it. Snowflake's query optimizer can automatically rewrite queries against the base table or regular views to use the materialized view instead, if the query matches the definition of the materialized view. However, this is not always guaranteed, as the optimizer might decide…
Question
If the query matches the definition, will Snowflake always dynamically rewrite the query to use a materialized view?
Options
- ANo, because joins are not supported by materialized views.
- BNo, because the optimizer might decide against it.
- CNo, because the materialized view may not be up-to-date.
- DYes, because materialized views are always faster.
How the community answered
(63 responses)- A8% (5)
- B84% (53)
- C2% (1)
- D6% (4)
Explanation
Snowflake's query optimizer can automatically rewrite queries against the base table or regular views to use the materialized view instead, if the query matches the definition of the materialized view. However, this is not always guaranteed, as the optimizer might decide against using the materialized view based on various factors, such as the freshness of the data, the size of the result set, the complexity of the query, and the availability of the materialized view. Therefore, the answer is no, because the optimizer might decide against it.
Topics
Community Discussion
No community discussion yet for this question.