In my neverending quest to make sure my sites run smoothly, I was investigating ways I could debug Wordpress. I know about the usual PHP debugging steps, but that only really helps when PHP isn't actually encountering any problems and it's certainly not very good at working out things behind the scenes, like the MySQL queries Wordpress makes short of adding a lot of PHP code.
Using my trusty research tool, I stumbled upon a post by Stilgar - "Debugging WordPress database queries" (Update: 1 May '09 - link removed as it appears to now be a owned by porn spammers). This is just what I was looking for - a nice quick simple way of displaying the MySQL statements used when generating a page. Stilgar even goes on to provide a quick little change to the WP code to allow you to display exactly which file and which lines actually called this code. What a fantastic time saver.
I've also learnt something else today - I didn't realise Wordpress used ezSQL. I'm glad I know now as it wouldn't take much to port Wordpress to another ezSQL supported database if needed.
I've now added this to my arsenal of debugging Wordpress tools (which I'll detail soon).