not using index for select min(...) - Mailing list pgsql-performance

From Don Bowman
Subject not using index for select min(...)
Date
Msg-id FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com
Whole thread Raw
Responses Re: not using index for select min(...)
Re: not using index for select min(...)
Re: not using index for select min(...)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: One large v. many small (fwd)
Next
From: Josh Berkus
Date:
Subject: Re: not using index for select min(...)