Apex
Governor limits and bulkification
Explain limits through practical design decisions, with three interview questions.
By Vishal Verma · Reviewed October 5, 2026
Practice these questions aloud. Give the principle, explain a concrete example, and finish with how you would verify the result.
1. Why does SOQL inside a loop fail at scale?
Suggested answer: Each iteration consumes another query. Collect IDs, query related records once, and use maps to associate results. Also consider returned row counts, CPU, heap, and automation triggered by DML.
Scenario / follow-up: A 200-record import works for one record but fails in bulk. Trace all automation in the transaction, not only your trigger.
2. Does moving work to asynchronous Apex remove limits?
Suggested answer: No. Asynchronous contexts have their own limits and shared platform constraints. Choose them for transaction separation and appropriate workloads, not as an unlimited escape route.
Scenario / follow-up: Explain how you would split work and monitor failed jobs.
3. How would you reduce CPU time?
Suggested answer: Measure the expensive path. Replace repeated nested scans with indexed lookups, avoid repeated computations, and review queries and triggered automation. Preserve correct behavior while optimizing.
Scenario / follow-up: Describe the tradeoff between memory used by a map and repeated iteration.
Reviewed October 5, 2026. Check the linked documentation for your org’s API version and supported features.