Thank you, what 's the meaning of "using a datetime field unless it's the last field in the index."?
the below is the desc result;Should I create an index on (source_url,create_date)? for these two fields are to be often queried by. +---------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+--------------+------+-----+---------+----------------+ | id | bigint(20) | NO | PRI | NULL | auto_increment | | create_date | datetime | NO | | | | | brand | varchar(255) | YES | | NULL | | | category | varchar(255) | YES | | NULL | | | description | text | YES | | NULL | | | detailed_desc | text | YES | | NULL | | | imageUrl | varchar(255) | YES | | NULL | | | name | varchar(255) | YES | | NULL | | | price | varchar(255) | YES | | NULL | | | properties | text | YES | | NULL | | | sku | varchar(255) | YES | | NULL | | | source_url | varchar(255) | YES | | NULL | | | link_path | varchar(255) | YES | | NULL | | | site_name | varchar(255) | YES | MUL | NULL | | | page_score | float | YES | | NULL | | | tag | varchar(255) | YES | | NULL | | | dumped | bit(1) | YES | | NULL | | +---------------+--------------+------+-----+---------+----------------+ Brent Baisley wrote: > You can create an index on just about any field. Just remember that > the data in a datetime field is fairly unique, so it would do much > good to create a compound index (2 or more fields) using a datetime > field unless it's the last field in the index. > > ----- Original Message ----- From: "wangxu" <[EMAIL PROTECTED]> > To: <mysql@lists.mysql.com> > Sent: Wednesday, April 11, 2007 8:08 PM > Subject: Can I create a index on a column of Type datetime? > > >> I will very often do query like this: >> >> select * from mytable where create_date >='...' and create_date <='....' >> >> can I create a index on the column create_date? >> >> what is the best practise? >> >> Thanks, >> shell. >> >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] >> > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]