On Mon, 2007-01-15 at 15:54 +0000, John ORourke wrote: > - MySQL caches compiled statements, so why should I bother using > prepare/execute?
Do you mean "Why should I bother using prepare_cached?" The reason for that is the additional overhead of object creation that it avoids on the database client side. The choice to use prepare()/execute() instead of do() or similar has more to do with being able to use bind parameters and the more efficient methods of retrieving data like bind_columns(). This is all documented in the mod_perl docs/books and in Tim Bunce's DBI performance slides on CPAN. > - if MySQL's cache is very efficient, should I bother caching in my own > code? Don't cache query results if you can help it. It adds a lot of complexity to your application. Only do it as a last resort. > - is there any merit in keeping the httpd process size lower by relying > on MySQL or another inter-process cache? If you're going to cache results, you should use something like Cache::FastMmap that will share them between processes or Cache::Memcached that will share them between machines. Otherwise, your hit ratio will not be very good. - Perrin