Photo by Meghan Schiereck on Unsplash
One of the things that sets Salesforce development apart is the concept of governor limits—and once you understand them, you start to see the platform differently.
These limits aren’t there to punish you—they’re there to ensure the multi-tenant platform stays stable and fair. So now, instead of fighting the limits, I write code with them in mind from the beginning.
Here’s what I watch closely:
SOQL Queries: max 100 per transaction
DML Statements: max 150 per transaction
CPU Time: 10 seconds max per transaction
The biggest shift? I now assume my logic needs to handle bulk operations and stay efficient. That means:
No DML inside loops
Querying only the fields I need
Caching or mapping data to avoid duplicate lookups
Using Limits.getDmlStatements()
and Limits.getCpuTime()
in test classes has helped me stay ahead of surprises before deployment. It’s like checking your vitals before a workout.