Salesforce Governor Limits — Searchable Reference
Skip to main content

Salesforce Governor Limits

Searchable reference of every Salesforce governor limit. Sync vs async values, the matching Limits class method, common mistakes, and links to canonical docs.

Loading limits…

About the Salesforce Limits Reference

Salesforce governor limits are the boundaries every Apex developer must work within. Knowing the exact numbers — SOQL query limits, DML limits, heap size, CPU time, API call limits — is essential for writing code that works in production. This reference covers all major limits with searchable descriptions, scope (sync vs. async), and practical notes on how to avoid hitting them.

Key limit categories

Apex Execution Limits

SOQL queries (100/200), DML statements (150), heap size (6 MB/12 MB), CPU time (10s/60s), callouts (100). These reset per transaction.

API Limits

Daily API call limits vary by edition (e.g. 15,000/day for Developer Edition, 1,000,000+ for Enterprise). Bulk API has separate limits for batch jobs and records per batch.

Schema Limits

Custom objects (200–2,000 depending on edition), custom fields per object (500), custom tabs (25), custom apps (10–unlimited). These are org-wide limits.

Async Apex Limits

Batch Apex: 5 concurrent jobs, 50M records per batch run. Queueable: 50 jobs per transaction. Future: 50 per transaction. Scheduled: 100 scheduled jobs per org.

Avoiding common limit violations

  • SOQL in loops: collect all IDs before the loop, query once outside it
  • DML in loops: build a list inside the loop, call DML once outside
  • Heap size: avoid storing large collections in memory; process in chunks
  • CPU time: move heavy computation to Queueable or Batch Apex
  • Callouts: use Future or Queueable for callouts from triggers

Pipeline

Frequently asked

What are Salesforce governor limits?
Governor limits are enforced boundaries on resource consumption per Apex transaction. They exist to ensure fair multi-tenant resource sharing on Salesforce's shared infrastructure. Exceeding any limit throws a LimitException and rolls back the entire transaction.
What is the most commonly hit governor limit?
The SOQL query limit (100 synchronous / 200 asynchronous) is the most commonly hit limit, usually caused by SOQL queries inside for loops. The DML statement limit (150) and heap size limit (6 MB sync) are also frequently encountered.
What is the difference between synchronous and asynchronous limits?
Synchronous limits apply to code running in real-time (triggers, controllers, REST API calls). Asynchronous limits apply to Batch Apex, Queueable, Future, and Scheduled Apex — they are generally higher because async jobs run in the background.
How do I check governor limit usage at runtime?
Use the Limits class in Apex: Limits.getQueries() returns the number of SOQL queries used so far, Limits.getLimitQueries() returns the maximum. You can check any limit this way before performing an operation that might exceed it.
What are per-transaction vs. per-org limits?
Per-transaction limits reset after each Apex transaction completes. Per-org limits (like the number of custom objects, fields, or API calls per 24 hours) accumulate across all transactions and users in the org.