[TYPO3-dev] mysql/mysqli and prepared statements

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Sun Oct 7 10:22:58 CEST 2007


ries van Twisk schrieb:
> Hey Martin,
> 
> I have reading somewhere that when using
> MySQL with prepared statements that the query cache
> get's by-passed.

But the query cache is for exact the same statements. Prepared queries 
are for nearly the same queries, where you cache the query plan, not the 
result.

So you shouldn't use prepared queirs everywhere but only in loops like this:

foreach ($someArray as $id) {
   prepare("SELECT foobar FROM table WHERE uid=$id");
}

> Note: since we use the unix timestamp the MySQL
> query cache for SQL's we execute is valid for one
> second anyways. Wasn't there a patch underway for this?

I don't get what you're hinting at.

Masi




More information about the TYPO3-dev mailing list