At 03:49 PM 6/24/2004, you wrote:
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 mon
chastang wrote:
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?
An index isn't going to help you there unless you create separate
columns for hour and month. The columns will be redund
cc:
Fax to:
06/24/2004 04:49 Subject: Optimizing selects based on
date functions.
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 cre