+ Start a Discussion

Time range for a record to spawn its own Trigger execution

I am adding functionality into a trigger on an object which has many concurrant users; think Case or Opportunity.  There is a particular governor limit that I need to handle.


I want to know the time range that is used to determine if an updated record is to be added into an existing trigger execution or gets a new trigger.


Obviously if no trigger is currently executing the update will go in its own trigger; but how long does the trigger wait to look for other records to include in it before it begins executing?


If I have each one hundered users click save on a different record one second apart, how many trigger executions will I see?  

  • 100?  (Each save gets its own trigger event, one trigger every <= 1 second)
  • 50? (every 2 seconds a new trigger execution begins)
  • 20? (every 5 seconds a new trigger execution begins) 


I want this information in order to plan use scalability, this might not be much of an issue if we have just 100 users, but what about 2000?  50,000?


Hi fgward_1,

My guess would be 100.

I am pretty sure that each update call will be carried out in its own transaction. Unless Salesforce do some amazing magic behind the scenes (which is unlikly in this case).


You realy shouldn't need to worry about number of users effecting this. I think the only limits you need to be worried about in your trigger are those where multiple update a fired in a single transaction (such as dataload). This is why you are always advised to bulkify your trigger code.


I hope this helps!


Additional thought: If you call a future method from your trigger, there used to be a limit on howmany future calls you can make per 24 hours or some odd calculation if you have a large number of users. So if you use a future method from your trigger this may be worth investigating further.