
Ultimate access to all questions.
Answer-first summary for fast verification
Answer: Partition by transaction time; cluster by state first, then city, then store ID.
**Correct Answer: B** - **Partitioning by transaction time** organizes data based on time intervals, facilitating efficient queries for specific periods. - **Clustering by state, then city, then store ID** groups related data physically on disk, enhancing performance for queries filtering by these attributes. **Why other options are less optimal:** - **A & D:** Clustering by store ID first may not align with common query patterns focused on state and city analysis. - **C:** Without partitioning by transaction time, time-based queries may not perform as efficiently.
Author: LeetQuiz Editorial Team
No comments yet.
You are tasked with migrating a table to BigQuery, focusing on optimizing query performance for analyzing item sales and purchasing trends by state, city, and individual store. The table includes transaction time, items purchased, store ID, and store location details (city and state). Given that queries frequently analyze item sales over the last 30 days and examine purchasing trends by state, city, and store, how should you structure the table in BigQuery for optimal performance?
A
Top-level cluster by store ID first, then city, then state.
B
Partition by transaction time; cluster by state first, then city, then store ID.
C
Top-level cluster by state first, then city, then store ID.
D
Partition by transaction time; cluster by store ID first, then city, then state.