You need to sign in to do that
Don't have an account?
krishna casukhela 7
batch size in batch apex
Hello friends
I have a doubt in batch apex.
I know by default batch size =200.
a)can we change the batch size? if yes where do we change it. assume I want to make it 400
b) if I have to process 1Lakh records for a particular object using Batch apex, how many times will the methods (START , EXECUTE , FINISH)
be called?
Thanks
Krishna
I have a doubt in batch apex.
I know by default batch size =200.
a)can we change the batch size? if yes where do we change it. assume I want to make it 400
b) if I have to process 1Lakh records for a particular object using Batch apex, how many times will the methods (START , EXECUTE , FINISH)
be called?
Thanks
Krishna
The default batch size is 200 and the maximum batch size is 2000.
Database.executeBatch(new RunThisBatch(), 500);
You can set batch size like above. 500 is the batch size in the above syntax.
Start method is called only once.
Excute method is called depends on the batch size and number of records. Let say, 1000 records, then excute method called 2 times.
Finish method called only once, after the excute finished.
All Answers
The default batch size is 200 and the maximum batch size is 2000.
Database.executeBatch(new RunThisBatch(), 500);
You can set batch size like above. 500 is the batch size in the above syntax.
Start method is called only once.
Excute method is called depends on the batch size and number of records. Let say, 1000 records, then excute method called 2 times.
Finish method called only once, after the excute finished.
This may be late comment on this topic. But if you can answer I have one question. How the batch class decides the batch of records to be processed i.e.,how it identifies first 500records for processing and after processing 1st batch how it gets records for next batch..!? Is it decided in start method or execute method ?
If the batch size is 500, then 500 records will move to execute method from start in the first batch. Since its a descrete transaction process.