Skip to content

Governor Limits in Salesforce Explained

Governor Limits in Salesforce Explained.

What are Governor Limits in Salesforce?

Salesforce uses multitenancy technology to share IT resources securely among multiple applications and tenants (businesses, organizations, etc.) because resources are being shared by multiple tenants, Salesforce strictly enforces governor limits to ensure that any one tenant does not monopolize these shared resources in the multitenent environment. If a governor limit is exceeded, the associated governor issues a runtime exception that cannot be handled. Some of the important Governor Limits in Salesforce are:

1. Per-Transaction Apex Limits
2. Per-Transaction Certified Managed Package Limits
3. Platform Apex Limits
4. Static Apex Limits
5. Size-Specific Apex Limits
6. Metadata Limits
7. SOQL and SOSL Limits for Search Queries
8. General Flow Limits
9. Per-Transaction Flow Limits
10. Push Notification Limits
Governor Limits in Salesforce
Salesforce Governor Limits

1. Per-Transaction Apex Governor Limits in Salesforce

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.

DescriptionLimitAsynchronous Limit
Total number of SOQL queries issued100200
Total number of records retrieved by SOQL queries50,000
Total number of records retrieved by Database.getQueryLocator10,000
Total number of SOSL queries issued20
Total number of records retrieved by a single SOSL query2,000
Total number of DML statements issued150
Total number of records processed as a result of DML statements, Approval.process, or database.emptyRecycleBin10,000
Total stack depth for any Apex invocation that recursively fires triggers due to insertupdate, or delete statements16
Total number of callouts (HTTP requests or web services calls) in a transaction100
Maximum cumulative timeout for all callouts (HTTP requests or Web services calls) in a transaction120 seconds
Maximum number of methods with the future annotation allowed per Apex invocation500 in batch and future contexts; 1 in queueable context
Maximum number of Apex jobs added to the queue with System.enqueueJob501
Total number of sendEmail methods allowed10
Total heap size6 MB12 MB
Maximum CPU time on the Salesforce servers510,000 milliseconds60,000 milliseconds
Maximum execution time for each Apex transaction10 minutes
Maximum number of push notification method calls allowed per Apex transaction10
Maximum number of push notifications that can be sent in each push notification method call2,000
Maximum number of EventBus.publish calls for platform events configured to publish immediately150

2. Per-Transaction Certified Managed Package Limits

Certified managed packages—managed packages that have passed the security review for AppExchange—get their own set of limits for most per-transaction limits.

DescriptionCumulative Cross-Namespace Limit
Total number of SOQL queries issued1,100
Total number of records retrieved by Database.getQueryLocator110,000
Total number of SOSL queries issued220
Total number of DML statements issued1,650
Total number of callouts (HTTP requests or web services calls) in a transaction1,100
Total number of sendEmail methods allowed110

3. Lightning Platform Apex Governor Limits

DescriptionLimit
The maximum number of asynchronous Apex method executions (batch Apex, future methods, Queueable Apex, and scheduled Apex) per a 24-hour period250,000 or the number of user licenses in your org multiplied by 200, whichever is greater
Number of synchronous concurrent transactions for long-running transactions that last longer than 5 seconds for each org.10
Maximum number of Apex classes scheduled concurrently100. In Developer Edition orgs, the limit is 5.
Maximum number of batch Apex jobs in the Apex flex queue that are in Holding status100
Maximum number of batch Apex jobs queued or active concurrently5
Maximum number of batch Apex job start method concurrent executions1
Maximum number of batch jobs that can be submitted in a running test5
Maximum number of test classes that can be queued per 24-hour period (production orgs other than Developer Edition)The greater of 500 or 10 multiplied by the number of test classes in the org
Maximum number of test classes that can be queued per 24-hour period (sandbox and Developer Edition orgs)The greater of 500 or 20 multiplied by the number of test classes in the org
Maximum number of query cursors open concurrently per user50
Maximum number of query cursors open concurrently per user for the Batch Apex start method15
Maximum number of query cursors open concurrently per user for the Batch Apex execute and finish methods5

4. Static Apex Governor Limits

DescriptionLimit
Default timeout of callouts (HTTP requests or Web services calls) in a transaction10 seconds
Maximum size of callout request or response (HTTP request or Web services call)6 MB for synchronous Apex or 12 MB for asynchronous Apex
Maximum SOQL query run time before Salesforce cancels the transaction120 seconds
Maximum number of class and trigger code units in a deployment of Apex7500
Apex trigger batch size200
For loop list batch size200
Maximum number of records returned for a Batch Apex query in Database.QueryLocator50 million

5. Size-Specific Apex Governor Limits

DescriptionLimit
Maximum number of characters for a class1 million
Maximum number of characters for a trigger1 million
Maximum amount of code used by all Apex code in an org3 MB
Method size limit(Large methods that exceed the allowed limit cause an exception to be thrown during the execution of your code.)65,535 bytecode instructions in compiled form

