Cosmos DB Continuation Token Validity Under Session Consistency With Cross-Partition Writes
0 reputation · 21 May 2025, 21:37 UTC
0 reputation · 21 May 2025, 21:37 UTC
Azure Cosmos DB SQL API uses opaque continuation tokens to paginate cross-partition query results. Each token encodes the query state across all target partitions and does not expire, but its logical position can shift when the underlying data changes or when partition topology evolves.
The SDKs automatically handle partition splits and merges, yet the continuation token's logical position may shift, leading to non-deterministic ordering if the query lacks an explicit ORDER BY. The service does not provide a built-in point-in-time snapshot for cross-partition queries unless the account consistency level is Strong, and even then, new matching documents inserted after the initial request may not appear in subsequent pages.
An unresolved behavior is whether a continuation token captured at consistency level Session remains valid if the session token advances due to writes in the same session but targeting a different partition.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.