Narrowing down which queries to optimize is a step in database administration that is often skipped - however it shouldn't be!
Why is selecting the right queries to optimize so important? There are several reasons.
Penny-Wise, Pound-Foolish Look at the forest, not just the trees, and optimize globally, not locally. If you’re optimizing a query that never causes a user-visible problem, doesn’t impact other queries, and doesn’t significantly load servers, you might be “optimizing” things that don’t matter, spending more money than you save. Your time has value, too! Keep in mind, too, that optimizing a query that generates only 1% of the database’s overall load will not be a significant benefit to the bottom line. Whack-A-Mole Queries It’s very common to find a slow query in a log file, try re-executing it and then find that it is fast. …
[Read more]