According to Salesforce documentation for Apex Batch jobs, it is possible to query 50 million records by using Database.QueryLocator in the start method. Is there any limitation on the number of chunks of data? In other words, if the limit of rows is 50 million, Can I divide the data to be processed to 50 million chunks?
2 Answers
The chunk size depends on the API version. In API version 20.0 and earlier, the chunk size is 100 records. In API version 21.0 and later, the chunk size is 200 records.
-
How many chunks can I create? is that n number of chunks? or there is a limit. And with a limit, I do not mean the batch size but the number of chunks(baches) that can be created. I do not think that there are limits on the number of chunks but I want to make sure. Commented Feb 19, 2018 at 11:07
-
-
by chunks, I do not mean the number of the records in each batch transaction, I mean the number of "chunks" that can be used to divide the whole data. For instance, if I need to process 10000 records I can use a batch and process everything in transactions of 5 chunks where every chunk has a size of 2000. My question is if there is a limitation on the number of chunks. Commented Feb 19, 2018 at 11:13
-
I think we have only limit is number of batches per day.This limit is 2000 batches per 24 hour .(On rolling basis) Commented Feb 19, 2018 at 11:15
I couldn't add a comment, so i'll just add it as an answer.
I think what you mean is scope and not chunks, which specifies the number of records to pass into the execute method, which is between 1 & 2000.
there is actually another Limitation, i would recommend you to check the Governor Limits