Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2007-12-13 23:54:41
Subject: Re: Slow query after upgrades
Previous:From: Tom DuffeyDate: 2007-12-13 23:27:06
Subject: Re: Slow query after upgrades

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group