What is a governor limit, and which ones matter most in practice?
Model answer
Salesforce is multitenant: many customers share the same infrastructure. Governor limits cap what one transaction can consume, so one tenant can't starve the others.
The ones that bite most often (per transaction):
- SOQL queries: 100 synchronous, 200 asynchronous; 50,000 rows returned.
- DML statements: 150; 10,000 rows processed.
- CPU time: 10 seconds synchronous, 60 seconds asynchronous. It includes Flow and validation work in the same transaction.
- Heap: 6 MB synchronous, 12 MB asynchronous.
- Callouts: 100 per transaction, with timeouts.
- Async: 50 future calls or queueables enqueued from a synchronous transaction.
Designing for them: bulkify; query only needed fields and rows (selective filters); move heavy or deferrable work to async; use Limits methods to check headroom; and test with realistic volumes.
โ Key points to hit
โ Red-flag answers
- 'Limits are per user per day'
- Thinking limits can be raised on request
- Ignoring CPU used by declarative automation
โช Follow-ups
How can declarative automation affect Apex limits?
Flows, validation rules and other automation run in the same transaction and share CPU, SOQL and DML limits. A heavy record-triggered flow can push Apex over the CPU limit.
What's the difference between a per-transaction limit and an org limit?
Per-transaction limits reset with each transaction (SOQL, DML, CPU). Org limits accumulate over time, such as daily API calls, daily async executions and storage. Both shape design.