开发者

mysql select .. where .. in -> optimizing

开发者 https://www.devze.com 2023-04-03 20:02 出处:网络
I have a table with a number of columns and ~15K rows. Most important among these are three we\'ll call \'a\', \'b\' and \'c\'. I have an index on these columns in that order (a, b, c).

I have a table with a number of columns and ~15K rows. Most important among these are three we'll call 'a', 'b' and 'c'. I have an index on these columns in that order (a, b, c).

When I do a 'desc select * from <table> where a = <some value> or a = <some other value>' Im told that it grabs the value with 2 rows. This is expected.

When I do a 'desc select * from <开发者_如何转开发table> where a in <some list of values>' Im told that it isn't using the index at all.

Why not? Is there some way to create an index such that 'where <column> in <list of values>' is indexed?

0

精彩评论

暂无评论...
验证码 换一张
取 消