+ 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.