Governor Limits

 

Overview

 

Runtime limits enforced by Salesforce to ensure efficient use of shared resources across all tenants.

 

Types of Limits

Within Salesforce you will encounter varying types of Governor limits. These thresholds ensure that across nodes, a single org doesn’t consume all the resources allocated to that node, by preventing them enforced hard limits. These are per Apex Transaction.

 

SOQL Queries

Maximum of 100 SOQL queries in a single transaction, i.e: an insert/edit/update/delete call on a single record, synchronously. Asynchronously, the limit is 200 SOQL queries.

 

DML Operations

There’s a limit of 150 DML statements (insert, update, delete, etc.) in a single transaction, synchronous and asynchronous.

 

Heap Size

The maximum heap size is 6 MB for synchronous transactions and 12 MB for asynchronous transactions.

 

CPU Time

The maximum CPU time is 10,000 milliseconds for synchronous transactions and 60,000 milliseconds for asynchronous transactions.

 

Callouts

You can make a maximum of 100 callouts (HTTP requests) in a single transaction both synchronous and asynchronous.

 

Email Limits

Sending emails has its own set of limits, depending on the vehicle for which they are sent, like a maximum of 10 sendEmail methods, per transaction, both synchronous and asynchronous.

 

Impact of Governor Limits

Knowing governor limits and how to design for them is crucial for developers in Salesforce.

Building without regard to governor limits is not best practice. Knowing when to use Batch Apex, how to structure queries to avoid circular transactions,  and how to do things like send email are all crucial in building a sustainable and functional Salesforce instance.

For more information please see the official Salesforce documentation on governor limits.

 

Related Terms