index performance question

Поиск
Список
Период
Сортировка
От Laurette Cisneros
Тема index performance question
Дата
Msg-id Pine.LNX.4.44.0209181303120.3174-100000@visor.corp.nextbus.com
обсуждение исходный текст
Ответы Re: index performance question  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-admin
Not sure the right forum to post this...

I have a table that has 20 million rows and growing.  One of the columns is a
timestamptz column.

If I do:

explain select * from bigtable where tscol > '2002-09-17';

I see:
NOTICE:  QUERY PLAN:

Index Scan using pos_timeidx on positions_plus  (cost=0.00..46519.71
rows=1425978 width=108)

EXPLAIN

But, when I do:
explain select min(evtime) from positions_plus;

I see:
NOTICE:  QUERY PLAN:

Aggregate  (cost=548394.90..548394.90 rows=1 width=8)
  ->  Seq Scan on positions_plus  (cost=0.00..499146.92 rows=19699192
width=8)

EXPLAIN

Aren't aggregates smart enough to use an index on the column?  This takes 8
minutes to run!  I can't see that I should have to build a functional index
(is it possible for an aggregate?) to get this to run faster?

Thanks,

--
Laurette Cisneros
The Database Group
(510) 420-3137
NextBus Information Systems, Inc.
www.nextbus.com
----------------------------------
A wiki we will go...



В списке pgsql-admin по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Still big problems with pg_dump!
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: index performance question