[TYPO3-dev] mysql/mysqli and prepared statements

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


ries van Twisk schrieb:
> 
> One problem with this that the query plan
> might need to change with different parameters
> for optimal performance. However, since it's a prepared
> query, it will not change!!! Please note that PostgreSQL
> uses statistics to decide how to execute a query,

And if you don't, you're query plan will be determined for every sinle 
statement. But, as with all optimizations, you have to check if you're 
doing the right thing. Normally you're bound query argument wouldn't 
change the whole query plan. But if it does, then of course don't use a 
prepared query.

> Also, when I look at our current SQL queries, they are really simple,
> so it might be faster for the RDBM just to figure out the optimal
> execution plan for each query, rather then use prepared
> statements which can result in sub-optimal performance (see my last mail).

Again, use them only in special circumstances as within a loop. There is 
no need to prepare ALL statements.

Masi




More information about the TYPO3-dev mailing list