Governor Limits are resource utilization limits enforced on Apex by Salesforce to prevent monopolizing resources. Salesforce is a multi-tenant environment so it is necessary to have these limits.
If some Apex code exceeds a limit, the associated governor issues a runtime exception that can’t be handled.
There are two types of Governor Limits:
1. Per Transaction Limit
These limits are set for each transaction in Apex
Description | Synchronous Limit | Asynchronous Limit |
Total number of SOQL queries issued | 100 | 200 |
Total number of records retrieved by SOQL queries | 50,000 | 50,000 |
Total number of records retrieved by Database.getQueryLocator | 10,000 | 10,000 |
Total number of SOSL queries issued | 20 | 20 |
Total number of records retrieved by a single SOSL query | 2,000 | 2,000 |
Total number of DML statements issued | 150 | 150 |
Total number of records processed as a result of DML statements, Approval.process, or database.emptyRecycleBin | 10,000 | 10,000 |
Total stack depth for any Apex invocation that recursively fires triggers due to insert, update, or delete statements3 | 16 | 16 |
Total number of callouts (HTTP requests or web services calls) in a transaction | 100 | 100 |
Maximum cumulative timeout for all callouts (HTTP requests or Web services calls) in a transaction | 120 seconds | 120 seconds |
Maximum number of methods with the future annotation allowed per Apex invocation | 50 | 0 in batch and future contexts; 50 in queueable context |
Maximum number of Apex jobs added to the queue with System.enqueueJob | 50 | 1 |
Total number of sendEmail methods allowed | 10 | 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 | 10 minutes |
Maximum number of push notification method calls allowed per Apex transaction | 10 | 10 |
Maximum number of push notifications that can be sent in each push notification method call | 2,000 | 2,000 |
Maximum number of EventBus.publish calls for platform events configured to publish immediately | 150 | 150 |
2. 24 Hour Limit
These limits are set for 24 hours and are reset after every day.