Hudzilla.org - the homepage of Paul Hudson
Contents > Performance Wish List | Report Bug | About Me ]

18.2     Optimising your SQL

This is NOT the latest copy of this book; click here for the latest version.

So far we've looked at the basics of optimisation, and also went into quite some depth regarding how to make your PHP scripts run faster. However, where's the point in making your scripts run faster if the database that drives them crawls? Optimising your SQL so that it runs faster is equally important! This is a big area, so you are strongly advised to read up on the suggestions given here to see whether they will work in your given situation.

There are three basic routes to take when it comes to optimising your SQL: change your queries, change your table schema, or change your server configuration. We'll be looking at all three, starting with queries.

One of the many advantages to SQL is that it is a true fourth-generation language - you tell it what you want, and it does all the hard work for you. As such, the actual /implementation/ of your query requests is left entirely down to your database server, which means it might not necessarily be doing things in the most optimised way. In order to reach the largest audience, I've covered MySQL techniques here, but many of the same rules will apply elsewhere.





<< 18.1.25 Don\'t fret about Apache 2.0   18.2.1 Prioritise your data >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
Be the first to add a comment to this chapter!



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is nine plus four?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow