issue with aggregates query

Category: azure documentdb


geetarman on Tue, 28 Feb 2017 10:11:35

If I try to execute the following query (using 1.12 of sdk)

select value count(1) from c

using the code

client.CreateDocumentQuery<dynamic>(dblink,"select value count(1) from c").ToList().First();

For small collections it is returning the correct number (26000 entries is the largest of these collections)

For a couple of large(r) collections it is taking a very long time to execute. These have about 5 million documents and havn't completed (well I havn't waited for the query to finish as yet - been running at least 30 minutes).  It has the symptoms that it is simply performing a read of the entire collections and counting (which is what we have had to do manually up this point). 

I can see in the Diagnostics tools trace a significant number of 'request rate is large' errors and retries.

Am I doing something wrong or misunderstanding this or is there an underlying issue?

Additional info

According to the documentation

When using the Azure Portal's Query Explorer, note that aggregation queries may return the partially aggregated results over a query page. The SDKs will produce a single cumulative value across all pages. +

In order to perform aggregation queries using code, you need .NET SDK 1.12.0, .NET Core SDK 1.1.0, or Java SDK 1.9.5 or above.

This doesn't appear to be true for me.  To get the right result I have had to do the following


Additionally, the query speed is vastly dependent on the throughput of the collection. Setting the collection to 10000 ru's I get a result back in 4 minutes which does indicate a read loop.



Govind on Fri, 10 Mar 2017 06:25:02

As shared this looks like issue in the system, we are investigating and will update on the fix.