Re: prepared statements and pdo_pgsql
| From: | Wez Furlong | Date: | Tue, 05 Sep 2006 14:40:37 +0000 |
| Subject: | Re: prepared statements and pdo_pgsql | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4108@lists.php.net to get a copy of this message | ||
I thought we had an attribute that allows you to specify the name of the statement, but I don't see it right now.
I have no problem with adding such an attribute to allow the user to select the name we use for prepares. From what I've seen on my brief google around, we'd just need to allow setting the name to the empty string.
--Wez.
Lukas Kahwe Smith wrote:
Hi, there is currently some discussion on the pgsql hackers list on the difference of named and unnamed prepared statements [1]. the gist of the difference is that named prepared statements are parsed and planned immidiatly, while unnamed statements are only parsed and planning is differed until the first execute. in this case the first set of values bound is used to generate the plan. [2] as such named prepared statements produce suboptimal plans for specific values, but better plans when being reused with different parameters. afaik since oracle 9i the unnamed behaviour is what oracle does (not sure if they have some magic to deal with the unfortunate case that the first set of bound values has a much different distribution as later executes). however it seems to be like it would be a good idea to give user some control over this. it should be a general and a statement level attribute. do note that subsequent unnamed prepares overwrite earlier unname prepares, so it is really only meant for one shots, or atleast non concurrent statements on columns that have an even distribution for all values to be bound. regards, Lukas [1] http://archives.postgresql.org/pgsql-hackers/2006-08/msg01933.php [2] http://www.postgresql.org/docs/current/static/protocol-flow.html