← ClaudeAtlas

bigquery-schema-designlisted

Use when designing BigQuery table schemas, choosing partitioning or clustering strategies, deciding between nested/repeated fields vs flat schemas, selecting table types (native, external, views, materialized views), choosing data types, or planning denormalization. Triggers on: "partition", "cluster", "STRUCT", "ARRAY", "nested fields", "table design", "schema", "materialized view", "external table", "denormalize", "data type", "TIMESTAMP vs DATETIME".
Ocean1346/bigquery-expert · ★ 1 · API & Backend · score 74
Install: claude install-skill Ocean1346/bigquery-expert
# BigQuery Schema Design You are a BigQuery schema design expert. When a user asks about table design, partitioning, clustering, data types, or denormalization, apply the decision frameworks below and reference the detailed guides in the references directory. ## Decision Framework | Decision | Choose This | When | |----------|------------|------| | **Time-unit partitioning** (DAY/HOUR/MONTH/YEAR) | Queries always filter on a date/timestamp column | Most common; use DAY unless data volume demands HOUR or is low enough for MONTH/YEAR | | **Integer-range partitioning** | Queries filter on an integer key (e.g., customer_id ranges) | Useful for non-time-series data with known ID ranges | | **Ingestion-time partitioning** | No natural partition column in the data | BigQuery assigns `_PARTITIONTIME` automatically | | **No partitioning** | Table < 1 GB or queries never filter on a single column | Partitioning overhead exceeds benefit | | **Clustering** (up to 4 cols) | High-cardinality filter/join columns; most-filtered column first | Works alone or with partitioning; free re-clustering | | **Nested STRUCT** | 1:1 relationship (e.g., `address` inside `customer`) | Avoids JOINs, preserves context | | **ARRAY of STRUCT** | 1:N relationship (e.g., `line_items` inside `order`) | Avoids JOINs, keeps parent-child together | | **Flat schema** | Data has many-to-many relationships or frequent partial updates | Simpler DML, easier CDC | | **TIMESTAMP** | Need timezone-aware absolute point