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

Is Batch apex execution time based on batch size

Hello All,

I want to process 1Lakh records by using batch class and intially I used default batch size to 200 but am getting some code issues 'System.ListException: Before Insert or Upsert list must not have two identically equal elements'..etc. If i restrict the batch size to '1' it is working fine.

 would like to know the batch execution time is depends on the batch size? If yes, please share the links if you have any!
batchprocessid = Database.executeBatch(batchclass,200); //Execution time
batchprocessid = Database.executeBatch(batchclass,1);     //Execution time

Satyendra RawatSatyendra Rawat
problem is that when you execute the 200 records at that time you perform the dml opration on the record 
Like insert lstRecord; or update lstRecord or upsert lstRecords,
in the above list have duplicate record for perform DML.
same record adding two time in the list.
So make sure your code and review it.