Governor execution limits ensure the efficient use of resources on the Force.com multitenant platform. It is the limit specified by the Salesforce.com on code execution for efficient processing.
Why Salesforce has Governor Limits?
Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits to ensure that runaway Apex code or processes don’t monopolize shared resources. If some Apex code exceeds a limit, the associated governor issues a runtime exception that cannot be handled.
Type of Governor Limits
- Per-Transaction Apex Limits
- Per-Transaction Certified Managed Package Limits
- Lightning Platform Apex Limits
- Static Apex Limits
- Size-Specific Apex Limits
- Miscellaneous Apex Limit
Here is list of important governor limits in salesforce
- Total number of SOQL queries issued : 200
- Total number of SOSL queries issued : 20
- Total number of DML statements issued : 150
- Total number of records retrieved by SOQL queries : 50,000
- Total number of records processed as a result of DML statements : 10,000
Here is
full list of governor limits in salesforce
Description |
Synchronous Limit |
Asynchronous Limit |
Total number of SOQL
queries issued |
100 |
200 |
Total number of records
retrieved by SOQL queries |
50,000 |
|
Total number of records
retrieved by Database.getQueryLocator |
10,000 |
|
Total number of SOSL
queries issued |
20 |
|
Total number of records
retrieved by a single SOSL query |
2,000 |
|
Total number of DML
statements issued |
150 |
|
Total number of records
processed as a result of DML statements, Approval.process, or
database.emptyRecycleBin |
10,000 |
|
Total stack depth for
any Apex invocation that recursively fires triggers due to insert, update, or
delete statements |
16 |
|
Total number of
callouts (HTTP requests or Web services calls) in a transaction |
100 |
|
Maximum cumulative
timeout for all callouts (HTTP requests or Web services calls) in a
transaction |
120 seconds |
|
Maximum number of
methods with the future annotation allowed per Apex invocation |
50 |
|
Maximum number of Apex
jobs added to the queue with System.enqueueJob |
50 |
|
Total number of
sendEmail methods allowed |
10 |
|
Total heap size |
6 MB |
12 MB |
Maximum CPU time on the
Salesforce servers |
10,000 milliseconds |
60,000 milliseconds |
Maximum execution time
for each Apex transaction |
10 minutes |
|
Maximum number of push
notification method calls allowed per Apex transaction |
10 |
|
Maximum number of push
notifications that can be sent in each push notification method call |
2,000 |
From a Developer’s perspective, it is important to ensure that our code should be scalable and should not hit the governor limits. Its very important to follow some of best practices so that our code does not hit governor limit.
No comments:
Post a Comment