Skip to main content
Development

What are Governor Limits in Salesforce?

Governor Limits are runtime caps enforced by the Salesforce platform to ensure no single tenant monopolizes shared resources in the multi-tenant architecture.

Clientell AI, the AI Salesforce admin, helps with Governor Limits in a sandbox: it writes and tests the code, and shows it to you before anything deploys. See Apex and query generation

Try it in Clientell AI

“Write a Governor Limits example for my Account object, test it in a sandbox, and show me the code before anything deploys.”

Clientell reads your org first, drafts every change, and changes nothing until you approve. Platform deployments include rollback. How security works.

Start the 14-day free trial, no card

Term Context

Category

Development

10 terms in this category

Related Terms

4

connected concepts

Glossary

66

total definitions

How does Governor Limits work in Salesforce?

Because Salesforce runs on shared infrastructure where thousands of orgs coexist on the same servers, governor limits prevent any single transaction from consuming excessive CPU, memory, or database resources. Key limits include 100 SOQL queries per synchronous transaction (200 asynchronous), 150 DML statements per transaction, 10-second CPU time limit, 6 MB heap size, and 100 callouts per transaction. Exceeding any limit throws a System.LimitException that cannot be caught.

Understanding governor limits is fundamental to writing efficient Apex. Common patterns for staying within limits include bulkifying code (processing collections rather than single records), using Maps for O(1) lookups instead of nested loops with queries, using SOQL aggregates to reduce query counts, and offloading heavy processing to asynchronous methods like Batch Apex, Queueable, or @future. The Limits class provides runtime methods (e.g., Limits.getQueries(), Limits.getDmlStatements()) to monitor consumption mid-transaction. Clientell AI generates governor-limit-safe code by default and can audit existing Apex for limit-risk patterns.

Questions people ask

What are governor limits in Salesforce?

Caps on how much a single transaction can use, so no one customer slows down the shared servers.

What are the main Apex governor limits?

100 SOQL queries (200 async), 150 DML statements, 10,000 DML rows and 50,000 rows returned by queries per transaction.

What are the CPU and heap limits?

10 seconds of CPU time and 6 MB of heap for synchronous Apex. Asynchronous Apex gets 60 seconds and 12 MB.

How do I avoid governor limit errors?

Bulkify your code: query and update records in groups, never inside a loop.

Getting Started

Try this on your own org

Start the 14-day free trial, no card. Clientell scans read-only first and changes nothing until you approve.

14-day free trial  ·  No credit card required

SOC 2
HIPAA
GDPR
Salesforce Partner