Ensuring Consistency in BigQuery Streaming Analytics
Short answer
A Re-write the application to load accumulated data every 2 minutes to ensure strong consistency for aggregation queries.
Question
application to use streaming inserts for individual postings. Your application also performs data aggregations right after the streaming inserts. You discover that
the queries after streaming inserts do not exhibit strong consistency, and reports from the queries might miss in-flight data. How can you adjust your application
design?
Key Takeaways
Streaming inserts in BigQuery are eventually consistent; use micro-batching to achieve strong consistency for immediate aggregations without sacrificing near real-time requirements.
Learn how to resolve eventual consistency issues in Google BigQuery streaming inserts by using micro-batch accumulation for reliable near real-time analytics.
Common mistake: Choosing Option D (waiting based on estimated latency) is a common trap. While it attempts to account for lag, it relies on variable network conditions and does not guarantee consistency, unlike the deterministic completion of a batch load.
Expert Analysis
The core issue is BigQuery's eventual consistency model for streaming inserts. When data is streamed via tabledata.insertAll, it becomes visible in query results after a short delay (typically seconds to minutes), and strong consistency is not guaranteed during this window. Consequently, aggregation queries running immediately after the insert may miss 'in-flight' data.
Option D suggests estimating latency and waiting twice that amount. This is operationally fragile because network conditions and load vary; a static multiplier cannot guarantee consistency against unpredictable lag spikes or replication delays. It also fails to address the fundamental architectural mismatch between real-time streaming and consistent reporting.
Option B proposes converting to batch loads for individual messages. This is inefficient and contradicts the requirement for near real-time ingestion of 10,000 messages per minute. Batch loading small files individually incurs high overhead and low throughput.
Option A, rewriting the application to accumulate data and load it every 2 minutes, is the correct design adjustment. By buffering incoming streams into micro-batches (e.g., 2-minute windows) and performing batch loads, you leverage BigQuery’s highly optimized batch ingestion path. Batch loads are strongly consistent once completed, ensuring that aggregations run against complete, committed datasets. This approach balances the need for near real-time data (2-minute latency is often acceptable for 'near real-time' analytics) with the requirement for accurate, consistent reports.
Comments supporting Option A correctly identify that accumulating data reduces inconsistency. Comments favoring Option D are criticized for relying on heuristics ('wait twice as long') that do not solve the consistency problem reliably. The key insight is that when consistency is required, streaming should be replaced or supplemented by micro-batching.
Official Reference
https://cloud.google.com/bigquery/streaming-data-into-bigquery
This link opens the official vendor documentation in a new tab.
Exam Strategy
When a question involves BigQuery streaming and mentions 'consistency' or 'missing data', evaluate whether the solution requires switching from stream-to-batch or micro-batching. Avoid heuristic-based timing solutions (like 'wait X seconds') unless explicitly supported by specific API features like the Storage Write API with commit semantics. Look for options that trade minimal latency for data integrity if strong consistency is mandated.
Frequently Asked Questions
Why isn't streaming insert strongly consistent?
Is 2-minute batching considered near real-time?
Community Votes
45% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 68 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 30 of 68
Show 25 more comments
-
ckanaar 👍 5I'd argue that this question became outdated with the introduction of the BigQuery Storage Write API: https://cloud.google.com/bigquery/docs/write-api
-
PRABHUKKARTHI 👍 5Option D: In Streaming buffer also, we can query the data. Only We need to have some latency to fetch the results.
-
Rav761 👍 4 Answered ATo address the issue of strong consistency and ensure your reports do not miss in-flight data after streaming inserts, you should re-write the application to load accumulated data every 2 minutes (option A). Here's why: By accumulating and loading data in 2-minute intervals, you can balance between real-time data processing and ensuring data consistency. This approach allows you to process the data in manageable batches, reducing the likelihood of inconsistencies that might occur with individual streaming inserts. It maintains a near real-time analysis capability while allowing enough time for all in-flight data to be captured and accurately represented in your reports. This adjustment should help improve the reliability of your data analysis and reporting.
-
kishanu 👍 4There is no way of estimating the average latency. So, no for option D. Instead, option A is suitable, where the data can be accumulated for 2minutes using the windowing technique in Dataflow and then use the data in BigQuery.
-
nana1995 👍 4 Answered DD is correct. B only adds a code batch load, it does not mention what you are going to do with this code, in this exam you can not assume.
-
abunasar786 👍 4D is better as it at least talks about taking into account latency. WIndowing can be set in dataflow with it
-
MarcoDipa 👍 3Answer is B. if you use the Committed mode, records are available for reading immediately as you write them to the stream. It is recommended to use his mode for streaming workloads that need minimal read latency. And the requirement is near rea-time. https://cloud.google.com/bigquery/docs/write-api#overview_of_the Besides, - You can use the Storage Write API to stream records into BigQuery that become available for query as they are written. - The Storage Write API has a significantly lower cost than the older tabledata.insertAll streaming API. In addition, you can ingest up to 2 TB per month for free https://cloud.google.com/bigquery/docs/write-api#advantages
-
BigDataBB 👍 3 Answered AAs written in GCP documentation the best approach to this kind of scenario is accumulate data ad save in batch mode: https://docs.cloud.google.com/bigquery/docs/optimize-load-jobs#batch_loading > Perform fewer, larger writes instead of many small ones. > Minimize separate write jobs to your final production table each day. > Instead of sending data to BigQuery each time new information becomes available, collect and load it into BigQuery using a single large job. So the answer is A
-
imran79 👍 3A. Re-write the application to load accumulated data every 2 minutes. By accumulating data and performing a batch load every 2 minutes, you can reduce the potential inconsistency caused by streaming inserts. While this introduces a slight delay, it provides a more consistent approach than streaming each individual message. This method can still meet the near real-time requirement, and the slight delay is often acceptable in scenarios where data consistency is paramount.
-
alecuba16 👍 3 Answered BEstimation is something that is only done by a designer that doesn't think technically, estimation requires a deep study of the distribution of the data latency and to be sure about the best time and most of the data you have to choose a narrow confidence interval with a big %. The best way to have confidence that the data is complete, is to confirm from the producer side that the stream of data is finish, that is to confirm the current stream, creating batches.
-
AmirN 👍 3Wait how can you batch load individual messages? Isn't that the same as streaming inserts? If it said batch load blocks of messages that makes sense because then they can be aggregated and we wont have missing data. With that said I think its D. Its not actually hard to trial and error (estimate) average latency. Like if you estimate latency is 5 seconds, try 10 second delay in aggregation, if you have missing data bump it up and see the results.
-
klughund 👍 3Streaming inserts in BigQuery are not immediately available to be queried, which is causing the weak consistency you're observing. A better approach is to batch the data and load it at regular intervals. Loading the data every two minutes is still relatively real-time, and it should help solve the consistency problem. Answer A.
-
WillemHendr 👍 3Streaming Inserts is marked as Legacy now. https://cloud.google.com/bigquery/docs/streaming-data-into-bigquery#dataavailability The documentation is hinting on it can take up to 90 minutes to process the buffered data. This question is testing if you are aware of the possible long times the buffer can build up.
-
izekc 👍 3 Answered BIn my experience, estimation in D is not a technical solution. it is just a guess solution. You might still get caught when loading get higher and easily take twice as long latency, then problem occur again. So for a more permanent solution, you should definitely go with B
-
bha11111 👍 3 Answered D1s tline of question requires near real time queries so D is the best option as batch load is never near real time
-
StefanoG 👍 3Also this time I agree with @MaxNRG, the right answer is B https://cloud.google.com/bigquery/docs/write-api
-
sergio6 👍 3How can you calculate average latency for data availability AFTER streaming inserts into biqquery ?
-
techtitan 👍 3 Answered Dnear realtime
-
sandipk91 👍 3sorry it's D
-
jkhong 👍 2 Answered DThere are assumptions over the quality of data acceptable. If slight variations of the analytics against actual can be accepted, then D would be a good choice. Many people chose B, but this also requires some form of waiting for the late data to arrive. I think a combination of D and B can be applied, but for an intial fix, delaying the aggregation queries with D seems to make more sense. If the variance is small and the some late data leakage is acceptable, and we can remain as D. If problems arise, we can always proceed to attempt B
-
nats828 👍 2 Answered AA. Loading data in batches (using batch loads instead of streaming inserts) ensures strong consistency in BigQuery. Batch loads are available for querying immediately after the load job completes. This approach is recommended when you need consistent query results right after data ingestion. Answer D (which is most voted) is a workaround, not a solution
-
korntewin 👍 2 Answered DThe streaming mode may be in pending mode or buffered mode where the streaming data is not immediately available before committing or flushing. Thus, we need to wait before the data will be available. Or else we need to switch to commited mode (which is not present in the choices).
-
imrane1995 👍 2 Answered AAccumulating data and loading it periodically (e.g., every 2 minutes) via batch inserts ensures strong consistency for queries. Batch loads in BigQuery allow you to avoid the latency issues inherent to streaming inserts and guarantee data availability for queries.
-
Parth_P 👍 2 Answered DD is correct. The problem requirement is doing analytics on real-time data. You cannot do batch processing because the business requires it to be real-time even if it makes your job simpler, so B is incorrect. Other options are not streaming.
-
StelSen 👍 2Option-A is incorrect. How can I conclude that in-flight data will come within 2 minutes? Atleast for Option-D, I will try to find avg latency first and doubling the time. Makes more sense.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
pipeline.apply(...) .apply(Window.<TableRow>into(FixedWindows.of(Duration.standardMinutes(2)))) .apply(BigQueryIO.writeTableRows() .to("my_dataset.my_table")``