Chapter 13. Database Tuning
SQL is a language that describes how you retrieve data from a database. Just as in any language, you can say things that make sense but that may not mean what you intend or that can be misinterpreted and cause results that are not what you expect. By now you should be pretty good at expressing yourself in SQL and you should be getting the results, or at least the data, that you intend. On the other hand, you might get exactly the data you expect but it takes a long time to get the data back. That is the subject that this chapter addresses. Specifically, this chapter addresses the following questions:
Why does your query take so long to execute?
Is this just normal, or is there something you can do to get the results faster?
When does it matter?
In fact, tuning SQL is just one piece of the bigger puzzle, which is tuning the system itself. In-depth system tuning is outside the scope of this chapter, but an overview of the subject is useful since it is possible to get large improvements in speed at this level. You may find that the database is administered by professionals and that they have already done all that can be done at this level. On the other hand, you may find yourself playing system administrator and realize that you are the only one around who can look at whether some of these issues can be addressed. Or you may find that the database is being administered by a network administrator with no real experience as a database administrator and that a ...
Get Beginning SQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.