Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-performance by date

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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group