Salesforce governor limits explained, and when they become a reason to leave
Short answer
Salesforce enforces governor limits because many customers share the same servers. In a synchronous Apex transaction you get 100 SOQL queries, 50,000 retrieved records, 150 DML statements, 10,000 DML rows, 100 callouts, a 10 MB heap and 10,000 ms of CPU; asynchronous Apex gets 200 queries, 25 MB and 60,000 ms. Exceeding a limit throws an exception that cannot be caught. Enterprise orgs are also capped at 200 custom objects, 500 custom fields per object and two master-detail relationships per custom object. Good code works within these limits, but when core logic has to move off-platform to fit, the limits become part of the case for a platform you control, such as ERPNext on the Frappe Framework. Figures from Salesforce’s documentation, checked Nov 25, 2026.
Contents
- Who this guide is for
- What Salesforce governor limits are, and why they exist
- The per-transaction Apex limits that bite most
- Org-level limits that shape your data model
- How teams work around them, and what that costs
- When governor limits become a reason to leave
- How ERPNext and the Frappe Framework handle the same work
- Frequently asked questions
Who this guide is for
This guide is for Salesforce admins, developers and the managers who fund them, whose builds keep running into governor limits: “Too many SOQL queries: 101”, CPU time limits, or a data model that will not take another relationship. It lists the limits that matter, explains why they exist, and covers when they become a reason to move rather than refactor. All figures come from Salesforce’s own documentation, Checked on Nov 25, 2026.
What Salesforce governor limits are, and why they exist
Salesforce runs many customers on shared infrastructure. To stop one org’s code slowing everyone else down, the Apex runtime “strictly enforces limits so that runaway Apex code or processes don’t monopolize shared resources”. If code exceeds a limit, Salesforce raises a runtime exception “that can’t be handled”, so the whole transaction fails. Source: Salesforce Apex Developer Guide: execution governors and limits.
That design is reasonable for a multitenant platform. The cost is that every customisation has to be written around ceilings you cannot raise by paying more.
The per-transaction Apex limits that bite most
| Limit | Synchronous | Asynchronous |
|---|---|---|
| SOQL queries issued | 100 | 200 |
| Records retrieved by SOQL | 50,000 | 50,000 |
| DML statements issued | 150 | 150 |
| Records processed by DML | 10,000 | 10,000 |
| Callouts (HTTP or web service) | 100 | 100 |
| Cumulative callout timeout | 120 seconds | 120 seconds |
| Heap size | 10 MB | 25 MB |
| CPU time on Salesforce servers | 10,000 ms | 60,000 ms |
| Jobs queued with System.enqueueJob | 50 | 1 |
Source: Salesforce Apex Developer Guide: execution governors and limits. Scheduled Apex runs with synchronous limits even though it is asynchronous. CPU time counts code called from your code, including package code and workflows.
Certified AppExchange packages get their own per-transaction allowance for most limits, but not for heap size, CPU time or total execution time, which all code in the transaction shares.
Org-level limits that shape your data model
Beyond code, each edition has allocations that cap how far you can extend the data model. These are the Enterprise Edition figures from Salesforce Help: Enterprise Edition allocations.
| Allocation | Enterprise Edition |
|---|---|
| Custom objects | 200 (an org can never exceed 3,000 including packages) |
| Custom fields per object | 500 (hard cap of 900 on most objects in any edition) |
| Master-detail relationships per custom object | 2 |
| Relationships per object (master-detail plus lookup) | 40 |
| Fields tracked by field history, per object | 20 |
| Active validation rules per object | 100 |
| Active flows and processes | 2,000 |
| Formula length | 3,900 characters |
Other ceilings people hit: Professional Edition does not let you write Apex at all (Salesforce ISVforce guide: Apex in Group and Professional Editions), mass email is capped at 5,000 external addresses a day (Salesforce Help: mass email limitations), and the daily API allowance is shared by every integration (see our Salesforce API limits guide).
How teams work around them, and what that costs
- Bulkify everything. Query once, outside loops, and process collections. This is standard practice and usually fixes “101” errors.
- Move work to asynchronous Apex. Batch, queueable and future jobs get higher limits, at the cost of complexity and delayed results.
- Move heavy processing off-platform. Run it on another server and write results back through the API, which spends your API allowance.
- Buy capacity where Salesforce sells it. Extra Flow capacity is listed at $1,000 per org per month and Field Audit Trail at 10% of net spend (Salesforce add-on price list (PDF)).
Each workaround is sensible on its own. Together they explain why mature Salesforce orgs depend on specialists, a theme buyers raise in Alium Research: where Salesforce buyers switch to.
When governor limits become a reason to leave
Governor limits alone rarely justify a migration. They become a reason when they combine with the other costs in our 70 reasons companies leave Salesforce:
Signs the limits are costing you more than they protect you
- Core business logic (pricing, allocation, scheduling) is split between Apex and an external service just to stay under CPU or callout limits
- You run an off-platform database to report on Salesforce data you already pay to store
- Every new requirement starts with “will it fit the limits?”
- Your developers spend more time on limit-safe patterns than on features
How ERPNext and the Frappe Framework handle the same work
ERPNext and Frappe CRM run on the Frappe Framework, written in Python and JavaScript and licensed MIT. When you host it yourself, there is no vendor-imposed per-transaction query count: the limits are your server’s CPU, memory and the timeouts you configure, and long jobs go to background workers. Source: Frappe Framework on GitHub (MIT).
That is a trade, not a free lunch. On Frappe Cloud, site plans are shared, compute-based plans, so heavy workloads belong on a dedicated server plan (Frappe Cloud pricing page). On your own server, badly written code can still slow everyone down; there is just no governor stopping it. Good engineering practice still applies.
What changes is ownership. Your logic lives in an ordinary Git repository as a Frappe app, runs on any server you choose and can query the MariaDB database directly for reporting. Our Salesforce to ERPNext migration guide shows how Apex triggers and flows map to Frappe server scripts, doc events and background jobs.
Planning a move off Salesforce? See our Salesforce migration services for how we move teams to ERPNext and Frappe CRM with code ownership, or read the 70 reasons companies leave Salesforce.
Frequently asked questions
What are governor limits in Salesforce?
Runtime limits Salesforce enforces on each Apex transaction, such as 100 SOQL queries and 150 DML statements in synchronous code, so that one customer’s code cannot monopolise shared servers. Exceeding one throws an exception that cannot be handled.
What is the SOQL query limit in Salesforce?
100 SOQL queries per synchronous transaction and 200 per asynchronous transaction, with up to 50,000 records retrieved.
What is the heap size limit in Salesforce?
10 MB for synchronous Apex and 25 MB for asynchronous Apex, according to the Apex Developer Guide checked on Nov 25, 2026. Email services get 50 MB.
Can I pay to increase governor limits?
No. Per-transaction governor limits are fixed. Salesforce sells some related capacity, such as extra API calls and extra Flow entitlements, but not more SOQL queries or CPU time per transaction.
Does ERPNext have governor limits?
Not in the Salesforce sense. Self-hosted ERPNext is limited by your server resources and configured timeouts. Frappe Cloud shared site plans are compute-based, so heavy workloads need a server plan.