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
micwamicwa 

System.Exception: Too many query rows: 501

I have a webservice method that makes a count soql statement and and an other query.

 

Altough I limit all the queries by 100, I get an exception. Sometimes even on the count statement where rows shouldn't matter.

 

Here is part of the debug log:

 

: Query result size: 100

: All records size: 101

 

System.Exception: Too many query rows: 501

 

Any ideas why this happens?

aalbertaalbert
When using count() in a soql query, the # of rows retrieved still count against the limit of # of records that can be queried in the apex code.