From: | Alex Hunsaker <badalex(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Jeroen Vermeulen <jtv(at)xs4all(dot)nl>, Greg Stark <gsstark(at)mit(dot)edu>, Bart Samwel <bart(at)samwel(dot)tk>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Avoiding bad prepared-statement plans. |
Date: | 2010-02-26 04:28:14 |
Message-ID: | 34d269d41002252028n196327a0kc2ad47add6bab422@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Feb 25, 2010 at 20:40, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> It's not going to be easier to implement. Yeah, it would be easy to
> provide a global switch via a GUC setting, but that's not going to be
> helpful, because this is the sort of thing that really needs to be
> managed per-query. Almost any nontrivial application is going to have
> some queries that really need the custom plan and many that don't.
> If people just turn the GUC on we might as well throw away the plan
> caching mechanism altogether. But putting support for a per-query level
> of control into the protocol (and then every client library) as well as
> every PL is going to be painful to implement, and even more painful to
> use.
Not to mention you can already do this more or less client side with a
nice driver. For example with DBD::Pg i can say:
$sth = $dbh->prepare('select * from foo where x = ?', {'pg_server_prepare'=>1});
To get a prepared plan (it is also the default).
If for a particular query I know that I will get a better plan without
prepare, I can just change that 1 to a 0. Or I can set it globally
via $dbh->{'pg_server_prepare'} = 0;
In other words im not quite sure what this would buy us.
From | Date | Subject | |
---|---|---|---|
Next Message | Gokulakannan Somasundaram | 2010-02-26 04:33:35 | Re: A thought on Index Organized Tables |
Previous Message | Tom Lane | 2010-02-26 04:25:46 | Re: Avoiding bad prepared-statement plans. |