Salesforce has governor limits to assure the practical usage of the resources present in the Force.com platform. To use the code effectively, salesforce establishes some limits, and they are known as Governor limits.
Why governor limits
To assure that nobody gains requirements from other people, Force.com establishes many constraints that restrict standard code implementation. Salesforce will do this as it has multi-tenant architecture, because of which every organization and user share the same resource.
If any governor limit is not satisfied, an error has occurred, further, the program is stopped or halted. So, it is critical to assure that code is extensible and should not violate any governor limits. This type of limits is known as single transaction basis.
Different kinds of Governor limits
1. Per-transaction certified managed Package Limits.
These managed packages are those who have passed AppExchange security checks for majority transaction limits. These managed packages are designed by salesforce ISV Partners and set up in our organization through AppExchange within a single namespace.
We can access any amount of certified namespaces with the help of a single transaction. Though, the precondition is that the number of operations which can be carried out in a separate namespace which should not surpass the per-transaction limits.
Moreover, the operations which can be carried out in the transaction throughout the namespace is restricted. For each namespace the overall limit is 11times.
Subscribe to our youtube channel to get new updates..!
Every transaction limits count separately for certified managed packets anticipate
- Effective CPU utilization.
- Complete heap size
- Numerous unique namespaces
- Best transaction implementation time.
All the restrictions mentioned above apply to all transactions, still if the amount of certified managed packages working in the same transaction. When we set up an AppExchange package generated by an unauthorized Salesforce ISV partner, the code part of that specific package won’t have its governor limits.
2. Static Apex Limits
Till now, we are aware of various governor limits corresponding to every description given in apex. We observe additional governor limits i.e. for various types of callouts, loops, queries and records together with multiple transactions.
|The callouts default timeout for every transaction||10 seconds|
|callout request or response maximum size||6 to 12 MegaBytes.|
|Maximum SOQL runtime prior salesforce abolishes transaction||2 Minutes|
|The maximum amount of trigger code units and classes in the apex implementation||5,000|
|Batch size of apex trigger||200|
|Batch size of For loop list||200|
|Number of records reverted for a batch apex query within Database.queryLocator||50 million|
3. Per transaction apex limits
These limits are useful for counting every apex transaction. While we discuss batch apex, limits which are present for executing records batch are reactivated.
|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|
4. Lightning Platform apex limits
The below-mentioned limits are not applicable for apex transactions, so lightning platform handles these limits.
|The maximum amount of asynchronous method executions in 24 hours||25,000|
|Parallelly scheduled apex classes||100.|
|Queued apex jobs or active parallelly||5|
|The maximum amount of batches submitted||5|
|Parallelly opened query cursors per user||50|
|Parallelly opened query cursors per user||15|
5. Size-specific Apex Limits
Depending on the size these limits are particularly designed to assure that no outsized items are present in the classes.
Following table provides the limits of size-specific apex limits
|The maximum amount of characters per class||1 mn|
|The maximum amount of triggers per class||1 million|
|Apex maximum code utilization||6MB|
|Limit 2 of methode size||65,535|
Benefits of Governor limits
Apex has entirely different or individual coding limits.
Governor limits assist us to stay within the appropriate place of apex coding.
How to avoid Governor Limits
We can avoid governor limits by the following process
- Avoid DML Statements and SOQL queries within the For Loop
- Make sure that apex code manages more than one record at a time.
- For loops, we should use collections.
- Streamline different triggers over the same page.
Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts