I was investigating Batch Apex recently. I been little confused by Salesforce document about QueryLocator limit.
In "Execution Governors and Limits", it said: "Total number of records retrieved by Database.getQueryLocator 10,000".
But in "Using Batch Apex", it said: " For example, a batch Apex job for the Account object can return a QueryLocator for all account records (up to 50 million records) in an org.".
I have no idea which description is correct.
So I want to ask if I code like follow, and my org have 30,000 account, how many account record return from getQueryLocator, 30000 or 10000? If 10000, how to change code to let it return 30000 records?
My Sample Code
public class BatchAccountProccess implements Database.Batchable<sObject> {
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator([SELECT ID,Name,Type FROM Account]);
}
public void execute(Database.BatchableContext bc, List<Account> records) {
// do my own process
}
public void finish(Database.BatchableContext bc) {
// send email.
}
}