Are you ready to discover the Salesforce Governor's limits? These governors' limits help us to assure the proper usage of available resources that are present in Force.com. The main purpose of using these limits is to maintain the codes effectively and manage the resources. To perform all these important tasks Salesforce.com has come up with some limits and they are known as Governor Limits in Salesforce. So in this blog, I am going to explain the importance of Governor Limits, its pros, and cons. Let's start to begin our journey with learning Salesforce Governor Limits;
The Salesforce Governor Limits are used to ensure that no one acquired resources from other sources; So Force.com sets major restrictions to limit the code execution. The main aim of developing these limits is to support multi-tenant architecture, where multiple organizations and customers share the same resource. Suppose if any of this governor limit does not meet the requirement, then an error will be raised and the program will halt or terminate. Therefore salesforce governor limit plays an important role in ensuring the code is scalable and doesn't violate the rules set by Force.com. These governor limits are also known as Single transaction basis and offer a single trigger execution.
The following are the very important factors which will explain why are salesforce Governor Limits important;
There are six types of Salesforce governor limits such as;
Let me explain them one by one,
Per-transaction Apex limits:
These managed transaction packages are used to pass the AppExchange security checks for majority transaction limits. These packaged limits are developed by Salesforce ISV partners and set up the organization through AppExchange within the single namespace. With the help of these Apex limits transactions, we can access any amount of certified namespaces with the help of a single transaction. The precondition is that the number of operations that can be carried out in a single namespace which should not surpass the pre-transaction Apex limits.
The following are the important operations which can be carried by these transactions throughout the namespace. The overall limit for each namespace is 11 times.
All the above operations can be performed under the restricted transactions. When we set up the AppExchange package which is developed by an unauthorized salesforce ISV partner and the code part of this AppExchange package does not have its governor limits.
Static Apex Limits:
Till now we have learned what are all the restrictions will be applied to the Apex transactions. Now it's time to observe additional governor limits such as callouts, loops, queries, and records with multiple transactions. The following table will explain these governors and its limits
|The callouts governor limits are a default timeout for every transaction||10 seconds required|
|Callout transaction request or response maximum size||6 to 12 Megabytes|
|The maximum SOQL runtime prior salesforce abolished transaction||2 minutes required|
|The maximum amount of trigger code units and classless in the Apex implementation||5,000 transactions required|
|Batch size of Apex trigger||200|
|Batch size of For Loop condition list||200|
|Total number of records reverted for a batch Apex query within the Database query locator||50 million|
Per transaction Apex limits:
These Apex transaction limits are very useful for counting every Apex transaction. While discussing the batch Apex, limits that are present for the execution of records batch are reactivated.
The following table explains the important transaction Apex limits and their time limits;
|Description||Synchronous limits||Asynchronous limits|
|Total SOQL Queries Used||100||200|
|SOQL queries retrieved records||50,000|
|Issued SOSL Queries||20|
|Issued DML statements||150|
|The total amount of callouts per transaction||100|
|Allowed send email methods||10|
|Apex transaction execution time||10 minutes|
|Salesforce servers CPU time||10,000||60,000|
Lightning platform Apex limits:
The following table explains the important transaction limits of the Lightning platform Apex limits. But one important thing is that here we can access Apex transaction limits.
|The maximum amount of asynchronous method executions within 24 hours of time||25,000 limit transactions|
|Parallel scheduled Apex classes||100|
|Queued Apex jobs or active parallel||5|
|The maximum amount of batches submitted||5|
|Parallel opened query cursors per user||15|
|Parallel opened query cursors per user||50|
Size-specific Apex Limits:
In this transaction method, Apex transaction limits are designed on the basis of their sizes and this will also assure that no outsized items are present in the classes.
The following table describes the limits of the Apex size:
|The maximum amount of characters per class||1mn|
|The maximum amount of triggers per class||1 million|
|Apex maximum code utilization||6 MB|
|Limit 2 of methods size||65,535|
Miscellaneous Apex limits:
This type of Apex limits the user can't perform any transaction which will lead to stop or halt the program. Miscellaneous Apex limit means error transaction limits and this further causes the no transaction limits in Salesforce.
Here are the important Salesforce Governor limits:
Till now I have explained the types of Salesforce Governor Limits, now it’s time to know the advantages of Salesforce Governor Limits;
Only 5 concurrent batch jobs running at a time
How to avoid governor limits:
We can avoid the governor limits using the below methods:
In this article, I have tried my best to explain the salesforce governor limits and its importance. If you are a Salesforce developer it's always good to know how to use governor limits and its advantages. I hope this article may help a few of you to get the complete idea on Salesforce governor limits and also helps salesforce community forums.