Google Cloud Professional Data Engineer — Question 221

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?

Answer options

Correct answer: C

Explanation

Option C is correct because it recommends creating a separate metrics table that is partitioned by timestamp, which is more efficient for storing and querying time-series data. This approach allows for easy appending of new metrics using INSERT statements while keeping the sensors table focused on static sensor information. The other options either use an UPDATE statement, which is less efficient for frequent data additions, or suggest combining everything into one table, which can lead to higher costs and more complex queries.