Re: Can this query go faster??? - Mailing list pgsql-performance

From Bruno Wolff III
Subject Re: Can this query go faster???
Date
Msg-id 20051206205048.GB22168@wolff.to
Whole thread Raw
In response to Re: Can this query go faster???  (Csaba Nagy <nagy@ecircle-ag.com>)
List pgsql-performance
On Tue, Dec 06, 2005 at 10:52:57 +0100,
  Csaba Nagy <nagy@ecircle-ag.com> wrote:
> Joost,
>
> Why do you use an offset here ? I guess you're traversing the table
> somehow, in this case it would be better to remember the last zipcode +
> housenumber and put an additional condition to get the next bigger than
> the last one you've got... that would go for the index on
> zipcode+housenumber and be very fast. The big offset forces postgres to
> traverse that many entries until it's able to pick the one row for the
> result...

The other problem with saving an offset, is unless the data isn't changing
or you are doing all of the searches in one serialized transaction, the
fixed offset might not put you back where you left off.
Using the last key, instead of counting records is normally a better way
to do this.

pgsql-performance by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Performance degradation after successive UPDATE's
Next
From: Alan Stange
Date:
Subject: Re: postgresql performance tuning