Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryGGovernor Limits
DevelopmentAdvanced

Governor Limits

Governor Limits are runtime limits enforced by the Salesforce platform that prevent any single transaction from monopolizing shared resources in the multitenant environment.

§ 01

Definition

Governor Limits are runtime limits enforced by the Salesforce platform that prevent any single transaction from monopolizing shared resources in the multitenant environment. They restrict the number of SOQL queries (100 per synchronous transaction), DML statements (150), callouts, heap size, CPU time, and other operations to ensure fair resource allocation across all tenants.

§ 02

In plain English

👋 Study buddy

Here's a simple way to think about it: Governor Limits are the per-transaction caps that prevent any one customer's code from monopolizing platform resources. SOQL queries, DML rows, CPU time, callout count - each transaction has a budget.

§ 03

Worked example

scenario · real-world use

A junior developer at ClearPath writes a trigger that queries the database inside a for-loop. When a bulk data load inserts 200 records, the trigger fires and attempts 200 SOQL queries, hitting the 100-query governor limit and throwing a System.LimitException. The senior developer refactors the code to bulkify it, moving the query outside the loop and processing all records with a single SOQL query and a single DML statement.

§ 04

Why Governor Limits matters

Governor Limits are runtime ceilings the Salesforce platform enforces against every transaction to protect its multitenant infrastructure. They cover SOQL query count (100 per transaction in synchronous Apex), DML statements (150), CPU time (10 seconds synchronous, 60 seconds asynchronous), heap size (6 MB sync, 12 MB async), callout duration, and dozens of other resources. Hit a limit and the transaction throws a System.LimitException; partial work is rolled back, and the user sees an error. The platform's reliability for any one customer depends on every other customer's code respecting these limits.

Designing Apex against governor limits is the central skill that separates Salesforce platform code from generic backend code. Bulkify every loop so 200 records process in one query, not 200. Use collections to defer DML until the end of a method. Move long-running work to @future or Queueable Apex where the limits are looser. Cache repeated lookups in Maps. Profile against limits using the Limits class itself before pushing to production. The limits are not a constraint to work around once and forget - they are an architectural premise that shapes every line of platform code.

§ 05

How organizations use Governor Limits

Vanguard Solutions

Apex performance review identifies code approaching governor limits; refactoring happens before incidents.

Atlas Manufacturing

Bulk-job design respects governor limits; large-volume work doesn't fail at scale.

§

Trust & references

Official documentation

Straight from the source - Salesforce's reference material on Governor Limits.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.
§

Test your knowledge

Q1. What is required before deploying Governor Limits-related code to production?

Q2. What skill set is typically needed to work with Governor Limits?

Q3. Where would a developer typically work with Governor Limits?

§

Discussion

Loading…

Loading discussion…