MySQL Forums
Forum List  »  Perl

Re: How to use Query Cache with Perl DBI
Posted by: David Shrewsbury
Date: September 02, 2006 10:37PM

No, that's not true. The query cache will be used if you send MySQL a non-prepared statement that has already been executed, as Bill K. stated. For example, this code will make use of the query cache (as long as it is enabled):

$res= $dbh->selectall_arrayref("select * from testaa"); # 1st call, not cached
$res= $dbh->selectall_arrayref("select * from testaa"); # 2nd call, cached

If you are looking to avoid contacting the database server when you prepare a statement more than once, try using the DBI subroutine 'prepare_cached()'.

-Dave

Options: ReplyQuote


Subject
Written By
Posted
September 01, 2006 10:20AM
Re: How to use Query Cache with Perl DBI
September 02, 2006 10:37PM


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.