Re: Is query cache used for prepared statements?
Posted by: Mark Matthews
Date: January 25, 2005 07:02PM

Peter Moore wrote:
> Hi,
> I know this is kind of an odd question, but when
> using a prepared statement, is the query cache
> still used?


No, it is not. It is planned to integrate the two some day, however you might actually _lose_ performance once it's implemented, as the query would have to be 'reconstituted' from the original SQL and parameter values before the query cache coul d be used (as the query cache works at a SQL query level and uses string hasing and simple lexicographical comparison to find cached data, which is why it's very fast). Other ways of integrating the query cache with server-side prepared statements would bypass the simplicity of the hashing method used which gives the query cache its speed.

You might try _not_ using server-side prepared statements with your application, and still enabling the query cache to see whether it is a performance 'win' in your case...Simply add 'useServerPrepStmts=false' to your JDBC url.


Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools

Options: ReplyQuote

Written By
Re: Is query cache used for prepared statements?
January 25, 2005 07:02PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.