
Answer-first summary for fast verification
Answer: Create materialized views with the `allow_non_incremental_definition` option enabled for the visualization queries. Set the `max_staleness` parameter to 4 hours and the `enable_refresh` parameter to true. Reference these materialized views in the data visualization tool.
Option D is correct because creating materialized views with the `allow_non_incremental_definition` option set to true allows for refreshing the data in the materialized views without relying on incremental updates. Setting the `max_staleness` parameter to 4 hours ensures the data meets the freshness requirement, and enabling the `enable_refresh` parameter ensures automatic refreshing at the specified interval. This approach improves query performance by precomputing and storing the results, thereby reducing processing time for visualizations. Options A, B, and C are incorrect for the following reasons: - **A**: This approach introduces unnecessary complexity and additional maintenance overhead without guaranteeing improved query performance. - **B**: Views do not store precomputed results, leading to slow performance as the underlying data must be processed each time a visualization is generated. - **C**: While materialized views are beneficial, relying solely on incremental updates can introduce complexity and potentially impact performance, making option D a more straightforward and efficient solution.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are using a SQL-based tool to visualize data stored in BigQuery, which involves outer joins and analytic functions. The visualizations must be based on data that is at least 4 hours old. Business users are expressing dissatisfaction with the slow generation of these visualizations. What strategy can you implement to improve the performance of visualization queries while also reducing the maintenance burden of the data preparation pipeline?
A
Export the visualization query results as parquet files to a Cloud Storage bucket using a Cloud Function instance, triggered every 4 hours by Cloud Scheduler. Reference these parquet files in the data visualization tool.
B
Create views for the visualization queries and reference these views in the data visualization tool.
C
Create materialized views for the visualization queries, utilizing BigQuery's incremental updates capability to automatically handle changed data. Reference these materialized views in the data visualization tool.
D
Create materialized views with the allow_non_incremental_definition option enabled for the visualization queries. Set the max_staleness parameter to 4 hours and the enable_refresh parameter to true. Reference these materialized views in the data visualization tool.