Rainer Pruy <rainer.p...@acrys.com> writes:
> The prepared statement gives:
> ...
> And that is quite a bad plan given the current distribution of values.

Yeah.  The planner really needs to know the actual parameter values in
order to pick the best plan for this case.

One thing that you might be able to do to avoid giving up on prepared
statements entirely is to use an "unnamed" rather than named prepared
statement here.  That will lead to the query plan being prepared only
when the parameter values are made available, rather than in advance.
It'd depend on what client library you're using whether this is a simple
change or not.

                        regards, tom lane

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to