Prepare and test your skills

Prepare and test your skills

Free sample question, answered and explained below. The Professional Data Engineer practice bank has 1,353 more like it. Try 10 free: instant score, no account.
A data engineering team maintains a reporting dashboard that visualizes transactional records from Firestore in Datastore mode. Users report severe latency degradation when navigating to deeper pages in the data grid. An audit reveals that the underlying application issues queries that retrieve all 50 entity properties while using integer OFFSET and LIMIT clauses for pagination.
Which combination of data modeling and query design changes should you implement to resolve the latency issues and reduce operational read costs?
This design executes a keys-only query to retrieve entity keys and uses subsequent lookup() operations to fetch the full entities for display.
OFFSET clause still requires the database engine to traverse all preceding keys in the index, failing to eliminate pagination latency on deep pages.lookup() calls introduces multiple network round-trips compared to a single projection query.This pattern would be ideal if the visualization layer needed to display full, unindexed entity blobs or embedded sub-entities that cannot be served via projection queries, while using cursors instead of offsets.
This solution combines query cursors with projection queries in Firestore in Datastore mode to eliminate internal read amplification and reduce payload overhead.
OFFSET clauses force the database engine to fetch and evaluate all skipped entities internally before discarding them, leading to linear $O(N)$ latency growth on deeper pages. Query cursors act as bookmark tokens indicating the exact index position where the next page begins, executing in $O(1)$ constant time regardless of page depth.OFFSET, your application is billed for reading every skipped entity. Cursors ensure you are only billed for the specific entities returned on the active page.Using cursors alongside projection queries directly targets the two primary architectural bottlenecks: unindexed pagination scanning and over-fetching of unneeded entity properties.
This strategy attempts to hide latency by fetching larger blocks of data using expanded OFFSET increments and caching them in application memory, while excluding properties from single-property indexes.
This approach would be appropriate if the dataset were static, entirely unindexed, and small enough to fit within an in-memory cache without incurring continuous database queries.
This approach attempts to resolve scan latency by creating a large composite index covering all 50 properties of the entity while retaining integer OFFSET pagination.
OFFSET clause still forces the storage engine to retrieve and process every intermediate index entry prior to the offset limit.This approach would only be considered if the application required complex multi-property equality and inequality filtering simultaneously, and offset-based arbitrary jumping was strictly mandated by a legacy external API without cost constraints.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated