Re: Avoiding bad prepared-statement plans. - Mailing list pgsql-hackers

From Mark Mielke
Subject Re: Avoiding bad prepared-statement plans.
Date
Msg-id 4B882F17.8050909@mark.mielke.cc
Whole thread Raw
In response to Re: Avoiding bad prepared-statement plans.  (Yeb Havinga <yebhavinga@gmail.com>)
Responses Re: Avoiding bad prepared-statement plans.  (Yeb Havinga <yebhavinga@gmail.com>)
List pgsql-hackers
On 02/26/2010 03:11 PM, Yeb Havinga wrote:
> Tom Lane wrote:
>> Right, but if the parameter is unknown then its distribution is also
>> unknown.  In any case that's just nitpicking, because the solution is
>> to create a custom plan for the specific value supplied.  Or are you
>> suggesting that we should create a way for users to say "here is the
>> expected distribution of this parameter", and then try to fold that into
>> the planner estimates?
> 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.

Cheers,
mark



pgsql-hackers by date:

Previous
From: Yeb Havinga
Date:
Subject: C libpq frontend library fetchsize
Next
From: Tom Lane
Date:
Subject: Re: Hot Standby query cancellation and Streaming Replication integration