
Answer-first summary for fast verification
Answer: Reconstruct the table with partitioning and clustering columns
**Correct Answer: C** Partitioning and clustering are effective strategies to enhance query performance and reduce costs in BigQuery. Partitioning divides your table into segments based on a specified column (like timestamp), making queries faster and cheaper by scanning only relevant partitions. Clustering sorts the data within partitions based on one or more columns (such as ID), further optimizing query performance. This approach ensures minimal data is scanned without altering your SQL queries. For more details, refer to [BigQuery Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables) and [Clustered Tables](https://cloud.google.com/bigquery/docs/clustered-tables).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You're working with a BigQuery table and execute a query that includes a WHERE clause filtering data by a timestamp and an ID column. Despite the filter targeting a small subset of data, the bq query --dry_run command reveals the query performs a full table scan. Your goal is to minimize the data scanned by BigQuery without modifying your SQL queries. What's the best approach?
A
Use the LIMIT keyword to decrease the number of rows returned
B
Create individual tables for each ID
C
Reconstruct the table with partitioning and clustering columns
D
Apply the bq query --maximum_bytes_billed flag to limit the bytes billed
No comments yet.