pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Csaba Nagy <nagy@ecircle-ag.com>
Cc: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
Cc: Pgsql-Performance <pgsql-performance@postgresql.org>
Subject: Re: Can this query go faster???
Date: Tue, 6 Dec 2005 14:50:48 -0600
Message-ID: <20051206205048.GB22168@wolff.to> (raw)
In-Reply-To: <1133862777.4779.185.camel@coppola.muc.ecircle.de>
References: <1133862229.8837.61.camel@Panoramix>
	<1133862777.4779.185.camel@coppola.muc.ecircle.de>

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.



view thread (14+ messages)

Message-ID: <20051206205048.GB22168@wolff.to>
Permalink:  ../20051206205048.GB22168@wolff.to/
Also on:    postgresql.org/message-id/20051206205048.GB22168@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bruno@wolff.to, nagy@ecircle-ag.com, J.Kraaijeveld@Askesis.nl
  Subject: Re: Can this query go faster???
  In-Reply-To: <20051206205048.GB22168@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox