pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: henk de wit <henk53602@hotmail.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: How to speed up min/max(id) in 50M rows table?
Date: Fri, 12 Oct 2007 23:40:54 +0200
Message-ID: <BAY124-W50228E83905C05AA18AF57F5A00@phx.gbl> (raw)
In-Reply-To: <470FE136.2010601@emolecules.com>
References: <BAY124-W503931258D0AE13AF37546F5A00@phx.gbl>
	<470FE136.2010601@emolecules.com>

>   select payment_id from transactions order by payment_id desc limit 1;

This one is indeed instant! Less than 50ms. In my case I can't use it for max though because of the fact that payment_id can be null (which is an unfortunate design choice). The other variant however didn't become instant. I.e. I tried:

select time from transactions where payment_id = 67 order by time asc limit 1;

But this one is still really slow.

Regards



_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/=

view thread (12+ messages)  latest in thread

Message-ID: <BAY124-W50228E83905C05AA18AF57F5A00@phx.gbl>
Permalink:  ../BAY124-W50228E83905C05AA18AF57F5A00@phx.gbl/
Also on:    postgresql.org/message-id/BAY124-W50228E83905C05AA18AF57F5A00@phx.gbl

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: henk53602@hotmail.com
  Subject: Re: How to speed up min/max(id) in 50M rows table?
  In-Reply-To: <BAY124-W50228E83905C05AA18AF57F5A00@phx.gbl>
  References: <BAY124-W503931258D0AE13AF37546F5A00@phx.gbl> <470FE136.2010601@emolecules.com> <BAY124-W50228E83905C05AA18AF57F5A00@phx.gbl>

* 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