Chapter 7. Initial Steps in Tuning a Query
Developers commonly face the problem of having a program or SQL statement that should be running faster. Many time, they’re not sure exactly where to start fixing this problem. Following is a list of steps to follow in order to find the issue and improve the performance:
1. Check the predicates. Whether it is one query or multiple queries in a program, check every predicate in every query to ensure that they are indexable, stage 1, and as simple and straightforward as possible.
2. If there is a Distinct or Group By in the query, make sure it is needed and then look at the Explain to see if it is causing a sort to take place. If the Distinct or Group By is needed, maybe there is another way to rewrite ...