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
EtienneCoutantEtienneCoutant 

Governor Limits on Triggers

Hi,

From what I have understood about Governors, the limit is 20 Queries and 20 DML Statements for a trigger.
However, I am really wondering if this is for ONE trigger, or for all the triggers executed at the same time.

I have 2 triggers on 2 different objects, and each of them is executing 15 queries. When ran separately, it works perfectly, but it happens that those 2 triggers are executed at the same time. In that case I get an error 'too many queries: 21'. My guess is that the system is counting 15 + 15 = 30 queries, which is obviously over the limits...

Does someone know the answer?
thanks a lot!!!
tmatthiesentmatthiesen
The limits are for the entire request.  If both triggers are pulled into the request - the corresponding queries will be aggregated against the trigger context limit.  I would recommend refactoring your triggers – especially with regards to your soql queries.  Take a look at the following blog entry for “bulkifying” requests:

http://sfdc.arrowpointe.com/2008/09/13/bulkifying-a-trigger-an-example/
EtienneCoutantEtienneCoutant
Hi.

Thanks a lot for your answer. I am really curious to know more about those requests. Do you know more about that? How is the request built? How 2 triggers end up in the same request?

Best,
Etienne