Re: Query slowing down significantly??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rainer Pruy <Rainer(dot)Pruy(at)Acrys(dot)COM>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query slowing down significantly??
Date: 2010-03-01 18:15:00
Message-ID: 20628.1267467300@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Rainer Pruy <Rainer(dot)Pruy(at)Acrys(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Rainer Pruy 2010-03-01 18:49:07 Re: Query slowing down significantly??
Previous Message Rainer Pruy 2010-03-01 17:48:31 Re: Query slowing down significantly??