Optimizing selects based on date functions.

2004-06-24 Thread chastang
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

Re: Optimizing selects based on date functions.

2004-06-24 Thread SGreen
: Fax to: 06/24/2004 04:49 Subject: Optimizing selects based on date functions. PM

Re: Optimizing selects based on date functions.

2004-06-24 Thread Keith Ivey
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

Re: Optimizing selects based on date functions.

2004-06-24 Thread mos
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