Reputation: 143
I have a SQL API Cosmos DB collection with the id and partition key both equal to /id
.
Given a list of IDs, I need to fetch all those documents. When using the .NET SDK (v3.25), which of the below Container class methods is recommended to get the lowest latency:
ReadItemAsync
to read all documents.ReadManyItemsAsync
to read all the documents.GetItemQueryIterator
with a SQL query of the form SELECT * FROM c where c.id in ('id-1', 'id-2', ...)
.Upvotes: 2
Views: 1597
Reputation: 222722
If you want to retrieve large group of individual items, the most efficient way is to use ReadManyItemsAsync() rather than invoking ReadItemAsync() many times/Parallel.
Upvotes: 5