+ Start a Discussion
md inayatmd inayat 

Apex triggers1

How Many records can a trigger hold at a time?
Prajyot KerkarPrajyot Kerkar
sagarika bsagarika b
Hi md inayat,

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 400 but the default size is 200. So here also my trigger will process not more than 400 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.

I hope it will helpful to you



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.

Thank you
md inayatmd inayat
for instance , lets say i am not inserting the records from data loader rather i want to update 400 records which are already available in the database  on which the trigger has to fire , in this situation how does the trigger takes the records , if it takes 200 records at a time , will it follow any sequence means for which 200 records among 400 , the trigger fires?

Thanks in Advance.