You need to sign in to do that
Don't have an account?

Silly question. Maximum records to be processed by a trigger is?
Its early and my espresso has not yet kicked in, so forgive me this rudimentary question.
What is the maximum number of records that a trigger will process at once? Assuming some sort of bulk update, what is the most I can expect to see in the Trigger.new list?
Trying to code around some potential governor limit issues.
I am not going for any documentation right away, hope I will clear this on my own.
Trigger will be called when you perform any action on object record. Lets say I want to insert 50,000 records. I have a trigger in which some logic is written (may be some validations etc..).
Now there are different ways to insert records. I will go with data loader first. When I am inserting record with data loader then it insert the record in packets of 200 at a time. Means my trigger will be processing not more than 200 records.
Same case applies with batch class - maximum batch size can be 200. So here also my trigger will process not more than 200 records.
Now another way is to write an apex class which will insert records. As I have already mentioned that only 10,000 records will be processed at a time. So in this case my trigger will not be processing more than 10,000 records.
This flow is designed in a very smart way, that is why I love salesforce.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
All Answers
Per my knowledge you can process (apply DML action) on 10,000 records at a time, no matter it is in trigger or apex class.
One more important point to remember :
If you use a non-selective query in a trigger against an object that contains more than 100000 records an error is generated. You should include indexed fields in the WHERE clause to avoid these exceptions.
You can find all limits here :
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
Thanks
Ankit Arora
Blog | Facebook | Blog Page
I am not going for any documentation right away, hope I will clear this on my own.
Trigger will be called when you perform any action on object record. Lets say I want to insert 50,000 records. I have a trigger in which some logic is written (may be some validations etc..).
Now there are different ways to insert records. I will go with data loader first. When I am inserting record with data loader then it insert the record in packets of 200 at a time. Means my trigger will be processing not more than 200 records.
Same case applies with batch class - maximum batch size can be 200. So here also my trigger will process not more than 200 records.
Now another way is to write an apex class which will insert records. As I have already mentioned that only 10,000 records will be processed at a time. So in this case my trigger will not be processing more than 10,000 records.
This flow is designed in a very smart way, that is why I love salesforce.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
I think even when using bulk load with 10,000 record, which is the max for now, still Salesfroce processes only 200 at a time, so the tigger.size will not be greater than 200.
"Triggers execute on batches of 200 records at a time. So if 400 records cause a trigger to fire, the trigger fires twice, once for each 200 records."
So it's never more than 200 records at a time. You're correct @tauhaka.