I've got a 2 part question:
First question: I know that there is a query limit of 5,000 records when querying records, for performance reasons, but is there a limit when doing an aggregate query? If so, what is it? I need only to query the number of records and for one entity I can get a result of 39,000+ records, but for another entity 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've been looking all over online but can't find anything on a query limit for aggregate/count queries.
Second question: Is there a simple way to query the COUNT of a large amount of records without a performance hit? I wouldn't think doing a count should require too much overhead. If there IS a limit, my idea was to implement paging in a loop and just retrieve the count for a given page while incrementing the page number each time until 0 records was returned. However, when I tried this, it seems to ignore the page
and count
attributes of the initial <Fetch>
tag.
I'm wondering if there is a better/easier way to do this?