You need to sign in to do that
Don't have an account?
Too many query rows: 10001 but only 7400 objects
Hi all,
I have the following bit of code:
integer queryRowLimit = Limits.getLimitQueryRows(); if (queryRowLimit==500) { // if row limit is 500, it means we are in a test method. queryRowLimit=100; } for (List<Contract_Line_v2__c> cl2List : [select id from Contract_Line_v2__c limit :queryRowLimit]) { // do some stuff here }
When it runs I am getting a 'Too Many Query Rows: 10001' error. However, Apex Explorer tells me that there are only 7452 rows in that object.
Am I using the correct format for the SOQL for loop? I can't work out why it is returning 10000+ results.
Thanks,
Andy
Oops. It's not just that function. I have another query above it that also retrieves 7400 rows (which is necessary). If I remember correctly, the 10,000-row limit is per-class, correct?
I guess I'm going to have to rethink this one..
Andy;
Limits are per execution thread. Meaning that, if you execute something that calls 3 different classes and, each class fetches 5000 rows then you will be exceding the limit, it won't matter that this code is from 3 different classes.