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...


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to