pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Don Bowman <don@sandvine.com>
Cc: 'pgsql-performance@postgresql.org' <pgsql-performance@postgresql.org>
Subject: Re: not using index for select min(...)
Date: Fri, 31 Jan 2003 19:02:29 -0600
Message-ID: <20030201010229.GA14084@wolff.to> (raw)
In-Reply-To: <FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com>
References: <FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com>

On Fri, Jan 31, 2003 at 16:12:38 -0500,
  Don Bowman <don@sandvine.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;



view thread (12+ messages)  latest in thread

Message-ID: <20030201010229.GA14084@wolff.to>
Permalink:  ../20030201010229.GA14084@wolff.to/
Also on:    postgresql.org/message-id/20030201010229.GA14084@wolff.to

 · 

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: bruno@wolff.to, don@sandvine.com
  Subject: Re: not using index for select min(...)
  In-Reply-To: <20030201010229.GA14084@wolff.to>
  References: <FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com> <20030201010229.GA14084@wolff.to>

* 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