Can Deta Base Apply ‘Limit’ After Filtering to Avoid Full Table Scans?
0 reputation · 05 Apr 2020, 03:25 UTC
The goal is to retrieve a subset of millions of documents from a Deta Base collection without triggering a full table scan, while still supporting cursor‑based pagination.
Deta Base permits attribute‑based filters and a ‘limit’ parameter that defines the maximum number of documents returned in a single response. The official docs do not specify whether the limit is applied before or after the filtering step, which can have a large impact on performance.
Additionally, the API documentation mentions a ‘next_token’ style cursor, but it is unclear whether the token is stable when documents are inserted or removed between requests.
Given these uncertainties, the following questions arise:
- Does Deta Base apply the ‘limit’ after all filters have been evaluated, or is the limit enforced before filtering?
- What is the maximum number of documents that can be retrieved in a single request, and does this limit depend on the number of active filters?
- Is the ‘next_token’ returned by a list operation guaranteed to remain valid if the underlying collection changes between paginated requests?