November 17, 2013
Preface: this post is part of the Bulkify Your Code series.
Governor limits are Salesforce’s way of forcing you to write efficient, scalable code.
The good:
- Governor limits prevent other orgs from writing bad code and taking up all the cloud CPU.
- Coding limits in general are completely unique to Apex – consider it job security!
- You have a friend that will teach you how to dominate these limits!
The bad:
- These are hard limits on your org preventing you, for example, from doing too many SOQL queries in a trigger (max: 100 queries).
- Upgrading your edition or paying Salesforce more money will not increase your limits! The only workaround is to understand how to navigate around them.
The ugly:
- Whether you like it or not, you will run into governor limits!
There’s no need to be intimidated though, getting around governor limits isn’t difficult and there’s always a way around them. Plus, after this chapter, you will be the governor limit master!!
Coming soon to a theater near you!
Mean Girls 2: The story of two best frenemies – the Salesforce developer and governor limits!

Next post: We write an inefficient Apex trigger and fix it!
Hi David..
Please post some project related interview Q&A..
Thanks
Sonia
There’s going to be a ton in the Apex Academy!
hi david i want to write code for updating the account records using account_id how can i write the code…
Practice, practice, practice!
Hello david,
Can you teach me the salesforce objects(for administration ) and how they are related to each other(like where its starts and where its ends)
There’s got to be some good documentation out there – I only focus on code sorry!
I fall in love with this site. Awesome resource for beginners,
Hi David,
Just wanted to say thank you again for your posts. This is by far, the best resource for beginners trying to learn Apex on the entire web (And I have searched through a lot of them). No other site explains what each line of code is doing and why in such an easy to understand way. If you were running online classes or webinars, I am sure you would have hundreds of people signing up. I know I would. (something you might consider hopefully) I also think I would be confident writing effective triggers containing SOQL queries in about 2 weeks if your classes contained content like this site!!! Please continue to write and if possible, include some more exercises (Write a trigger to do this……etc). For me anyway, the best way to learn is just to start writing triggers and then try to understand why it is or isn’t working. Sadly, I am short on ideas on sample triggers to write so if you have any exercises, I would really appreciate it.
Thanks again.
Graham
Hey Graham,
So glad you’re enjoying my site! The online classes are a great idea! Maybe one day in the future when I have more viewership!
Try writing a trigger that counts the number of tasks on the record =)
David