I think you are stuck. I can't think of any way to create an index on just
a piece of a column's data. I believe you need to create separate columns
of data for each portion of the date you want to search and index those.
That could mean up to 6 additional columns of data for your table,
depending on how granular you need to search your dates.
Sorry,
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
chastang
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
u> cc:
Fax to:
06/24/2004 04:49 Subject: Optimizing selects based on
date functions.
PM
Hello.
My question concerns a large data table that has a DATETIME column
called dt. Specifically, I am often having to do selects based on date
and time functions that look like this:
select * from my_table where hour(dt)= 0
or
select * from my_table where month(dt) = 6
What index should I create to optimize selects on these sorts of
queries? ["create index my_index on my_table(dt)" does not help.]
Thanks. -JC
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]