Re: Avoiding bad prepared-statement plans.

Yeb Havinga <yebhavinga@gmail.com>

From: Yeb Havinga <yebhavinga@gmail.com>
To: Mark Mielke <mark@mark.mielke.cc>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, Jeroen Vermeulen <jtv@xs4all.nl>, Alex Hunsaker <badalex@gmail.com>, Greg Stark <gsstark@mit.edu>, Bart Samwel <bart@samwel.tk>, Pavel Stehule <pavel.stehule@gmail.com>, pgsql-hackers@postgresql.org
Date: 2010-02-26T20:46:27Z
Lists: pgsql-hackers
Mark Mielke wrote:
> On 02/26/2010 03:11 PM, Yeb Havinga wrote:
>> Or instead of letting users give the distribution, gather it 
>> automatically in some plan statistics catalog? I suspect in most 
>> applications queries stay the same for months and maybe years, so 
>> after some number of iterations it is possible to have decent call 
>> statistics / parameter distributions. Maybe the the parameter value 
>> distribution could even be annotated with actual cached plans.
>
> The problem with the last - actual cached plans - is that it implies 
> the other aspect I have been suggesting: In order to have a custom 
> cached plan, the primary model must be to use custom plans. If 
> PREPARE/EXECUTE uses generic plans normally, than the only cached 
> plans available will be generic plans.
I should have been clearer, with 'actual cached plans' I meant 'cached 
plans planned with actual parameters' or 'cached custom plans'. It makes 
no sense to annotate points or intervals in a gathered value 
distribution with generic plans.

regards,
Yeb Havinga