On Mon, 10 Mar 2008, Krishna Chandra Prajapati <prajapatikc@stripped> wrote:
> While i was going through mysql reference manual. I saw that
> "A query cannot be cached if it contains any of the functions shown
> On my production server, the following query is being used.
> select * from student where regis_date=now();
> Then what should i do so that the query get cached.
a paper that explains a bit about MySQL caching. It starts
First let me clarify what MySQL Query Cache is - I've seen number
of people being confused, thinking MySQL Query Cache is the same
as Oracle Query Cache - meaning cache where execution plans are
cached. MySQL Query Cache is not. It does not cache the plan but
full result sets.
That appears to be an expansion of the official text at
<http://dev.mysql.com/doc/refman/5.0/en/query-cache.html>, which is
The query cache stores the text of a SELECT statement together
with the corresponding result that was sent to the client.
(6.0's page has the same sentence.)
That leads me to think that the only way to cache the proposed query
would be to stop time. Otherwise, the result of running NOW() will
change from run to run, causing a different result set.
Tim McDaniel, tmcd@stripped