MySQL Forums
Forum List  »  Performance

Datetime index
Posted by: Paul
Date: May 23, 2006 10:08AM

I have been looking through explain plans and ne of the primary parts of the where clause is "where cast(mytime as date) = curdate()". I created a index on myTime but it doesnt look like MySQL will use it since im trying to reference myTime as a date as opposed to a datetime. I have a feeling that if I could get an index on this I could cut the runtime in half.

In Oracle I would create a function index when I run into this sort of a problem, I have not been able to find how to do this in MySQL.

If that is not possible im assuming the best solution after that would be to have duplicate data by adding in another column thats just a date and then creating an index on it?

Is this something that might be included in a future release?

I am using InnoDB. on Mysql 4.1


Options: ReplyQuote

Written By
Datetime index
May 23, 2006 10:08AM
May 23, 2006 10:14AM
May 30, 2006 12:03PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.