long running select min(timestamp) query

From: <bobdurie_at_gmail.com>
Date: Mon, 28 Jan 2008 07:40:11 -0800 (PST)
Message-ID: <16988112-03bf-439b-8ded-1d82196d9a6f@c4g2000hsg.googlegroups.com>


Hi,

I have a basic event table in my 10g database, primary integer key, and a nonnull timestamp "eventdate" field. When executing the following command:

select min(eventdate) from events;

It can occasionally take a VERY long time. There is a standard btree index on "eventdate", and roughly 20 other columns, a few of which also have basic btree indexes.

In my current scenario, the table has less than a million records, and the query seems to be taking upwards of 10 minutes!!! Here's what the console says the plan is:

Operation	Object	Object Type	Order	Rows	Size (KB)	Cost	Time (sec)	CPU
Cost	I/O Cost
SELECT STATEMENT			3				4
 SORT AGGREGATE				2	1	0.011
  INDEX FULL SCAN (MIN/MAX) EVENTS_EVENTDATE	INDEX	1	736195	7,908.345
4	1	28686	4

I've run the ADDM, it updated the stats, but that doesn't seem to help (i run it again it has no recommendations). Am i doing something silly with this table or is there some better way for me to phrase this query?

Thanks,
Bob Received on Mon Jan 28 2008 - 09:40:11 CST

Original text of this message