6. Metadata Governor Limits

The following limits apply to the Salesforce Extensions for Visual Studio Code, the Ant Migration Tool, and the Metadata API.

LimitDescription
Retrieving and deploying metadataYou can deploy or retrieve up to 10,000 files at once. AppExchange packages use different limits: They can contain up to 35,000 files. The maximum size of the deployed or retrieved .zip file is 39 MB. If the files are uncompressed in an unzipped folder, the size limit is 400 MB.
Change setsInbound and outbound change sets can have up to 10,000 files of metadata.

7. SOQL and SOSL Governor Limits for Search Queries

FeatureLimitLimit Description
SOQL statementsMaximum length of SOQL statementsBy default, 100,000 characters.
SOQL WHERE clauseStrings in SOQL WHERE clauses4,000 characters for each string within a WHERE clause.
SOQL query resultsMaximum rows returned2,000 results total (API version 28.0 and later), unless you specify custom limits in the query. This limit includes results from child objects. Previous API versions return 200 results.
SOSL statementsMaximum length of SOSL statementsBy default, 100,000 characters. This limit is tied to the SOQL statement character limit defined for your org.
SOSL search query stringsMaximum length of SearchQuery stringIf the SearchQuery string is longer than 10,000 characters, no result rows are returned. If SearchQuery is longer than 4,000 characters, any logical operators are removed. For example, the AND operator in a statement with a SearchQuery that’s 4,001 characters will default to the OR operator, which could return more results than expected.
SOSL query resultsMaximum rows returned2,000 results total (API version 28.0 and later), unless you specify custom limits in the query. This limit includes results from child objects. Previous API versions return 200 results.
Relationship queriesRelationship query limitsNo more than 55 child-to-parent relationships can be specified in a query. A custom object allows up to 40 relationships, so you can reference all the child-to-parent relationships for a custom object in one query.No more than 20 parent-to-child relationships can be specified in a query.In each specified relationship, no more than five levels can be specified in a child-to-parent relationship. For example, Contact.Account.Owner.FirstName (three levels).In each specified relationship, only one level of parent-to-child relationship can be specified in a query. For example, if the FROM clause specifies Account, the SELECT clause can specify only the Contact or other objects at that level. It could not specify a child object of Contact.
FOR VIEW and FOR REFERENCEMaximum RecentlyViewed records allowedThe RecentlyViewed object is updated every time the logged-in user views or references a record. It is also updated when records are retrieved using the FOR VIEW or FOR REFERENCE clause in a SOQL query. To ensure that the most recent data is available, RecentlyViewed data is periodically truncated down to 200 records per object. RecentlyViewed data is retained for 90 days, after which it is removed on a periodic basis.
OFFSET clauseMaximum number of rows skipped by OFFSETThe maximum offset is 2,000 rows. Requesting an offset greater than 2,000 results in a NUMBER_OUTSIDE_VALID_RANGE error.

8. General Flow Governor Limits

Per-Org LimitEssentials or Professional editionsEnterprise, Unlimited, Performance, or Developer editions
Versions per flow5050
Executed elements at runtime per flow2,0002,000
Active flows per flow type52,000
Total flows per flow type54,000
Flow interviews that are resumed per hour or groups of scheduled actions from processes that are executed per hour based on a specific time1,0001,000
Combined total of these automations that start or resume based on a record’s field value. Resume events that are defined in active flows Groups of scheduled actions that are defined in active processes Time triggers that are defined in active workflow rules Inactive flow interviews that are resumed20,00020,000
Schedule-triggered flow interviews per 24 hours250,000, or the number of user licenses in your org multiplied by 200, whichever is greater250,000, or the number of user licenses in your org multiplied by 200, whichever is greater

9. Per-Transaction Flow Limits

Per-Transaction LimitValue
Total number of SOQL queries issued(All executions of Get Records elements, and executions of Update Records or Delete Records elements that use filter conditions)100
Total number of records retrieved by SOQL queries(All executions of Get Records elements, and executions of Update Records or Delete Records elements that use filter conditions)50,000
Total number of DML statements issued(Create Records, Update Records, and Delete Records executions)150
Total number of records processed as a result of DML statements10,000
Maximum CPU time on the Salesforce servers10,000 milliseconds
Total number of duplicate updates allowed in one batch12

10. Push Notification Limits

Push Notification Governor Limits in Salesforce:

  • An org can send up to 20,000 iOS and 10,000 Android push notifications per hour (for example, 4:00 to 4:59 UTC).
  • Only deliverable notifications count toward this limit.
  • Each test push notification that is generated through the Test Push Notification page is limited to a single recipient. Test push notifications count toward an org’s hourly push notification limit.
  • When an org’s hourly push notification limit is met, any additional notifications are still created for in-app display and retrieval via REST API.

11. Governor Limits Documentation

Share this article...

Please Leave a Comment

error: Content is protected !!

Discover more from DYDC

Subscribe now to keep reading and get access to the full archive.

Continue reading