Re: How to speed up min/max(id) in 50M rows table? - Mailing list pgsql-performance

From henk de wit
Subject Re: How to speed up min/max(id) in 50M rows table?
Date
Msg-id BAY124-W6A22203954AFD10A097DBF5A00@phx.gbl
Whole thread Raw
In response to Re: How to speed up min/max(id) in 50M rows table?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
>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! MSN Messenger

pgsql-performance by date:

Previous
From: henk de wit
Date:
Subject: Re: How to speed up min/max(id) in 50M rows table?
Next
From: Stéphane Schildknecht
Date:
Subject: Vacuum goes worse