Re: [PDO] Client side cache for prepared queries
[email protected] (Lester Caine) Tue, 02 Aug 2011 16:26:18 +0100
| Newsgroups | php.pdo |
|---|---|
| Message-ID | <[email protected]> |
Julien Palard wrote: > On Tue, Aug 2, 2011 at 3:17 PM, Ferenc Kovacs<[email protected]> wrote: >> if you can use persistent connection, the performance gain will >> accumulate between your requests. > > If and only if the undocumented client side cache really exists, if > calling pdo::prepare create a new one each time, there are no > performance gain at all albeit persistent connection are used, maybe > should I search in the source code to confirm it :P The base premiss of PDO is that all the core functions work identically for any database. MySQL is coming late into the game on prepared queries, and other databases do things differently, so if you want MySQL type operation, then it may be better to switch to the generic driver? In the case of Firebird and Oracle, the preparation has to be done on the at the server end, since only the parameters will be updated later, and the query has to be handled in the context of a transaction, so actually making some of this persistent at all causes problems when many users are holding transactions open without any end in sight. While the connection can be held persistent, holding a transaction open is a no-no, and so anything prepared within that transaction also has to be closed. In these cases we rely on the internal caching within the database engine to speed things up, and asking the same query will pull data from memory normally, but with a current view based on what has happened in other transactions since. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php