OrgReady

Salesforce Skills & Readiness

Learning progress is unavailable. Reading and direct practice remain available; completion controls are disabled.

← Back to Salesforce Development

Lesson 1 of 6 · 5–10 minutes including the walkthrough and reflection

Apex Transactions & Governor Limits

A small operation can share a transaction with other automation. Budget work across the whole operation, not just the method you are writing.

The concept

Apex runs within execution contexts with platform resource limits. Trigger work caused by DML contributes to the transaction. Moving a query into a helper does not make its cost disappear. Limits protect shared platform resources; design for collections rather than relying on an exception handler to rescue an expensive loop.

Worked example

Illustrative work budget, not executable Apex:
For each of N input records:
    helper performs one query
Total queries from this branch: N
Other automation consumes additional budget.

Trace three records through the example: there are three helper invocations and three queries. Now trace a large import. The call graph changes neither the number of records nor the amount of database work. A useful review follows the complete operation, including automation invoked by writes.

Common mistake

Judging safety from a successful one-record execution while ignoring repeated work and downstream automation.

Interview angle

Explain where the transaction starts, what consumes its budget, and how your design changes when the input is a collection. This demonstrates reasoning rather than memorized numbers.

Pause and apply

Before practicing, sketch two helper methods called by the same operation. Mark which work repeats per input. Then explain how you would measure the resource cost in a controlled test. Compare the current official limit documentation before relying on a particular numerical budget.

Official references

Reviewed 2026-09-13. Examples are illustrative; no code is executed here.

Apply it in practice

Savepoint and Rollback for Multi-Step Transaction

Marking a lesson as read records learning activity, not mastery. Practice evidence continues to come from the challenge system.