I have a 2 part question:
First question . I know that when querying records for performance reasons, there is a limit of 5,000 records, but is there a limit when executing an aggregate query? If so, then what is it? I only need to request the number of records, and for one object I can get the result of 39,000 + records, but for another object I see an error message like:
System.ServiceModel.FaultException 1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: AggregateQueryRecordLimit exceeded. Cannot perform this operation. (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
I look around the world, but cannot find anything in the query sheet for aggregate / count queries.
Second question : Is there an easy way to query COUNT from a large number of records without a performance hit? I would not have thought that doing an account should require too much overhead. If there is a limit, my idea was to swap in a loop and just get a counter for a given page, while increasing the number of pages until 0 records were returned. However, when I tried this, it seems to ignore the attributes pageand the countsource tag <Fetch>.
I am wondering if there is a better / easier way to do this?
source
share