Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Apache::DBI, DBI, DBD::MySql and MySQL cache?

by blm (Hermit)
on Mar 17, 2003 at 04:23 UTC ( [id://243579] : note . print w/replies, xml ) Need Help??


in reply to Apache::DBI, DBI, DBD::MySql and MySQL cache?

What version of mysql are you using?

Starting in version 4.0.1 there is a "query cache"(1). You can see whether your mysql has this cache with the following query. (2)

SHOW VARIABLES LIKE 'have_query_cache';

According to the Mysql manual page mysql keeps in this cache a table of queries and the corresponding results. When an identical query is received the results out of the cache are returned. This is what one would expect. There is a big note:


NOTE: The query cache does not return stale data. When data
is modified, any relevant entries in the query cache are
flushed. 

I am not sure but I would assume that since the table is not modified and the query is not modified the result would come from the cache. You can turn off the cache using options in the select query as noted (here).

Replies are listed 'Best First'.
Re: Re: Apache::DBI, DBI, DBD::MySql and MySQL cache?
by Flame (Deacon) on Mar 17, 2003 at 04:34 UTC

    Unfortunately, I'm pretty out of date, I'm not sure where I found it anymore, but I seem to remember (was busy trying to get anything working back then) using an RPM, anyway, my current version is only 3.23.55, and it rejects a statement such as "SELECT SQL_NO_CACHE quote,author FROM quotes ORDER BY RAND() LIMIT 1" as SQL_NO_CACHE is not a valid column. I suppose I could try having it return NOW() as well?





    My code doesn't have bugs, it just develops random features.

    Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)