Best Practices to follow While debugging a batch class:
Remove unnecessary code and loops
Efficient use of collections (Set, Hashmap or List)
Avoid using loop within loop
SOQL query should be indexable
Avoid unnecessary re-initialization of variables
Use Aggregated SOQL (as Database operations not counted in this limit, avoid arithmetic operations in Apex)
Check how much time Workflow rules and process builders are taking
Is there any manage package performing heavy operations in transaction
Comments