Skip site navigation (1) Skip section navigation (2)

Re: Avoiding bad prepared-statement plans.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>, Jeroen Vermeulen <jtv(at)xs4all(dot)nl>, Alex Hunsaker <badalex(at)gmail(dot)com>, 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-03-01 02:47:38
Message-ID: 603c8f071002281847v8dafbd5lcb6d554cffe65ae8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sat, Feb 27, 2010 at 11:22 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Fri, Feb 26, 2010 at 7:03 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Wouldn't it be better if it just did the right thing automatically?
>>>
>>> The sort of heuristic I'm envisioning would essentially do "replan every
>>> time" for some number of executions, and give up only if it noticed that
>>> it wasn't getting anything better than the generic plan.  So you'd have
>>> a fixed maximum overhead per session when the custom plan was useless,
>>> and the Right Thing when it wasn't.
>
>> Which is likely useless for my use case.
>
> [ shrug... ]  You'd better explain exactly why, if you want me to take
> that objection seriously.

Hmm... on further thought, maybe it *would* work in that case.  I'm
still not convinced this is going to be generally satisfactory.  It
seems like it depends a great deal on how many times the function
figures to be called per session and in what percentage of those cases
a non-generic plan figures to be better.  The appeal of a
user-controllable knob is that I am pretty sure from experience that I
can set it correctly, but hey...

...Robert

In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-03-01 02:51:14
Subject: Re: Avoiding bad prepared-statement plans.
Previous:From: ChrisDate: 2010-03-01 02:38:08
Subject: Re: [HACKERS] full text search index scan query plan changed in 8.4.2?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group