Minimize Request Units (RUs) consumption on CosmosStore pageable query method
Currently, using the existing synchronous CosmosClient in a CosmosStore#queryItemsPage method, a certain number of extra (prefetch) queries are performed when retrieve records from the database page by page. For example, when we retrieve 5000 records at 1000 records per page, the total number of queries that will be executed on the database will be 15 (not 5 as we expect). Increasing the number of records we will have the following number of queries:
- 10000 records at 1000 records per page -> 45 requests (35 requests are unnecessary)
- 20000 records at 1000 records per page -> 105 requests (85 requests are unnecessary)
This increases the consumption of Cosmos DB Requests Units.
To prevent extra (prefetch) queries, we need to add an asynchronous client and an appropriate method for retrieving records from the database using this asynchronous client. This solution to the problem was proposed in the course of e-mail correspondence with the Microsoft Azure team.