MySQL Forums
Forum List  »  Optimizer & Parser

Substring ignores index
Posted by: Matt Ryan
Date: September 29, 2006 08:59AM

Not sure if this is a bug or a "feature"

this query hits the don index, 14 char normal index
select * from cbcom where don LIKE 'W919AK%'

this query does not

select * from cbcom where substring(don,1,6)='W919AK'

the problem is I'm trying to do a join on another table

select b.* from afghanistan_dodaac a inner join cbcom b
on a.dodaac = substring_index(b.don,1,6)

no indexes are hit, it runs 30 minutes,

id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE b ALL 15,128,943
1 SIMPLE a ref DODAAC DODAAC 6 func 1 Using where; Using index

Options: ReplyQuote

Written By
Substring ignores index
September 29, 2006 08:59AM
September 29, 2006 09:48AM
February 09, 2007 04:01AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.