Database performance is one of the major bottlenecks for most web applications. Most web developers are not database experts (and I'm no exception), there are however several basic methods to analyze and optimize database performance without resorting to expert consultants. [...] Since I'm dealing mostly (only?) with MySQL, this article covers it mainly (though it is probably relevant to a large degree for other engines).
Eran talks about first profiling your application and checking to see where the real problems might be. Something as simple as microtime can be used to check out the script execution time. For something a bit more powerful, though, the Zend_Db_Profiler component is suggested. It makes it possible to run sample queries from your data and get back the relevant query's runtime (with no page manipulation involved).