From: Don Bowman <don@sandvine.com>
To: 'pgsql-performance@postgresql.org' <pgsql-performance@postgresql.org>
Subject: not using index for select min(...)
Date: Fri, 31 Jan 2003 16:12:38 -0500
Message-ID: <FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com> (raw)
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;
Aggregate (cost=22.50..22.50 rows=1 width=4)
-> Seq Scan on x (cost=0.00..20.00 rows=1000 width=4)
=> \d x
Table "public.x"
Column | Type | Modifiers
--------+---------+-----------
value | integer | not null
Indexes: x_pkey primary key btree (value)
Why wouldn't I be doing an index scan on this table?
--don
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: don@sandvine.com
Subject: Re: not using index for select min(...)
In-Reply-To: <FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com>
References: <FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com>
* 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