Established Salesforce Governor Limits
Salesforce governor limits are implemented in the following key areas.
Key Area |
Limit |
---|---|
Apex CPU Timeout |
Salesforce has a timeout limit for transactions based on the CPU usage. If a transaction consumes too much CPU time, Salesforce ends it as a long-running transaction. The timeout is set to a maximum of 10 to 15 seconds for each transaction. |
Heap Size |
The Apex heap size too large error occurs when too much data is being stored in memory during processing. This is the amount of memory allocated to objects defined in the Apex Code. The limit depends on the type of execution (for example, synchronous and asynchronous calls). Salesforce has set a limit of 6 MB for synchronous transactions and 12 MB for asynchronous transactions. |
View State |
The view state of a web page is composed of the data that is necessary to maintain the state during a server request. Salesforce has set this limit to 170 KB. |
Salesforce Object Query Language (SOQL) |
There is a limit to the number of records that can be retrieved or updated by a SOQL or data manipulation language (DML) query. Salesforce displays an error when this limit is exceeded. Salesforce has set the maximum number of records that can be returned in a single query to 50000. |
The following table lists the limits for synchronous Apex and asynchronous Apex (Batch Apex and @future methods) when they are different. Otherwise, this table lists only one limit that applies to both synchronous and asynchronous Apex.
Description |
Synchronous Limit |
Asynchronous Limit |
---|---|---|
Total number of SOQL queries issued |
100 |
200 |
Total number of records retrieved by SOQL queries |
50000 |
|
Total number of records retrieved by Database.getQueryLocator |
10000 |
|
Total number of SOSL queries issued |
20 |
|
Total number of records retrieved by a single SOSL query |
2000 |
|
Total number of DML statements issued |
150 |
|
Total number of records processed as a result of DML statements,Approval.process, or database.emptyRecycleBin |
10000 |
|
Total stack depth for any Apex invocation that recursively initiates triggers due to insert, update, or delete statements |
16 |
|
Total number of callouts (HTTP requests or web services calls) in a transaction |
100 |
|
Maximum cumulative timeout for all callouts (HTTP requests or web services calls) in a transaction |
120 seconds |
|
Maximum number of methods with the @future annotation allowed for each Apex invocation |
50 |
0 in batch and future contexts; 1 in queueable context |
Maximum number of Apex jobs added to the queue with System.enqueueJob |
50 |
1 |
Total number of send email methods allowed |
10 |
|
Total heap size |
6 MB |
12 MB |
Maximum CPU time on the Salesforce servers |
10000 milliseconds |
60000 milliseconds |
Maximum execution time for each Apex transaction |
10 minutes |
|
Maximum number of push notification method calls allowed for each Apex transaction |
10 |
|
Maximum number of push notifications that can be sent in each push notification method call |
2000 |
For more information on Execution Governors and Limits, refer to https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm.
For more information on Salesforce Developer Limits and Allocations Quick Reference, refer to https://resources.docs.salesforce.com/220/latest/en-us/sfdc/pdf/salesforce_app_limits_cheatsheet.pdf.