+ Start a Discussion
dkorba2k5dkorba2k5 

SOQL and Too Many Query Rows

With the 10000 record limit on SOQL queries, is that per SOQL call in an Apex class or is it the sum of all calls in that class?  So if I had 5 queries, the total of those 5 must not exceed 10k?

Also, if all I'm doing is an SOQL count() .. how can I count all the records if it exceeds 10k?  Example please.  Thanks.
mtbclimbermtbclimber
There are different limits depending on the context of the entry point of the request. Check out the documentation for a more detailed explanation and breakdown.

Yes, if you had 5 queries and each returned 2001 results you would exceed the limit by 5 rows.

Currently SOQL Count() is treated no differently which means you can not get a count on a given statement when the result set exceeds 10k.
rohit.mehtarohit.mehta
Is the query limit for records returned 1,000 or 10,000?

My entry point is a trigger and I am doing something like this

Code:
for (List<Lead> tmp :[select Id, isConverted from lead where partneraccountid = :acc.Id])

This gives me an exception if the total number of rows exceeds 1000. This is also what the documentation says...but your post gives the idea that the limit is 10000.

Could you clarify?

Thanks,
Rohit




mtbclimbermtbclimber
The documentation for Web Service/Visualforce Controller context is not correct. This limit for that context is 10k.


Message Edited by mtbclimber on 11-16-2008 01:43 PM
Cool_DevloperCool_Devloper

Hi Friends,

 

Going through the facts mentioned here, it seems that the limit of 10000 query rows when the entry point is an APEX class is applicable to the total cumulative count of all the queries which are a part of that class.

 

Just want to confirm if my understanding here is correct. Because till now my understanding was that it is applicable to each individual query!!

 

Thanks a ton!!

Cool_D