+ Start a Discussion

Governor Limits Documentation and meaning

When I run a visual Force controller with debug statements, I get the following entries from Limit Methods:

Limit Aggregate Queries 300 : Limits.getLimitAggregateQueries()
Limit DML Row 10000 : Limits.getLimitDMLRows()
Limit DML Statement 100 : Limits.getLimitDMLStatements()
Limit Queries 100: Limits.getLimitQueries()
Limit Queries Rows 10000: Limits.getLimitQueryRows()   ===> Table below says 1000
Limit Script Statements 200000 : Limits.getLimitScriptStatements() ===> Table below says 10,000

I am wondering about the following

  1. Is there an error in the documentation below as per what I am seeing above in debug statements? 
  2. Seems like when triggers are involked from a visualforce controller (due to DML statements), the visualforce limits still apply. What do the "trigger" column below limits apply?  Only when called from Salesforce UI? Or also when called from webservice client apps using binding.create() statements?
  3. I assume the batch concept is valid only for triggers - what does it mean when the † character is used on several rows in Webservice column e.g the Array Size (1000†)? It appears to me that the array size always remains 1000 when called from a visualforce/webservice - even if the array is used inside a trigger. 
  4. When does the "batch" concept below apply? For example, the documentation below says that if Array size is 1000 if number of records is less than 40. 2000 if between 40-80.  It would appear that when called from UI, there is usually only one record (unless lookup/child records are being updated). If 1 record is being updated through UI and 80 child records are being updated, is the limit 2000 or 1000? In the parent trigger or the child trigger? Perhaps the batch concept applies to binding.create calls....
  5. Seems like when "SOQL For Loops" are used, one can retrieve more than 1000 records. Is there a limit?
  6. "For Loop Array Batch Size" row says the batch size is 200 for web services, but "n/a" for Triggers. When SOQL for Loops are used in Triggers, what happens?
  7. I assume that "Trigger" really means all the triggers that are invoked - e.g if an insert trigger causes other trigger to execute, the total limits are across all triggers executed. I think I am right on that. Can someone confirm

Message Edited by GoForceGo on 05-17-2008 05:56 PM
Ron HessRon Hess
I'm only going to answer the ones i'm sure of.

1. yes, appears to be a doc bug, trust the Limits() methods

5. query rows limits will apply, 10,000, so 10 loops of 1000 each

7. Yes, that is my understanding.
Thanks Ron.

On #5, "SOQL for Loops" says that you can write an SOQL loop if you want to retrieve more than 1000 records, since assigning it to an array will limit query to 1000 records.


  for( Account a: [select id from Account]) {
  instead of:

  Accounts[] a_array = [select id from Account];
  for (Account a: a_array) {

What you are saying is that the max limit of accounts retrieved in #1 is 10,000...


Can someone from Salesforce who understands what the governor limits mean in this documentation respond and educate all of us?


I'm also very interested in exactly what the governor limits mean.  Although apparently either nobody at salesforce understands them or they just don't care to educate all of us :smileymad:  Did you ever get any clarification on these issues????