On 7/11/06, Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> wrote:
Guido Neitzer wrote: > On 11.07.2006, at 19:36 Uhr, Merlin Moncure wrote: > It is not, as prepared statements have the problem that they are only > optimized once and very generically and without actual knowledge of > the parameter content, this is just useless. > > I had the problem a few months ago, where my app server plugin and > the jdbc driver used prepared statements for selecting stuff from the > database. Most of the time, indexes weren't used at all, so > PostgreSQL performance was the worst I've ever seen in this environment. I'm pretty excited about this idea of yours on how to fix this problem. Does it involve the histogram at all?
I've thought for a long time the best way to handle this problem is to allow supplying a hint for any parameter. For example, I like to paramterize the limit statement whicih is actually pretty neat but the planner (iirc) assumes 10% and so resorts to seqscan/bitmapscan in these cases. Merlin