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
maxoutmaxout 

limit of 10000 query rows in APEX class

Got this at line 1 of my apex class from the problem list:

System.LimitException: Too many query locator rows: 10001

 

Had try to update a previous version with just comments, but still got the same error. 

The previous version was just sucessfully saved to server.

The location reported is not inside the class, like a SOQL. Any idea?

 

Have not begun to test yet before looking around.  Cheeers

 

 

Related:

http://boards.developerforce.com/t5/Apex-Code-Development/Question-regarding-limit-of-10000-query-rows-in-APEX-class/m-p/278941#M48686

Best Answer chosen by Admin (Salesforce Developers) 
maxoutmaxout

Checked the test method:

 the batch apex is tested like common class instead of using Database.executeBatch as stated in the apex guide.

 

This be the reason fail.

 

Could anyone confirm(could be a discrete topic):

    if the system would refuse  updating one class if any other class fails the test?

All Answers

Ankit AroraAnkit Arora

 

 

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

maxoutmaxout

Thanks.

 

The class version is 15. Related page version is 20.

The error message itself is clear. The type is force.com run test failure.

What is concerned is how this message was generated.

     The class was updated the day before normally through IDE.

     But It couldn't the day after with this message, even just changing the comments.

     There is no loop or large resultset SOQL, but both SOQLs with limit 1000 and SOQLs with ID filter (limit 1 except 1 didn't).

     The line location isn't helpful. Could it be from test code ?

     Could the trigger/reason be an update of the system, which was not sure.

 

The choice is not spending extra time on old version. But changing to all version 20 still have the same error?

 

The local class file changed slightly to have at least 75% test cover(mostly test code), save and run test.

Debug text:

11:48:38.109|CUMULATIVE_LIMIT_USAGE
11:48:38.109|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 8 out of 100
  Number of query rows: 9 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 20 out of 150
  Number of DML rows: 20 out of 10000
  Number of script statements: 583 out of 200000
  Maximum heap size: 0 out of 3000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

11:48:38.109|CUMULATIVE_LIMIT_USAGE_END

 

It is the last block of statistics, even less than the limit set by previous version.

 

About changing class version, I found:

 

maxoutmaxout

God! Finally found in run-test result, there is another class failed the test with the same error, but my test is successful with 80% coverage.

But that class isn't in my IDE project, that's someone else in the same application.

Is this refusing me from updating my own class?

Could anyone confirm this before starting a check for the error class?  Is there a doc ref?

 

maxoutmaxout

Further, the error line in that class is:

 return Database.getQueryLocator(strQuery);
where strQuery is a simple query (SELECT).

According to Apex Code Developer's Guide: 'If you use a QueryLocator object, the governor limit for the total number of records retrieved by SOQL queries is bypassed.'

 Got stuck!!?

 

maxoutmaxout

Checked the test method:

 the batch apex is tested like common class instead of using Database.executeBatch as stated in the apex guide.

 

This be the reason fail.

 

Could anyone confirm(could be a discrete topic):

    if the system would refuse  updating one class if any other class fails the test?

This was selected as the best answer
docbilldocbill

If you are using a query locator, then the that limit applies.  Unfortunately when the limit on query rows was raised, the limit on query locator rows was not.   So now days there is the pain that even though it is much quicker to use a query locator, if you need to scan more than 10000 rows, you have to use the slower more resource wasting method instead.

 

About the only trick I found around this limit is to call back into my controller repeatedly, which works well when salesforce responds in a reasonable amount of time.

 

Bill

 

 

 

jojoforcejojoforce

Hi... How do you check if the apex is using the new version? I checked mine and its 23 which is the highest. However, it still does not let me go over 10,000. Is it really possible to do 50,000? Thanks

Ankit AroraAnkit Arora

If you want to check the version of the class then you can click on Setup > App Setup > Develop > Apex Classes > Click on any class > Click on version settings

 

Yes, 23 is the highest version you can select for now.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page