function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fcomdeveloperfcomdeveloper 

Overcome governor limits in aggregate SOQL queries

How can we overcome governor limits in aggregate SOQL queries

Starz26Starz26

You can't

 

all you can do is optimize your queries using where conditions.

 

You can increase the limits by using batch apex

LinvioIncLinvioInc

it's even worse if you are using GROUP BY or GROUP BY ROLLUP.  These aggregate query types do not support filtering with a WHERE clause. And HAVING filters can only include filtering on he value of the aggregate function (not on field values), so the number of rows included in the query can easily exceed governor limits.

 

Also, GROUP BY and GROUP BY ROLLUP do not support QueryMore(), which I believe is employed by the batch apex engine, so there are problems there as well.

 

Please vote on this Idea to raise awareness of this problem:  https://sites.secure.force.com/success/ideaView?id=08730000000hRqKAAU

 

Thanks,

Ron