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

how is script statement governor enforced for batch apex?

i'm trying to understand how the script statement limit governor is enforced for batch apex.  the governor limits as described in sf are 200k statements and 1M statements for batch apex and future methods.


my question is whether the 1M statements for batch apex applies to the total statements processed for all batches/transcations or applies separately to each batch/transaction.


so, if i have 20 batches and each batch processes 100k statements, is that going to count as 100k and never trip the limit or 2M statements and trip the limit?

Best Answer chosen by Admin (Salesforce Developers) 

The 1M statements is for each separate batch in your overarching batch job. 


So if you have a job with 20 batches, each one of those batches will get its own set of 1M script statements (or essentially 20M statements)


let me know if you have any other questions.