not using index for select min(...)

Поиск
Список
Период
Сортировка
От Don Bowman
Тема not using index for select min(...)
Дата
Msg-id FE045D4D9F7AED4CBFF1B3B813C8533701023616@mail.sandvine.com
обсуждение исходный текст
Ответы Re: not using index for select min(...)  (Josh Berkus <josh@agliodbs.com>)
Re: not using index for select min(...)  (Andrew Sullivan <andrew@libertyrms.info>)
Re: not using index for select min(...)  (Bruno Wolff III <bruno@wolff.to>)
Список 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 по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: One large v. many small (fwd)
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: not using index for select min(...)