Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19120 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46236 invoked by uid 1010); 22 Sep 2005 13:11:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 46221 invoked from network); 22 Sep 2005 13:11:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Sep 2005 13:11:25 -0000 X-Host-Fingerprint: 64.233.162.198 zproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.162.198:57213] helo=zproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A7/6E-24510-D7DA2334 for ; Thu, 22 Sep 2005 09:11:25 -0400 Received: by zproxy.gmail.com with SMTP id 40so192651nzk for ; Thu, 22 Sep 2005 06:11:22 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GM6V07Q4IFy8kOStsHBveWwxVu9+MAOMH6xeGW90ehf84mKTHh7m4I23AtRSFbqIljyR3iZvPkIcyRmXMhB60QJinKOMfk+DrBUJapNroXn8En78ewuzGghAd8w0hhIQIsVBIPF99CGKSDqgGLlcKuxqTEORsrMQ3e0CRoEyL0c= Received: by 10.54.16.3 with SMTP id 3mr351329wrp; Thu, 22 Sep 2005 06:11:21 -0700 (PDT) Received: by 10.54.76.6 with HTTP; Thu, 22 Sep 2005 06:11:21 -0700 (PDT) Message-ID: <4e89b42605092206115220983a@mail.gmail.com> Date: Thu, 22 Sep 2005 09:11:21 -0400 Reply-To: Wez Furlong To: Ron Korving Cc: Lukas Smith , internals@lists.php.net In-Reply-To: <003501c5bf6c$1e452bb0$560aa8c0@web03> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <56.98.24510.D3D82334@pb1.pair.com> <433294C3.1090801@php.net> <003501c5bf6c$1e452bb0$560aa8c0@web03> Subject: Re: [PHP-DEV] Re: PDO questions From: kingwez@gmail.com (Wez Furlong) 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 wrote: > > > 2) Could it be a good idea (performance wise) and possible in the fir= st > > > 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 wil= l > > 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 ne= w > > plan. > > It would be very nice if this was indeed done by the RDBMS. That would me= an > you don't have to "remember" any prepared statements yourself and would > definately benefit the performance a great deal.