Governor Limits in Salesforce:
Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources. Types of limits that Apex enforces are resources like memory, database resources, number of script statements to avoid infinite loops, and number of records being processed. If code exceeds a limit, the associated governor issues a runtime exception.
In Salesforce, it is the Governor Limits which controls how much data or how many records you can store in the shared databases. Why? Because Salesforce is based on the concept of multi-tenant architecture. In simpler words, Salesforce uses a single database to store the data of multiple clients/ customers. The below image will help you relate to this concept.
In Salesforce, it is the Governor Limits which controls how much data or how many records you can store in the shared databases. Why? Because Salesforce is based on the concept of multi-tenant architecture. In simpler words, Salesforce uses a single database to store the data of multiple clients/ customers. The below image will help you relate to this concept.
To make sure no single client monopolizes the shared
resources, Salesforce introduced the concept of Governor Limits which
is strictly enforced by the Apex run-time engine.
Governor Limits are a Salesforce developer’s biggest challenge.
That is because if the Apex code ever exceeds the limit, the expected governor
issues a run-time exception that cannot be handled. Hence as a Salesforce
developer, you have to be very careful while developing your application.
Different Governor Limits in Salesforce are:
- Per-Transaction Apex Limits
- Force.com Platform Apex Limits
- Static Apex Limits
- Size-Specific Apex Limits
- Miscellaneous Apex Limits
- Email Limits
- Push Notification Limits.
Salesforce Governor Limits
Since Apex runs in a multitenant environment, the Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources. These limits, or governors, track and enforce the statistics outlined in the following table. If some Apex code ever exceeds a limit, the associated governor issues a run time exception that cannot be handled.
SOQL and SOSL Limits
Since Apex runs in a multitenant environment, the Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources. These limits, or governors, track and enforce the statistics outlined in the following table. If some Apex code ever exceeds a limit, the associated governor issues a run time exception that cannot be handled.
Description
|
Limit
|
Total number of SOQL queries issued
| |
Total number of SOQL queries issued for Batch Apex and future methods
| |
Total number of records retrieved by SOQL queries
| |
Total number of records retrieved by Database.getQueryLocator
| |
Total number of SOSL queries issued
| |
Total number of records retrieved by a single SOSL query
| |
Total number of DML statements issued
| |
Total number of records processed as a result of DML statements,Approval.process, or database.emptyRecycleBin
| |
Total number of executed code statements
| |
Total number of executed code statements for Batch Apex and future methods
| |
Total heap size
| |
Total heap size for Batch Apex and future methods
| |
Total stack depth for any Apex invocation that recursively fires triggers due toinsert, update, or delete statements
|
16
|
For loop list batch size
| |
Total number of callouts (HTTP requests or Web services calls) in a request
| |
Maximum timeout for all callouts (HTTP requests or Web services calls) in a request
| |
Default timeout of callouts (HTTP requests or Web services calls) in a request
| |
Total number of methods with the future annotation allowed per Apex invocation
|
50
|
Maximum size of callout request or response (HTTP request or Web services call)
| |
Total number of sendEmail methods allowed
| |
Total number of describes allowed
| |
Total number of classes that can be scheduled concurrently
|
25
|
Total number of test classes that can be queued per a 24–hour period
|
Visualforce Limits
Available in: Contact Manager, Group, Professional, Enterprise,Performance, Unlimited, and Developer Editions
Limit
|
Value
|
Maximum response size for a Visualforce page
|
Less than 15 MB
|
Maximum view state size in a Visualforce page
|
135KB
|
Maximum size of a Visualforce email template
|
1 MB
|
Maximum file size for a file uploaded using a Visualforcepage
|
10 MB
|
Maximum size of HTML response before rendering, whenVisualforce page is rendered as PDF
|
Less than 15 MB
|
Maximum PDF file size for a Visualforce page rendered as a PDF
|
60 MB
|
Maximum total size of all images included in a Visualforcepage rendered as a PDF
|
30 MB
|
Maximum response size of a JavaScript remote call
|
15 MB
|
Default timeout for a JavaScript remoting call
|
30000milliseconds (30seconds)
|
Maximum timeout for a JavaScript remoting call
|
120000milliseconds (120seconds)
|
Maximum number of rows retrieved by queries for a singleVisualforce page request
|
50,000
|
Maximum number of rows retrieved by queries for a singleVisualforce page request in read-only mode
|
1 million
|
Maximum number of collection items that can be iterated in an iteration component such as <apex:pageBlockTable> and<apex:repeat>
|
1,000
|
Maximum number of collection items that can be iterated in an iteration component such as <apex:pageBlockTable> and<apex:repeat> in read-only mode
|
10,000
|
Maximum number of field sets that can be displayed on a single Visualforce page.
|
50
|
Maximum number of records that can be handled by StandardSetController
|
10,000
|
SOQL and SOSL Limits
Metadata Limits
The following are limits for deploying and retrieving metadata. These limits apply to the Force.com IDE, the Force.com Migration Tool, and the Metadata API.
Metadata Limit
|
Limit Description
|
Retrieving and deploying metadata
|
Metadata API can deploy and retrieve up to 5,000 filesor 400 MB at one time.
While a specific file size limit is not enforced, you might encounter out-of-memory errors for very large files.
|
Change sets
|
Inbound and outbound change sets can have up to5,000 files of metadata.
|
Salesforce Custom objects and fields Limitation
Custom Objects and fields limitation is based on the Salesforce Edition (Group, Professional, Enterprise and Unlimited Editions)
Salesforce.com Editions Group Edition Professional Edition Enterprise Edition Unlimited Edition Developer Edition
Total Custom Fields per Object 100 100 500 800 500
Total Custom Objects 50 50 200 2,000 400
Custom Objects and fields limitation is based on the Salesforce Edition (Group, Professional, Enterprise and Unlimited Editions)
Salesforce.com Editions | Group Edition | Professional Edition | Enterprise Edition | Unlimited Edition | Developer Edition |
Total Custom Fields per Object | 100 | 100 | 500 | 800 | 500 |
Total Custom Objects | 50 | 50 | 200 | 2,000 | 400 |
Per-Transaction Apex Limits:
Description
|
Synchronous Limit
|
Asynchronous Limit
|
Total stack depth for any Apex invocation that recursively
fires triggers due to insert,update, or delete statements3
|
||
Maximum cumulative timeout for all callouts (HTTP requests or
Web services calls) in a transaction
|
||
Maximum CPU time on the Salesforce servers5
|
||
Maximum execution time for each Apex transaction
|
||
Maximum number of push notification method calls allowed per
Apex transaction
|
||
Maximum number of push notifications that can be sent in each
push notification method call
|
Per-Transaction
Certified Managed Package Limits
Description
|
Cumulative
Cross-Namespace Limit
|
Total
number of SOQL queries issued
|
1,100
|
Total number of records retrieved by Database.getQueryLocator
|
110,000
|
Total number of SOSL queries issued
|
220
|
Total number of DML statements issued
|
1,650
|
Total number of callouts (HTTP requests or Web services calls)
in a transaction
|
1,100
|
Total number of sendEmail methods
allowed
|
110
|
Force.com
Platform Apex Limits
Description
|
Limit
|
Number of synchronous concurrent requests for long-running
requests that last longer than 5 seconds for each org.2
|
10
|
Maximum number of Apex classes scheduled concurrently
|
100. In Developer Edition orgs the limit is 5.
|
Maximum number of batch Apex jobs in the Apex flex queue that
are in Holding status
|
|
Maximum number of batch Apex jobs queued or active
concurrently3
|
|
Maximum number of batch Apex job start method
concurrent executions4
|
1
|
Maximum number of batch jobs that can be submitted in a
running test
|
|
Maximum number of test classes that can be queued per 24-hour
period (production orgs other than Developer Edition)5
|
|
Maximum number of test classes that can be queued per 24-hour
period (sandbox and Developer Edition orgs)5
|
|
Maximum number of query cursors open concurrently per user6
|
|
Maximum number of query cursors open concurrently per user for
the Batch Apex start method
|
15
|
Maximum number of query cursors open concurrently per user for
the Batch Apex execute and finish methods
|
5
|
Static Apex
Limits
Description
|
Limit
|
Default
timeout of callouts (HTTP requests or Web services calls) in a transaction
|
|
Maximum
size of callout request or response (HTTP request or Web services call)1
|
|
Maximum
SOQL query run time before Salesforce cancels the transaction
|
120
seconds
|
Maximum
number of class and trigger code units in a deployment of Apex
|
5,000
|
For
loop list batch size
|
|
Maximum
number of records returned for a Batch Apex query in Database.QueryLocator
|
50
million
|
Size-Specific
Apex Limits
Description
|
Limit
|
Maximum
number of characters for a class
|
1
million
|
Maximum
number of characters for a trigger
|
1
million
|
Maximum
amount of code used by all Apex code in an org1
|
|
Method
size limit 2
|
65,535
bytecode instructions in compiled form
|
No comments:
Post a Comment