Re: not using index for select min(...)

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Don Bowman <don(at)sandvine(dot)com>
Cc: "'pgsql-performance(at)postgresql(dot)org'" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: not using index for select min(...)
Date: 2003-02-01 01:02:29
Message-ID: 20030201010229.GA14084@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Fri, Jan 31, 2003 at 16:12:38 -0500,
Don Bowman <don(at)sandvine(dot)com> wrote:
> I have a table which is very large (~65K rows). I have
> a column in it which is indexed, and I wish to use for
> a join. I'm finding that I'm using a sequential scan
> for this when selecting a MIN.
>
> I've boiled this down to something like this:
>
> => create table X( value int primary key );
> => explain select min(value) from x;

Use the following instead:
select value from x order by value limit 1;

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-02-01 01:06:48 Re: [mail] Re: Windows Build System
Previous Message Curt Sampson 2003-02-01 00:26:37 Re: On file locking

Browse pgsql-performance by date

  From Date Subject
Next Message Sean Chittenden 2003-02-01 04:09:54 Re: [PERFORM] not using index for select min(...)
Previous Message Josh Berkus 2003-01-31 23:31:12 Re: not using index for select min(...)