pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: henk de wit <henk53602@hotmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: How to speed up min/max(id) in 50M rows table?
Date: Sat, 13 Oct 2007 01:48:23 +0200
Message-ID: <BAY124-W6A22203954AFD10A097DBF5A00@phx.gbl> (raw)
In-Reply-To: <6275.1192229463@sss.pgh.pa.us>
References: <BAY124-W503931258D0AE13AF37546F5A00@phx.gbl>
	<5754.1192226626@sss.pgh.pa.us>
	<BAY124-W124912A351A1628891721FF5A00@phx.gbl>
	<6275.1192229463@sss.pgh.pa.us>

>select min(time) from transactions where payment_id is null
>So for that situation I tried whether a specific index helped, i.e. :
>create index transactions__time_payment_id__null__idx on transactions(time) where payment_id is null;
>But this does not really seem to help. It might be better to see if I can refactor the DB design though to not use nulls.

I was posting too fast again, the previous index -does- work, making the above query instant (<50ms) :) I actually mis-typed the test query before (it's rather late at my place):

select min(payment_id) from transactions where payment_id is null

Although not useful, it's an interesting case. One would say that it could return quickly, but it takes 26 minutes to execute this.



_________________________________________________________________
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)

Message-ID: <BAY124-W6A22203954AFD10A097DBF5A00@phx.gbl>
Permalink:  ../BAY124-W6A22203954AFD10A097DBF5A00@phx.gbl/
Also on:    postgresql.org/message-id/BAY124-W6A22203954AFD10A097DBF5A00@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, tgl@sss.pgh.pa.us
  Subject: Re: How to speed up min/max(id) in 50M rows table?
  In-Reply-To: <BAY124-W6A22203954AFD10A097DBF5A00@phx.gbl>
  References: <BAY124-W503931258D0AE13AF37546F5A00@phx.gbl> <5754.1192226626@sss.pgh.pa.us> <BAY124-W124912A351A1628891721FF5A00@phx.gbl> <6275.1192229463@sss.pgh.pa.us> <BAY124-W6A22203954AFD10A097DBF5A00@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