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
ahmed kishk 9ahmed kishk 9 

Apex Bulk Triggers

Hi,

Could anyone elaborate more about below point in APEX Developer Guide, I read it multiple times but I am not able to get it.

In API version 20.0 and earlier, if a Bulk API request causes a trigger to fire, each chunk of 200 records for the trigger to process is split into chunks of 100 records. In Salesforce API version 21.0 and later, no further splits of API chunks occur. If a Bulk API request causes a trigger to fire multiple times for chunks of 200 records, governor limits are reset between these trigger invocations for the same HTTP request.

Thanks.

 
Best Answer chosen by ahmed kishk 9
Raja Kumar PallepatiRaja Kumar Pallepati

Hello Ahmed, 

As per the Bulk API limits documentation, please refer the findings below.

Batch processing time
Batches are processed in chunks. 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. There’s a five-minute limit for processing each chunk. Also, if it takes longer than 10 minutes to process a whole batch, the Bulk API places the remainder of the batch back in the queue for later processing. If the Bulk API continues to exceed the 10-minute limit on subsequent attempts, the batch is placed back in the queue and reprocessed up to 10 times before the batch is permanently marked as failed.

As per Apex Governor limits documentation, static apex limit i.e. for loop batch size is 200.

If the apex trigger is fired by bulk api request, trigger process batch size is 100 records (v20.0 and earlier) and 200 records (v21.0 and later).

This is what my understanding based on the Bulk API limits and Apex governor limits official documentation. 

Thanks,

Raj

All Answers

Raja Kumar PallepatiRaja Kumar Pallepati

Hello Ahmed, 

As per the Bulk API limits documentation, please refer the findings below.

Batch processing time
Batches are processed in chunks. 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. There’s a five-minute limit for processing each chunk. Also, if it takes longer than 10 minutes to process a whole batch, the Bulk API places the remainder of the batch back in the queue for later processing. If the Bulk API continues to exceed the 10-minute limit on subsequent attempts, the batch is placed back in the queue and reprocessed up to 10 times before the batch is permanently marked as failed.

As per Apex Governor limits documentation, static apex limit i.e. for loop batch size is 200.

If the apex trigger is fired by bulk api request, trigger process batch size is 100 records (v20.0 and earlier) and 200 records (v21.0 and later).

This is what my understanding based on the Bulk API limits and Apex governor limits official documentation. 

Thanks,

Raj

This was selected as the best answer
ahmed kishk 9ahmed kishk 9
Thanks Raj, It is clear now.