0
如果查詢過濾器使用IList Contains方法而不是明確地對分區進行OR操作,Azure DocumentDB可以並行處理跨分區的查詢嗎?使用IList.Contains(分區)對多個分區進行DocumentDb查詢
例如
DocumentClient client = ...
Uri documentUri = ...
FeedOptions = new FeedOptions { EnableCrossPartitionQuery = true };
IList<string> partitions = new List<string> { "x", "y", "z" };
Expression<Func<ResourceType, bool>> filter =
(ResourceType rt) => partitions.Contains(rt.PartitionId);
IDocumentQuery<ResourceType> queryable =
client.CreateDocumentQuery<ResourceType>(documentUri, feedOptions)
.Where(filter)
.AsDocumentQuery();
FeedResponse<ResourceType> response = await queryable.ExecuteNextAsync<ResourceType>();
請閱讀[並行查詢執行](https://docs.microsoft.com/en-us/azure/cosmos-db/tutorial-develop-documentdb-dotnet#parallel-query-execution)並嘗試指定[MaxDegreeOfParallelism](https://docs.microsoft.com/zh-cn/dotnet/api/microsoft.azure.documents.client.feedoptions.maxdegreeofparallelism?redirectedfrom=MSDN&view=azure-dotnet#overloads)屬性。 –
謝謝。我的問題意味着引用SDK的容量將.Contains轉換爲並行查詢,假設MaxDegreeOfParallelism設置正確(不是)。 – Trey