Could someone please help to explain why the following query isn't using the
index...
explain select id from kbm where state = 'MA'
table type possible_keys key key_len ref rows Extra
kbm ALL State NULL NULL NULL 1000000 Using where
The field 'State' is Char(2). It has an index.
This query works great:
explain select id from kbm where Zipcode = '01001'
table type possible_keys key key_len ref rows Extra
kbm ref Zipcode Zipcode 5 const 9828 Using where
The field 'Zipcode' is Varchar(5). It has an index.
I'm confused. I'm using these queries with ColdFusion...and the top query
is taking 12 seconds...the bottom query is 1 second.
Any help is appreciated!
-bruce