You need to sign in to do that
Don't have an account?
edralph
Is trigger execution single threaded?
Quick question: I have a before update trigger on the Lead object and would like to know what happens in this scenario:
1. Bulk data import of leads (let's say 1000) cause it to fire. It'll fire 5 times if the batch size is 200.
2. During the processing of one of the batches of 200 above, a web service pushes a Lead into the system, firing the same trigger.
Will the trigger in 2 wait for one of the batches of 200 to finish before executing or will it run while the (same) trigger in 1 is halfway through processing a batch of leads?
1. Bulk data import of leads (let's say 1000) cause it to fire. It'll fire 5 times if the batch size is 200.
2. During the processing of one of the batches of 200 above, a web service pushes a Lead into the system, firing the same trigger.
Will the trigger in 2 wait for one of the batches of 200 to finish before executing or will it run while the (same) trigger in 1 is halfway through processing a batch of leads?
There are chances of both the batches running concurrntly as Up to 5 batch jobs can be queued or active concurrently. About the first question, since both the triggers are from seperate contexts definitely trigger 2 will be fired and it won't wait for 1 to finish.
All Answers
If you Enabled the Bulk API option on the data loader then it will process records asynchronously.
two asynchronously batches may execute the same time on same data and you need to lock the records to avoid unable to lock the data
There are chances of both the batches running concurrntly as Up to 5 batch jobs can be queued or active concurrently. About the first question, since both the triggers are from seperate contexts definitely trigger 2 will be fired and it won't wait for 1 to finish.