Activity › Forums › Salesforce® Discussions › Limit of aggregate query in salesforce.
-
Limit of aggregate query in salesforce.
Posted by Prachi on September 12, 2018 at 5:31 AMWhat is the Limit of aggregate query in salesforce?
Avnish Yadav replied 7 years, 9 months ago 3 Members · 2 Replies -
2 Replies
-
Hi Prachi,
I think that the issue here is that an aggregate query is considered to have accessed every record included in the aggregation. Thus the 50000 row limit isn’t the number of records returned by the query, its the number of records ‘touched’. As you have a clause of ‘LIMIT 50000’, you are asking for a maximum of 50000 aggregates to be returned by the query and if any of these “touches” more than one record, you will exceed the limit.
Thanks.
- [adinserter block='9']
-
Hello,
Queries that include aggregate functions are still subject to the limit on total number of query rows i.e 50,000. All aggregate functions other than COUNT() or COUNT(fieldname) include each row used by the aggregation as a query row for the purposes of limit tracking.
For COUNT() or COUNT(fieldname) queries, limits are counted as one query row, unless the query contains a GROUP BY clause, in which case one query row per grouping is consumed.
Thnaks.
Log In to reply.