DocumentDB 惰性索引模式:在索引更新之前查询文档
DocumentDB Lazy indexing mode: Querying a document before the index has updated
为了提高写入性能,可以使用惰性索引策略。据我了解,这实质上意味着索引传播在写入后最终是一致的(与一致性模式相反,在一致性模式下,只有在索引更新也完成后写入才会完成)。
To allow maximum document ingestion throughput, a DocumentDB
collection can be configured with lazy consistency; meaning queries
are eventually consistent. The index is updated asynchronously when a
DocumentDB collection is quiescent i.e. when the collection’s
throughput capacity is not fully utilized to serve user requests. For
"ingest now, query later" workloads requiring unhindered document
ingestion, "lazy" indexing mode may be suitable.
问题:
如果在索引更新(仍在惰性传播)之前查询文档(比方说 id
),是否找不到文档 OR 会不会有某种形式的 "table scan" 和牺牲 RU(和性能)返回的文档?
编辑:以上假设数据库上的会话一致性。
使用 "id" 和“_rid”属性的查询不依赖于索引策略,并且始终一致地更新。即与帐户的配置一致性级别相同(在您的情况下,会话一致性)。
使用 "id" 的查询始终从索引提供,是查找,而不是扫描。
为了提高写入性能,可以使用惰性索引策略。据我了解,这实质上意味着索引传播在写入后最终是一致的(与一致性模式相反,在一致性模式下,只有在索引更新也完成后写入才会完成)。
To allow maximum document ingestion throughput, a DocumentDB collection can be configured with lazy consistency; meaning queries are eventually consistent. The index is updated asynchronously when a DocumentDB collection is quiescent i.e. when the collection’s throughput capacity is not fully utilized to serve user requests. For "ingest now, query later" workloads requiring unhindered document ingestion, "lazy" indexing mode may be suitable.
问题:
如果在索引更新(仍在惰性传播)之前查询文档(比方说 id
),是否找不到文档 OR 会不会有某种形式的 "table scan" 和牺牲 RU(和性能)返回的文档?
编辑:以上假设数据库上的会话一致性。
使用 "id" 和“_rid”属性的查询不依赖于索引策略,并且始终一致地更新。即与帐户的配置一致性级别相同(在您的情况下,会话一致性)。
使用 "id" 的查询始终从索引提供,是查找,而不是扫描。