I've written a little article on optimizing SQL queries:
using a utility called PQA:
I've used PQA to help improve some of the SQL in the popular GForge (http://gforge.org/) project. Hope you find it helpful!
PHP Developer Topics
PHP Developer Resources
PHP Developer References