Greetings Having a table with the following structure -
+---------+---------------+-------------------+------+-----+---------+---------- ------+ | Field | Type | Collation | Null | Key | Default | Extra | +---------+---------------+-------------------+------+-----+---------+---------- ------+ | email | char(50) | latin1_swedish_ci | YES | MUL | NULL | | | is_sent | enum('Y','N') | latin1_swedish_ci | YES | | NULL | | | id | int(10) | binary | | PRI | NULL | auto_incr ement | +---------+---------------+-------------------+------+-----+---------+---------- ------+ If I issue a command like this - explain select substring(id,1,4) from email_table where substring(id,1,4) < 300 limit 500; The result returned is - +----+-------------+-------------+-------+---------------+---------+---------+-- ----+-------+--------------------------+ | id | select_type | table | type | possible_keys | key | key_len | r ef | rows | Extra | +----+-------------+-------------+-------+---------------+---------+---------+-- ----+-------+--------------------------+ | 1 | SIMPLE | email_table | index | NULL | PRIMARY | 4 | N ULL | 33914 | Using where; Using index | +----+-------------+-------------+-------+---------------+---------+---------+-- ----+-------+--------------------------+ This means it is using the index. But, if issue a command like - explain select email from email_table where substring(id,1,4) < 300 limit 500; +----+-------------+-------------+------+---------------+------+---------+------ +-------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------------+------+---------------+------+---------+------ +-------+-------------+ | 1 | SIMPLE | email_table | ALL | NULL | NULL | NULL | NULL | 33914 | Using where | +----+-------------+-------------+------+---------------+------+---------+------ +-------+-------------+ the KEY column is NULL i.e. it is not using Index? Why the query is not using index? Thanks in advance. Karam __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]