List:General Discussion« Previous MessageNext Message »
From:Tim McDaniel Date:March 10 2008 3:44pm
Subject:Re: MYSQL FUNCTIONS
View as plain text  
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
> below"
...
> NOW()
> 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.

<http://www.mysqlperformanceblog.com/2006/07/27/mysql-query-cache/> is
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
Thread
MYSQL FUNCTIONSKrishna Chandra Prajapati10 Mar
  • Select StatementVelen10 Mar
    • Re: Select StatementSebastian Mendel10 Mar
    • Re: Select StatementSebastian Mendel12 Mar
  • Re: MYSQL FUNCTIONSSebastian Mendel10 Mar
  • Re: MYSQL FUNCTIONSTim McDaniel10 Mar
Re: Select StatementVelen10 Mar
  • Re: Select StatementPeter Brawley10 Mar
    • Re: Select StatementBaron Schwartz10 Mar