PROFESSIONAL-DATA-ENGINEER · Question #216
A data scientist has created a BigQuery ML model and asks you to create an ML pipeline to serve predictions. You have a REST API application with the requirement to serve predictions for an…
The correct answer is D. Create a Cloud Dataflow pipeline using BigQueryIO to read predictions for all users from the query. Option D is correct because serving predictions with sub-100ms latency is fundamentally incompatible with running live BigQuery queries, which typically take several seconds to execute. The right architectural pattern is to pre-compute batch predictions for all users via a…
Question
Options
- AAdd a WHERE clause to the query, and grant the BigQuery Data Viewer role to the application service account.
- BCreate an Authorized View with the provided query.
- CCreate a Cloud Dataflow pipeline using BigQueryIO to read results from the query.
- DCreate a Cloud Dataflow pipeline using BigQueryIO to read predictions for all users from the query.
How the community answered
(34 responses)- A3% (1)
- B6% (2)
- C9% (3)
- D82% (28)
Explanation
Option D is correct because serving predictions with sub-100ms latency is fundamentally incompatible with running live BigQuery queries, which typically take several seconds to execute. The right architectural pattern is to pre-compute batch predictions for all users via a Dataflow pipeline, then write those results to a low-latency store (e.g., Bigtable, Memorystore) that the REST API can query in under 100ms.
Why the distractors fail:
- A - Adding a
WHERE user_id = ?clause still triggers a live BigQuery execution per request; BigQuery has slot-based query latency measured in seconds, not milliseconds, regardless of result size. - B - An Authorized View is just a saved query definition; it still executes against BigQuery at read time, providing no latency improvement.
- C - A Dataflow pipeline that reads query results reactively (on demand) still doesn't decouple prediction generation from the serving path, so latency remains bounded by the BigQuery query time.
Memory tip: Think of it as the "bake vs. fry" rule - low-latency ML serving requires baking predictions ahead of time in batch for all users (D), not frying them to order at request time (A, B, C). If the question mentions <100ms latency + BigQuery ML, the answer almost always involves pre-computed batch predictions stored in a fast-read data store.
Topics
Community Discussion
No community discussion yet for this question.