You are designing a BigQuery schema for IoT sensor data. The sensor readings have varying fields depending on the sensor type. You want to minimize storage costs and avoid schema maintenance when new sensor types are added. What is the best schema design?
JSON provides schema flexibility and cost-effective storage for varying fields.
Why this answer
Option B is correct because storing sensor data in a JSON column leverages BigQuery's native support for semi-structured data (the `JSON` data type), allowing you to ingest records with varying fields without schema changes. This minimizes storage costs by avoiding the overhead of many NULL columns and eliminates the need for schema maintenance when new sensor types are added, as BigQuery can query JSON fields directly using functions like `JSON_EXTRACT` or dot notation.
Exam trap
Cisco often tests the misconception that a STRUCT with optional fields is equivalent to a JSON column, but the trap is that a STRUCT still requires a fixed schema definition, whereas JSON allows fully dynamic fields without schema changes.
How to eliminate wrong answers
Option A is wrong because using a separate table per sensor type increases storage costs (due to table metadata overhead) and requires schema maintenance (creating new tables for each new sensor type), which contradicts the goal of minimizing maintenance. Option C is wrong because a STRUCT with all possible fields as optional still requires you to know and define every potential field in advance, leading to schema maintenance when new sensor types introduce new fields; it also incurs storage cost for NULL values in unused fields. Option D is wrong because a wide table with many nullable columns wastes storage on NULL values (BigQuery charges for NULL storage in fixed-length types) and requires schema updates to add columns for new sensor types, failing the 'avoid schema maintenance' requirement.