Salesforce governor limits
Governor limits are the per-transaction caps Salesforce enforces on every Apex execution, so one tenant's code cannot starve the others on shared servers. Each limit covers the whole transaction, including every trigger, flow and class it runs. Bookmark this page; pair it with the governor limits dictionary entry for the deeper context.
| Category | Limit | Sync | Async |
|---|---|---|---|
| SOQL | Total SOQL queries | 100 | 200 |
| SOQL | Records returned by SOQL | 50,000 | 50,000 |
| SOQL | Total SOSL queries | 20 | 20 |
| SOQL | Records retrieved by Database.getQueryLocator | 10,000 | 10,000 |
| DML | Total DML statements | 150 | 150 |
| DML | Records processed by DML | 10,000 | 10,000 |
| CPU | Maximum CPU time on Salesforce servers | 10,000 ms | 60,000 ms |
| Heap | Maximum heap size | 6 MB | 12 MB |
| Callouts | Total callouts (HTTP requests or web service calls) | 100 | 100 |
| Callouts | Maximum cumulative timeout for all callouts in a transaction | 120 sec | 120 sec |
| Single emails sent (SingleEmailMessage) | 10 | 10 | |
| Mass emails sent (MassEmailMessage) | 10 | 10 | |
| Push notifications | Mobile push notifications | 10 | 10 |
| Apex | Total stack depth for Apex invocations | 1,000 | 1,000 |
| Apex | Future calls per Apex invocation | 50 | 50 |
| Apex | Queueable jobs added with System.enqueueJob | 50 | 1 |
| Apex | Maximum number of Apex jobs added to the queue with System.enqueueJob | 5,000 / 24h | 5,000 / 24h |
Numbers reflect Spring ‘26 release. Salesforce occasionally raises soft caps - always check the official Apex Developer Guide for the canonical value.
The governor limit errors you will actually hit
- Too many SOQL queries: 101
More than 100 queries in one synchronous transaction, almost always a query inside a loop.
- Too many DML statements: 151
More than 150 insert, update or delete calls. Collect records in a list and run one DML.
- Apex CPU time limit exceeded
Over 10 seconds of CPU in a synchronous transaction (60 seconds async).
- Apex heap size too large
More than 6 MB held in memory at once (12 MB in async Apex).
- Too many query rows: 50001
SOQL returned more than 50,000 rows in one transaction.
- Too many callouts: 101
More than 100 HTTP or web service callouts in one transaction.
For the bulkification patterns that keep you under every limit, read the Salesforce governor limits cheat sheet, or browse the full Salesforce error library.
Governor limits FAQ
- What are Salesforce governor limits?
- Per-transaction limits Salesforce enforces on every Apex execution. Each script runs in a multi-tenant context, so governor limits prevent any one process from monopolising shared resources (CPU, memory, database).
- Do governor limits reset between triggers?
- No. Limits accumulate across the entire transaction, including all triggers, Flows, and Apex called within that single user request. Bulk-test in a sandbox before assuming you have headroom.
- How is async (Batch / Queueable) different?
- Async contexts get higher CPU (60s vs 10s), heap (12 MB vs 6 MB), and queue limits but the same SOQL/DML caps. For very large jobs, switch to Batch Apex which loops over chunks of up to 200 records.
- What is the SOQL query limit in Salesforce?
- 100 SOQL queries per synchronous transaction and 200 in asynchronous Apex such as Batch, Queueable and future methods. Across the transaction, queries can return at most 50,000 rows.
- How do I check governor limits in Apex?
- Use the Limits class. Limits.getQueries() returns the SOQL queries used so far and Limits.getLimitQueries() returns the cap; the same pair exists for DML statements, CPU time and heap size.