You need to sign in to do that
Don't have an account?
moverdorf
Handling Large Queries Of > 50,000 in Apex Batch...
I have an Apex Batch job that I use to load a huge transaction file... And the code is running fine.
But what I want to know is, from within the Batch Apex class, if I have objects I need to query that may result in > 50,000 rows coming
back what is the best practice for handling this.
I was hoping I could use the Database.QueryLocator because I know they don't have the 50,000 limit
and was thinking I could do something like this mapping:
Database.QueryLocator qlSSN = Database.getQueryLocator([SELECT Id,payout__SSN__c FROM Account]);
for(Database.QueryLocator a : qlSSN)
{
mSSNKey.put(a.id,a.payout__SSN__c);
}
But this is not a valid approach. So how in Apex Batch, can you bring back a query that may be > 50,000.
Again, I am not talking about the DRIVER Apex Batch query being > 50,000 I am talking abount querying another Object from within the pocessing of the batch that may return over 50,000.
Thanks everyone.
But what I want to know is, from within the Batch Apex class, if I have objects I need to query that may result in > 50,000 rows coming
back what is the best practice for handling this.
I was hoping I could use the Database.QueryLocator because I know they don't have the 50,000 limit
and was thinking I could do something like this mapping:
Database.QueryLocator qlSSN = Database.getQueryLocator([SELECT Id,payout__SSN__c FROM Account]);
for(Database.QueryLocator a : qlSSN)
{
mSSNKey.put(a.id,a.payout__SSN__c);
}
But this is not a valid approach. So how in Apex Batch, can you bring back a query that may be > 50,000.
Again, I am not talking about the DRIVER Apex Batch query being > 50,000 I am talking abount querying another Object from within the pocessing of the batch that may return over 50,000.
Thanks everyone.
When salesforce execute individual batch then the governal limits are enforced for the batch. for driver of the batch you can get >50k records, but not inside the batch. The limit is up to 50k when you are in the batch.
Regards,
Vivek Patel.
Please like or mark this as best answer if this answers your query to help others find better answers and improve the quality of the developer forum.