What Are Salesforce Governor Limits
Salesforce ensures the effective use of resources on a multi-tenant platform that is Force.com through Salesforce Governor Limits. Salesforce has set certain limits for the effective execution of the code.
The governor limits have been imposed to ensure that resources are not acquired by users other than authenticated ones. Since Force.com by Salesforce is multi-tenants that means that all customers share a single resource. So it’s mandatory to implement certain restrictions to avoid code misuse.
Types of Salesforce Governor Limits
There are various types of Salesforce governor limits for different security levels and other metrics related to code.
These types are listed below:
Per-transaction Certified Managed Package Limits
This type is relevant when the AppExchange checks have been cleared for the majority of transaction limits. The Certified Managed Package is developed by ISV partners and installation is done from AppExchange with a unique namespace. Other details include :
Factor | Limits |
Total SOQL queries issued | 1100 |
Total retrieved records by Database.getQueryLocator | 110000 |
Number of SOSL queries issued | 220 |
Total DML statements issued | 1650 |
Total Callouts in a transaction | 1100 |
Toal sendEmail methods allowed | 110 |
Don't forget to check out: Apex Integration in Salesforce - The Developer Guide
Static Apex Limits
The governor limits by Salesforce has different limits for each Apex description. The limits included in static apex comprise different types of callouts, loops, queries, batch sizes, and transactions. The limit details for each type are mentioned below :
Description | Limits |
The default timeout for transaction callouts | 10 seconds |
Max. size of callout request or response | 6MB (Synchronous) 12 MB ( Asynchronous) |
SOQL query runtime before cancellation of a transaction | 120 seconds |
Max. number of class and trigger units of code | 5000 |
Trigger batch size for Apex | 200 |
Size of loop list batch | 200 |
Batch Apex query returned records in Database.QueryLocator | 50 million |
Per-transaction Apex Limits
These limitations are designed for counting all Apex transactions. The limits for both synchronous and asynchronous Apex are mentioned below:
Factor | Synchronous Limit | Asynchronous Limit |
Total SOQL queries issued | 100 | 200 |
Total records retrieved by SOQL queries | 50,000 | |
Total records retrieved by Database.getQueryLocator | 10,000 | |
Total SOSL queries issued | 20 | |
Records retrieved by a single SOSL query | 20,000 | |
Toal DML statements issued | 150 | |
Total records processed by DML statements | 10,000 | |
Stack depth for Apex invocation | 16 | |
Total callots in a transaction | 100 | |
Methods allowed per Apex invocation | 50 | 0 in batch & future contexts, 1 in queueable context |
Number of Apex jobs added | 50 | 1 |
Toal sendEmail methods allowed | 10 | |
Total heap size | 6 MB | 12 MB |
Max. CPU time on Salesforce servers | 10,000 milliseconds | 60,000 milliseconds |
Execution time for Apex transaction | 10 minutes | |
Max. push notifications per Apex transaction | 10 | |
Max push notifications send through each push notification method call | 2000 |
Check out another amazing blog by SP Tech here: How Salesforce CRM better than other CRM?
Lightning Platform Apex Limits
The lightning platform is responsible for the handling of the following limits:
Description | Limits |
The maximum amount of asynchronous method executions per day | 25,000 |
Parallelly scheduled apex classes | 100 |
Queued Apex jobs | 5 |
Max. batches submitted | 5 |
Parallelly opened query cursors/user | 50 |
Parallelly opened query cursors/user | 15 |
Size-specific Apex Limits
This type serves the purpose of keeping a check on outsized items in classes. The limitations for size-specific elements include:
Description | Limits |
The maximum amount of characters/ class | 1 mn |
The maximum amount of triggers/ class | 1 Million |
Apex maximum code utilization | 6 MB |
Limit for method size | 65,535 |
Reference: SP Tech
Responses