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 mon

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 redund

Re: Optimizing selects based on date functions.

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