Types of Governor Limits
Let’s get a quick overview of the different types of Governors’ limits available within Salesforce.
1. Per-Transaction Apex Limits
Per-Transaction Apex Limits count for each Apex transaction.
Description |
Synchronous Limit |
Asynchronous Limit |
Total number of SOQL queries issued |
100 |
200 |
Total number of records retrieved by SOQL queries |
50,000 |
|
Total number of records retrieved by Database.getQueryLocator() |
10,000 |
|
Total number of SOSL queries issued |
20 |
|
Total number of records retrieved by a single SOSL query |
2,000 |
|
Total number of DML statements issued |
150 |
|
Total number of records processed as a result of DML statements, Approval.process, or database.emptyRecycleBin |
10,000 |
|
Total stack depth for any Apex invocation that recursively fires triggers due to insert, update, or delete statements |
16 |
|
Total number of callouts (HTTP requests or Web services calls) in a transaction |
100 |
|
Maximum timeout for all callouts (HTTP requests or Web services calls) in a transaction |
120 Seconds |
|
Total number of sendEmail methods allowed |
10 |
2. Per-Transaction Certified Managed Package Limits
Per-Transaction Certified Managed Package have passed the security review for AppExchange and get their own set of limits for most per-transaction limits.
Description |
Cumulative Cross-Namespace Limit |
Total number of SOQL queries issued |
1,100 |
Total number of SOSL queries issued |
220 |
Total number of DML statements issued |
1,650 |
3. Force.com Platform Apex Limits
Force.com Platform Apex Limits aren’t specific to an Apex transaction and are enforced by the Force.com platform.
Description |
Limit |
Maximum number of Apex classes scheduled concurrently |
100 |
Maximum number of batch Apex jobs in the Apex flex queue that are inHolding status |
100 |
Maximum number of batch Apex jobs queued or active concurrently |
5 |
Maximum number of batch Apex job start method concurrent executions |
1 |
Maximum number of batch jobs that can be submitted in a running test |
5 |
4. Static Apex Limits
Let’s get a quick overview of different types of static Apex limits available within the Salesforce.
Description |
Limit |
Default timeout of callouts (HTTP requests or Web services calls) in a transaction |
120 seconds |
Maximum SOQL query run time before Salesforce cancels the transaction |
120 seconds |
Maximum number of class and trigger code units in a deployment of Apex |
5,000 |
For loop list batch size |
200 |
5. Size-Specific Apex Limits
Size-Specific Apex Limits are the limits put on the length of code.
Description |
Limit |
Maximum number of characters for a class |
1 million |
Maximum number of characters for a trigger |
1 million |
Method size limit |
65,535 bytecode instructions in compiled form |
Maximum amount of code used by all Apex code in an organization |
6 MB |
6. Miscellaneous Apex Limits
Developers receive an error message when a non-selective query in a trigger executes against an object that contains more than 200,000 records and the maximum number of records that an event report returns for a user who is not a system administrator is 20,000. The limit is 100,000 for system administrators.