⚡
SF DEV TOOLKIT
Apex · SOQL · LWC · Patterns
API v62.0
Salesforce Platform
Governor Limits Reference
Per-transaction execution limits enforced by the Salesforce runtime. Exceeding these throws a LimitException. Design all Apex with bulkification in mind.
Sync Transaction
⚡ Async limits are generally 2× higher
DML Operations
DML Statements
insert, update, delete, upsert, merge, undelete per transaction
150
DML Rows
Total records across all DML operations
10,000
SOQL Queries
SOQL Queries
SELECT statements issued per transaction (sync)
100
SOQL Rows Returned
Total records returned across all queries
50,000
SOQL Rows via Database.getQueryLocator
Used in Batch Apex start() method
50M
CPU & Memory
CPU Time
Synchronous execution (10s async)
10s
Heap Size
Sync (12MB async). Avoid storing full sObject lists in memory.
6MB
Callouts
HTTP Callouts
Cannot mix callouts and DML without @future(callout=true)
100
Callout Timeout
Per single HTTP request (configurable up to max)
120s
Runtime Limit Checking Apex
// Always check limits before costly operations in loops
if (Limits.getDmlStatements() < Limits.getLimitDmlStatements() - 10) {
    // Safe to DML — 10 statement buffer
    insert recordsToInsert;
}

// Log current consumption (useful in debug / monitoring)
System.debug('SOQL used: ' + Limits.getQueries() +
    ' / ' + Limits.getLimitQueries());
System.debug('DML rows: ' + Limits.getDmlRows() +
    ' / ' + Limits.getLimitDmlRows());