Cloud Run serving a Firestore (Datastore mode) product list returns all products, causing memory limits and spikes in Datastore reads. To stop crashes and reduce reads while optimizing performance, what should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Modify the query that returns the product list using cursors..
Why this is the answer
Using cursors is the most effective solution because they allow you to paginate through large result sets efficiently without re-scanning previous results. This significantly reduces Datastore reads and memory consumption on Cloud Run by fetching only a subset of data at a time. Integer offsets are inefficient for large datasets as Datastore still has to scan through all preceding entities to reach the offset, leading to high read costs and slow performance. While limits reduce the number of items returned, they don't solve the problem of fetching subsequent pages efficiently without cursors, as each subsequent page request would still need to re-scan from the beginning if not combined with cursors. Increasing Cloud Run memory limits only postpones the problem and doesn't address the underlying inefficiency of the query or the high Datastore read costs.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed