Too many query locator rows 10001 error salesforce

Telegram logo Join our Telegram Channel

Too many query locator rows: 10001 

This error occurs when you are using a queryLocator to query the records from Salesforce. As per the apex governor limit documentation, the number of records returned by the queryLocator should not exceed 10000.

Too-many-query-locator-error-apex


What is the solution?

You need to add the limit of 1000 to your query.
Database.getQueryLocator([SELECT Id FROM Account limit 10000]);
Now the query will limit the records up to 10000, so you won't get the error.


What is queryLocator?

Querylocator is a set of records returned by a database that you can iterate using QueryLocatorIterator.


Resources


No comments :
Post a Comment

Hi there, comments on this site are moderated, you might need to wait until your comment is published. Spam and promotions will be deleted. Sorry for the inconvenience but we have moderated the comments for the safety of this website users. If you have any concern, or if you are not able to comment for some reason, email us at rahul@forcetrails.com