Best BigQuery Data Model for Streaming Sensor Metrics with Cost Minimization?
You work for a farming company. You have one BigQuery table named sensors, which is about 500 MB and contains the list of your 5000 sensors, with columns for id, name, and location. This table is updated every hour. Each sensor generates one metric every 30 seconds along with a timestamp, which you want to store in BigQuery. You want to run an analytical query on the data once a week for monitoring purposes. You also want to minimize costs. What data model should you use?
Community Votes
65% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
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.
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.
Community Discussion (11 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
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
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.