What are Salesforce Governor Limits?

Reading Time: 5 minutes

Salesforce CRM is undeniably becoming omnipresent due to its versatility; it has to fit in the demands of all types of scales of operations & function for diverse domains across the industry sector. 

Salesforce has been winning hearts across all sizes of businesses for more than two decades now. 

When businesses think of efficiently managing the customer base, the first name to strike their minds is Salesforce- without any doubt. 

Designing, building, and customizing Salesforce according to the need of every size & type of business is possible, making it the most sought-after CRM software. 

However, the tasks of designing, building, or customizing this CRM for business are done by Salesforce Developers. 

They understand the business needs and then make the salesforce platform, tools, and the application function as per the business needs.    

Nonetheless, the tasks which Salesforce Developer perform are linked to some restrictions as well as regulations. 

While making some pivotal changes in the system, some essential regulations need to be kept in mind by the Salesforce Developers. These rules are majorly called Governor Limits. 

Have you been wondering about Governor Limits? 

Do you think you need some basic understanding to go about with the services related to Salesforce

Well, to answer these and many more pertinent questions, let us quickly dive deep into these concepts explained lucidly here:

  • We will first focus on the Multitenant Architecture and understand its relationship with the Salesforce Governor Limits.  
  • Then we will jump straight to understand what Salesforce Governor Limits is? 
  • And we would be in a state to talk about Types of Salesforce Governor Limits.  
  • Then before we conclude the blog, we will talk about the best ways to avoid Salesforce Governor limits and the benefits offered by Governor Limits. 

So let us quickly roll out an elaborate concept to understand Multitenant Architecture: 

Understanding the concept of Multitenant Architecture?  

In the most straightforward words, we can say that when a software platform, or a single software platform, is being used by many or multiple users. It can be termed multitenant architecture. 

Such is the case with Salesforce CRM because all the users or operators utilize the same version or the same architecture for the Salesforce platform.  

There is another term, single-tenant platforms, and the difference between multitenant platforms and the former is that the latter needs to be upgraded by the users for themselves regularly. 

The multitenant platforms send regular updates to their users. 

However, when it comes to Salesforce, it is a cloud-based CRM; hence, users do not have to put effort into maintaining the software and hardware of the Salesforce Platform. 

And since, Salesforce is a multitenant architecture platform, and the users get the latest versions installed in their systems. 

To maintain such a platform, Salesforce has a certain set of rules to restrict monopolistic use of this platform. 

What are these rules, how do they work or what are their types, and much more; let us read: 

What are the Salesforce Governor Limits? 

In simpler terms, to make sure that the platform is not misused by anyone, as there are multiple users on the same server, Salesforce enforces specific caps on the platform’s usage. 

Hence, multiple users can use the platform without affecting the overall performance. 

There is a list of various types of Salesforce Governor Limits. 

Some of these types have soft limits, while others have a combination of programming in Apex Language, known as hard limits.  

The soft governor limits can be solved by Salesforce or by specific paid add-ons. 

For instance, when the limit is 6 MB of Apex code per org, it is a soft limit, and you can extend it depending on your case with the help of Salesforce Support. 

While the other types of limits, you might need awareness on API and data storage limits. 

For hard limits, the developer needs to find a way out to get the results as the limits cannot be increased in these cases.   

Let us read about all such types of Salesforce Governance:

Types of Salesforce Governor Limits 

The types are classified based on various factors, but here we have listed more of them and other related details. 

The types of Salesforce Governance are: 

Per-Transaction Apex Limits: These limits count for each Apex transaction. 

For Batch Apex, these limits are reset for each execution of a batch of records in the execute method. 

  • Per Transaction Certified Managed Package Limits 
  • Lightning Platform Apex Limit  
  • Static Apex Limit  
  • Size-Specific Apex Limit  
  • Miscellaneous Apex Limit  

Let us talk deeply about these various types of Salesforce governor limits for different security levels and other metrics related to code. 

