Development questions

What is the governor limit for Aggregate queries and how do rows counted in AggregateResult contribute to the 50,000-row limit?

DevelopmentMediumDeloittePwCCognizant

Aggregate queries still count toward the shared 50,000 total retrieved rows limit: the rows returned as AggregateResult objects (one per group) are counted. Also, aggregate queries can be costly because Salesforce scans the underlying records, and very large scans can time out.

Tips: add selective filters, use LIMIT, and verify consumption with Limits.getQueryRows() before and after the query in a debug test.

soqlaggregategovernor-limits