Re: Avoiding bad prepared-statement plans.
Yeb Havinga <yebhavinga@gmail.com>
From: Yeb Havinga <yebhavinga@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Mark Mielke <mark@mark.mielke.cc>, 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:11:16Z
Lists: pgsql-hackers
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. regards, Yeb Havinga