Best BigQuery Data Model for Streaming Sensor Metrics with Cost Minimization?
Short answer
C 1. Create a metrics table partitioned by timestamp.
Question
Key Takeaways
The exam tests whether you recognize time-series metrics should be in an append-only partitioned table, not in a column on the existing sensors table; the trap is confusing BigQuery's nested/repeated fields or partition limits with best practice.
For high-frequency sensor data, create a separate BigQuery metrics table partitioned by timestamp and join to the sensors metadata table only for weekly queries. This minimizes cost by enabling partition pruning and keeping the small sensors table stable.
Common mistake: Choosing B (or A), which attempts to store metrics in a column on the sensors table, because it avoids a join but creates severe write amplification: every 30-second insert would require rewriting the sensor row, and a weekly analytical query would process the entire table.
Expert Analysis
Why the Answer Is Correct
- Option C separates metadata from time-series data, which is the standard BigQuery data model for sensor events.
- Partitioning by timestamp means the weekly monitoring query can prune to the relevant date range and scan far less data, lowering cost.
- The sensors table remains small and is updated hourly; the metrics table grows append-only with INSERT statements, making ingestion simple and efficient.
Why the Other Options Are Wrong
- Options A and B add metrics to the sensors table. This forces either UPDATE rewrites for every 30-second metric or storing an array that must be unnest/rewritten, and it bloats the small table causing high query cost. Option B's nested/repeated field is often cited, but it is not suited for continuous row-level inserts.
- Option D is similar to C but puts the timestamp in the sensors table and still appends metrics to the sensors table, incorrectly storing many rows per sensor in a metadata table. It also fails to create a proper metric partition strategy.
- Partition-limit objections (comment 2) miss that timestamp partitioning can be daily/hourly, so 5000 sensors do not create 4000+ partitions.
Community Comment Notes
- Comment 6 and 9 correctly explain that partitioning by timestamp lowers cost and lets you separate metadata from metrics; comment 9 gives a clear step-by-step model matching option C.
- Comment 8 points out that B is infeasible because updating a metrics column with every insert is not a workable pattern.
- Comment 2 argues C/D exceed partition limits, but comment 4 corrects this by noting BigQuery partition granularity is configurable (hourly/daily/monthly/yearly), so C remains valid.
Official Reference
- https://cloud.google.com/bigquery/docs/partitioned-tables
- https://cloud.google.com/bigquery/pricing#storage
- https://cloud.google.com/bigquery/docs/best-practices-costs
These links open the official vendor documentation in a new tab.
Exam Strategy
Always separate low-cardinality metadata from high-cardinality event data when the events are append-only and queried by time range. Look for 'partitioned by timestamp' in the correct option and be wary of options that store metrics in the metadata table; mention partition pruning when 'minimize costs' is required.
Community Votes
65% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 10 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 10
-
raaad 👍 10Partitioned Metrics Table: Creating a separate metrics table partitioned by timestamp is a standard practice for time-series data like sensor readings. Partitioning by timestamp allows for more efficient querying, especially when you're only interested in a specific time range (like weekly monitoring). Reference to Sensors Table: Including a sensorId column that references the id column in the sensors table allows you to maintain a relationship between the metrics and the sensors without duplicating sensor information. INSERT Every 30 Seconds: Using an INSERT statement every 30 seconds to the partitioned metrics table is a standard approach for time-series data ingestion in BigQuery. It allows for efficient data storage and querying. Join for Analysis: When you need to analyze the data, you can join the metrics table with the sensors table based on the sensorId, allowing for comprehensive analysis with sensor details.
-
vbrege 👍 4 Answered BHere's my logic (some people have already said same thing) Cannot be C and D - Total 5000 sensors are sending new timestamp every 30 seconds. If you partition this table with timestamp, you are getting partitions above 4000 (single job) or 10000 (partition limit) so option C and D don't look correct - For C and D, also need to consider that BigQuery best practices advise to avoid JOINs and use STRUCT and RECORD types to solve the parent-child join issue. Now coming back to A and B, we will be adding sensor readings for every sensor. I don't think this is a transactional type database where you need to update data. You will add new data for more accurate analysis later so A is discarded. BigQuery best practices also advise to avoid UPDATE statements since its an Analytical columnar database B is the correct option.
-
anushree09 👍 4I'm in favor of Option B Reason: BQ has nested columns feature specifically to address these scenarios where a join would be needed in a traditional/ relational data model. Nesting field will reduce the need to join tables, performance will be high and design will be simple
-
Gloups 👍 3 Answered ASince BigQuery tables are limited to 4000 partitions, options C & D are discarded. Option B is wrong as insertion is invalid too. So option A.
-
dac9215 👍 3Option C will not violate partitioning limit of 4000 as the lowest grain of partitioning is hourly
Show 5 more comments
-
Pime13 👍 2 Answered CThis approach offers several advantages: Cost Efficiency: Partitioning the metrics table by timestamp helps reduce query costs by allowing BigQuery to scan only the relevant partitions. Data Organization: Keeping metrics in a separate table maintains a clear separation between sensor metadata and sensor metrics, making it easier to manage and query the data2. Performance: Using INSERT statements to append new metrics ensures efficient data ingestion without the overhead of frequent updates
-
7787de3 👍 2 Answered CBecause "Minimize costs" was requested, i would go for C. Storage cost will be lower for partitions where no writes took place for a certain amount of time, see https://cloud.google.com/bigquery/pricing#storage Partitioning by timestamp can be configured to use daily, hourly, monthly, or yearly partitioning - so if you choose daily partitioning, the number of partitions should not be an issue. Working with RECORDS (A,B) would be an option if performance was in focus.
-
scaenruy 👍 1 Answered CC. 1. Create a metrics table partitioned by timestamp. 2. Create a sensorId column in the metrics table, that points to the id column in the sensors table. 3. Use an INSERT statement every 30 seconds to append new metrics to the metrics table. 4. Join the two tables, if needed, when running the analytical query.
-
plum21 👍 1 Answered CC. B is not feasible – update on the metrics column will be required in such a case or an insert with all sensor data with one-element array of metrics which does not make any sense.
-
96f3bfa 👍 1 Answered COption C
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.