Per-transaction Certified Managed Package Limits 

This type is relevant when the AppExchange checks have been cleared for the majority of transaction limits. 

ISV partners develop the Certified Managed Package, and installation is done from AppExchange with a unique namespace. 

Other details include:

FactorLimit
Total SOQL queries issued1100
Total retrieved records by Database.getQueryLocator110000
Number of SOSL queries issued220
Total DML statements issued1650
Total Callouts in a transaction1100
Toal sendEmail methods allowed110

Static Apex Limits

The governor limits by Salesforce have 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:

DescriptionLimits
The default timeout for transaction callouts10 seconds
Max. size of callout request or response6MB (Synchronous)
12 MB ( Asynchronous)
SOQL query runtime before cancellation of a transaction120 seconds
Max. number of class and trigger units of code5000
Trigger batch size for Apex200
Size of loop list batch200
Batch Apex query returned records in Database.QueryLocator50 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:

FactorSynchronous LimitAsynchronous Limit
Total SOQL queries issued100200
Total records retrieved by SOQL queries50,000
Total records retrieved by Database.getQueryLocator10,000
Total SOSL queries issued20
Records retrieved by a single SOSL query20,000
Toal DML statements issued150
Total records processed by DML statements10,000
Stack depth for Apex invocation16
Total callots in a transaction100
Methods allowed per Apex invocation500 in batch & future contexts, 1 in queueable context
Number of Apex jobs added501
Toal sendEmail methods allowed10
Total heap size6 MB12 MB
Max. CPU time on Salesforce servers10,000 milliseconds60,000 milliseconds
Execution time for Apex transaction10 minutes
Max. push notifications per Apex transaction10
Max push notifications send through each push notification method call2000

Lightning Platform Apex Limits

The lightning platform is responsible for the handling of the following limits:

DescriptionLimit
The maximum amount of asynchronous method executions per day25,000
Parallelly scheduled apex classes100
Queued Apex jobs5
Max. batches submitted5
Parallelly opened query cursors/user50
Parallelly opened query cursors/user15

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:

DescriptionLimit
The maximum amount of characters/ class1 mn
The maximum amount of triggers/ class1 Million
Apex maximum code utilization6 MB
Limit for method size65,535

Best Practices to follow to avoid Governor limits 

Well, there have to be some practices which you can follow to avoid such limits!? 

Yes, of course, our experts have listed some of these for you. Let us have a look at these: 

  • You can try to bulkify your code and the helper method. 
  • You can avoid SOQL queries or DML statements in FOR loops.  
  • You can use Collections, Streamlining Queries, and Efficient for Loops. 
  • Go with Querying Large Data Sets  
  • Streamline Multiple Triggers on the Same Object 
  • Do not use any SOQL, DML operation inside the loop. 
  • Use Limits Apex Methods to Avoid Hitting Governor Limits 
  • Use @future Appropriately 
  • Use batch apex if you are working for more than 50000 records. 

Benefits of Salesforce Governance limits 

You might wonder why one needs to understand these terms and ways to avoid these limits! 

Are there some advantages offered by Salesforce Governor limits? 

Well, It has many benefits offered by such limits. These benefits are: 

  • Save space in the entire cloud CPU or the memory itself, and these limits do not let other organizations use or execute lengthy code. 
  • Apex has unique and different coding limits considering job security.  
  • These governor limits help to stay the correct space of coding with Apex. 

Overall, You can say that Salesforce Governor limits to aid in writing efficient and scalable codes.  

Conclusion  

Finally, while writing the code, we can say that it is crucial to consider the limits of Salesforce. 

It can simply help you in many ways, and you can eventually come out with efficient codes. 

If you still have queries and questions and need some experts to help you, feel free to contact us

We have a team of developers and experts looking forward to helping you with the right solutions.   

Recent Posts

Table of Contents

Share via
Copy link