List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 19 1999 3:35pm
Subject:date type INDEX problem?
View as plain text  
>>>>> "Silver" == Silver CHEN <silver@stripped> writes:

Silver> Dear Sir:
Silver>   I have a question on the index of mysql.

Silver>   If I created an index on some 'date type' column ('0000-00-00'), 
Silver>   what will happen if I use year(date_column) to make a qeury?
 
Silver>   (ex. select count(*) from tbl where year(date_column) > 1977)

Silver>   It seems that mysql will not use that index, right?

Yes.

Silver>   If so, how should I do to let mysql use that index?

SELECT * from table where column >= "1998-01-01")

Silver>   And on the other hand, can I use 'part of' the date type column
Silver>   to create an index as what the manual said on CHAR types? 

This will not work on a DATE column.

Silver>   Or it is just rediculus?

Silver>   Thanks for your reply!

Regards,
Monty
Thread
date type INDEX problem?Silver CHEN19 Sep
  • date type INDEX problem?Michael Widenius19 Sep