Governor Limits in Salesforce

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.

In this article, you'll learn
  • What are Governor Limits
  • Why Governor Limits
  • Types of Governor Limits in Salesforce
  • Benefits of Governor Limits in Salesforce
  • How to handle Governor Limits in Salesforce

 

What are the Governor Limits in Salesforce

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 limit is known as a single transaction basis.

 

Want to enhance your skills in dealing with the world's best CRM, enroll in our Online Salesforce Training

 

Different kinds of Governor limits

1. Per-transaction certified managed Package Limits.

These managed packages are those that 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 that can be carried out in a separate namespace 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. 

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.

 MindMajix YouTube Channel

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.

DescriptionLimits
The callouts default timeout for every transaction10 seconds
callout request or response maximum size6 to 12 MegaBytes.
Maximum SOQL runtime prior salesforce abolishes transaction2 Minutes
The maximum amount of trigger code units and classes in the apex implementation5,000
Batch size of apex trigger200
Batch size of For loop list200
A number of records reverted for a batch apex query within Database.queryLocator50 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.  

DescriptionSynchronous limitsAsynchronous limits
Total SOQL Queries used100200
SOQL Queries retrieved records50,000 
Issued SOSL Queries20 
Issued DML Statements150 
The total amount of callouts per transaction100 
Allowed send email Methods10 
Apex transaction execution time10 minutes 
  Salesforce Servers CPU time10,00060,000 

4. Lightning Platform apex limits

The below-mentioned limits are not applicable for apex transactions, so the lightning platform handles these limits.

DescriptionLimit
The maximum amount of asynchronous method executions in 24 hours25,000 
Parallelly scheduled apex classes100. 
Queued apex jobs or active parallelly5
The maximum amount of batches submitted5
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.

The following table provides the limits of size-specific apex limits

DescriptionLimit
The maximum amount of characters per class1 mn
The maximum amount of triggers per class1 million
Apex maximum code utilization6MB
Limit 2 of methode size65,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 the apex code manages more than one record at a time.
  • For loops, we should use collections.
  • Streamline different triggers over the same page.
Explore Salesforce Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download Now!
Course Schedule
NameDates
Salesforce TrainingOct 19 to Nov 03View Details
Salesforce TrainingOct 22 to Nov 06View Details
Salesforce TrainingOct 26 to Nov 10View Details
Salesforce TrainingOct 29 to Nov 13View Details
Last updated: 03 Apr 2023
About Author

Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.

read less
  1. Share:
Salesforce Articles