Skip to main content
Development

Governor Limits

Governor Limits Explained

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, leveraging 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.

Related Salesforce Terms

Learn More

Ready to transform your Salesforce?

Join hundreds of teams using Clientell AI to automate workflows and boost productivity.

SOC2 Type II
Zero Data Retention
No Credit Card Required