I plan to add some kind of prepared statement caching in a (not too distant) future PDO release, however...
You'd only benefit from prepared statement caching when the underlying driver supports it. Not only does it require support from the driver, but it also requires good, solid support for it to be worthwhile. Taking postgres as an example, it's prepared statement implementation has some issues with query planning that might make this an unnatractive prospect--to the point where the postgres driver has a flag to disable native prepared statements for those cases where it makes a difference. Caching PDO emulated prepared statements will have negligible benefit. Just like any feature, you'll need to evaluate whether it's use will make sense for your application. --Wez. On 9/22/05, Ron Korving <[EMAIL PROTECTED]> wrote: > > > 2) Could it be a good idea (performance wise) and possible in the first > > > place to maintain a pool of prepared statements? Something like this: > > > > This should be done on the RDBMS end. I havent looked at how PDO does > > this in detail, but it would be nice to get some more control over this. > > Some RDBMS will pool this automatically, some do not (AFAIK pgsql will > > always create a new statement instead of returning a handle to an > > existing statement). There is a reason why you may want more control > > over this. One of the key aspects of a prepared statement is that you > > safe time due to not having to build a query plan on every execution. > > This may bite you however if you prepare a statement and then things > > change within the database that would make it more feasible to use a new > > plan. > > It would be very nice if this was indeed done by the RDBMS. That would mean > you don't have to "remember" any prepared statements yourself and would > definately benefit the performance a great deal. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php