The majority of you be aware that Salesforce is a multitenant system shared by a myriad of companies and users around the world. Like any other environment, the resources of Salesforce aren’t endless.
It’s not surprising that there are often issues when it comes to sharing and using these resources effectively. Since the system restricts the resources, it has set restrictions to ensure they’re not used too much and distributed fairly. This is precisely why Governor Limits are introduced into Salesforce. Learn Salesforce certification training online with an E-learning platform. Their Support Team will be available 24*7 to help you out.
This article will explain the Governor Limits currently in place for Salesforce and provide two tips for avoiding the limits.
A description of the Governor Limits within Salesforce: They are a set of regulations and rules that limit the monopolistic use of cloud resources by the particular organization making use of Salesforce services. Limitations (aka governors) hinder the misuse of resources (such as memory databases record processing, number of processed records and scripts, etc.) by imposing restrictions limiting code execution and Apex runtime. In simple terms, describing the purpose of the Governor Limits feature in Salesforce also implies that the code to be executed must be designed to work optimally for the use of resources.
If a limit on a governor exceeds or is violated, Salesforce reports an error and suspends the process that led to the error.
If you’ve experienced these limitations and caused disruptions to an SF Production Org, you may require your code’s APEX review and optimization. Use our Salesforce development support to implement the necessary changes.
Types of Governor Limits that can be found in Salesforce
The various Apex Governor Limits within Salesforce are
-
Per-Transaction Apex Limits (such limitations apply to each Apex transaction, but for Batch Apex instances, is that the limitations are changed)
-
Per-Transaction Certified Managed Limits for Packages (such limits apply to the packages that are installed in an organization with an identifier, the packages were designed with the help of SFDC Partners and completed the majority of the security checks for transaction limits conducted by AppExchange)
-
Force.com Lightning Platform Apex Limits (such restrictions will be enforced by the platform since they don’t apply in Apex payments)
-
Limits on static apex (restricts the loop or apex trigger size callout sizes and times and unit numbers for trigger codes and trigger code unit numbers)
-
Apex Limits for Size-Specific Apex (as clear from the title, these limits are employed to regulate the size of objects to ensure that no objects of the wrong size are utilized in classes).
Other restrictions are not Apex-related, some of which are:
-
Inbound Email Limits,
-
Limits of Push Notifications
-
Limits on Governors for Salesforce API Requests,
-
Chatter REST API LimitsChatter,
-
SOAP API Limits for Calls API
-
Limits on APIQuery Cursors
-
Metadata Limits,
-
SOQL as well as SOSL Governor Limits within Salesforce,
-
Visualforce Limits.
Synchronous vs. Asynchronous Execution
Apex Code can be executed in two ways. Apex program can be executed either synchronously or in an asynchronous fashion. In the first case method, the entire code runs simultaneously in one run. The code runs in the background in the second, as an independent thread step. Users don’t face waiting until the process is completed; another benefit of asynchronous execution includes more significant governor limitations.
These limitations affect both the way you design SF solutions and the way your code will be written. If the limitation is reached, an error will occur that interrupts the code’s normal execution. Contact our Salesforce experts to resolve the issue and improve the code to work within the limitations. Major Governor Limits for the Governor.
In this brief Salesforce Governor Limits cheat sheet we will review the most important limitations that every person should be aware of:
Overview |
Governor Limit |
The total amount of SOSL queries made in Salesforce |
20 |
DML Governor Limits are available in Salesforce (Total quantity of statements issued per transaction) |
150 |
The total number of records that can be retrieved in the single SOSL query |
2000 |
The total number of records were obtained through SOQL queries |
50000 |
Total number of records retrieved by Database.getQueryLocator |
10000 |
Salesforce Governor Limits on Heap size |
6 MB/12 6 MB/12 |
Per-Transaction Apex Limits
The limits shown in the following table will apply to every Apex transaction. In certain situations, the limits are different based on whether the transactions are synchronous or not; they are noted in distinct columns.
Limits for Managed Packages Certified Per-Transaction
As stated earlier, such limits are applied to third-party-developed packages installed from the AppExchange Certified packages that come with specific cross-namespace cross-namespace limits set, read more about them in the table below.
Overview |
Governor Limit |
SOQL queries issued (total number) |
1100 |
Records retrieved by Database.getQueryLocator (total number) |
110000 |
SOSL queries issued (total number) |
220 |
DML statements are issued (total number) |
1650 |
The Governor limits in Salesforce for the number of calls (HTTP calls or internet service calls) per transaction |
1100 |
SendEmail methods that are allowed (total number) |
110 |
Platform Apex Limits
The following limit for governors in the Salesforce list are those limits managed by Salesforce’s platform:
Overview |
Governor Limit |
Max. a number of Asynchronous Apex Method executions (these comprise the Batch Apex Governor Limits within Salesforce and future methods Queueable Apex as well as Scheduled Apex) for every 24 hours |
250,000 or the total number of user licenses for your organization multiplied by the number of user licenses in your org, which is the greater |
Amount of synchronous concurrent transactions that run for long periods of time (which are longer than 5 secs per time.) |
10, |
Max. a number of classes concurrently scheduled Apex classes |
100 (note that, for Developer Edition, the limit is 100). Developer Edition, the limit is 5) |
Max. quantity of “Holding” status batches Apex jobs that are part of an Apex Flex queue |
100 |
Max. quantity in batch Apex jobs that are queued or running simultaneously |
5 |
Max. quantity of batch Apex job start methods concurrent executions |
1 |
Max. amount of batch jobs that may be submitted to an ongoing test |
5, |
Max. quantity of classes which can be queued in the 24 hour period (not suitable for Developer Edition) |
The more than 100 or 500 multiplied by a total number of test classes that are in the organization, |
Max. amount of tests that can be queued in 24-hour time duration (sandbox or Developer Edition Orgs) |
The higher of 20 or 500 multiplied by the total number of test classes that are in the organization, |
Max. amount of queries that can be opened simultaneously per user |
50 |
Max. amount of queries opened concurrently for each user in the batch Apex start method |
15 |
Max. quantity of cursors that can be opened concurrently for each user using the batch Apex execution and finish methods |
5 |
Static Apex Limits
This table lists the additional restrictions regarding Apex callouts, queries and records and any time there is more than one transaction.
Overview |
Governor Limit |
The default timeout for the callouts (HTTP calls or web service calls) in an exchange |
10 sec. |
Max. size of the callout request and response (HTTP web service call) |
6 MB for the synchronous Apex 12 MB for an asynchronous Apex |
Max. SOQL query run time prior to cancellation of transaction by Salesforce |
120 sec. |
Max. a number of triggers and classes code units within Apex deployment |
5000 |
Size of the batch of Apex trigger |
200 |
The size of the loop for a batch |
200 |
Max. record number returned for a Batch Apex query in Database.QueryLocator |
50 000 000 |
Apex Limits for Size-Specific Apex
The limitations in the table below restrict the dimensions specified in Apex code, which includes numbers of characters as well as the size of the method.
Overview |
Governor Limit |
Max. a number of characters in class |
1 000 000 |
Max. a number of characters needed for trigger |
1 000 000 |
Max. quantity of code used by the entire Apex code within an org |
6 MB |
Limit of size for the method |
65,535 instructions for bytecode in format compiled |