function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rahul Rana 32Rahul Rana 32 

scenarios where we would want to keep the batch size as 1.

Hi Everyone,

I want to know the scenarios where we would want to keep the batch size lowest as poosible, maybe even 1. 

Thanks in advance!
Abhishek BansalAbhishek Bansal
Hi Rahul,

Batch Size 1 can be kept under the folllowing conditions:
  1. When you want to make sure that if the batch fails only those record are failed where this an exception and other should pass. For Eg: If you have batch size as 50, if any one record is failed than all the other 49 in this batch will be failed with same error.
  2. If you think that updating more records in a single batch can hit a Salesforce limit due to the more number of DMLs or SOQL in the backend so in this case also you need to use a batch with size of 1.
There might be some other conditions as well, but these are the important one's.

Thanks,
Abhishek Bansal.