Re: Slow query after upgrades

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Tom Duffey <tduffey(at)techbydesign(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Slow query after upgrades
Date: 2007-12-13 23:31:05
Message-ID: 22413.1197588665@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver Jowett <oliver(at)opencloud(dot)com> writes:
> Tom Duffey wrote:
>> This makes a huge difference, thanks. However, is there anything I can
>> do to help improve the performance of that query when using a newer
>> protocol?

> We need to work out what is going wrong under the newer protocol first,

It looks pretty obvious from the peanut gallery: in the parameterized
query, the planner daren't choose an indexscan, because for the vast
majority of the possible values of the parameter an indexscan would
suck.

Tom's apparently only interested in the case where the parameter is
close to the end of the range, so that only a few rows need to be
retrieved. In this case the indexscan wins big, but the planner can't
count on that.

A possible hack is to put a reasonably small LIMIT on the query.

regards, tom lane

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2007-12-13 23:54:41 Re: Slow query after upgrades
Previous Message Tom Duffey 2007-12-13 23:27:06 Re: Slow query after upgrades