3
请教一个 MYSQL 联合索引字段顺序的问题
source link: https://www.v2ex.com/t/920749
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
请教一个 MySQL 联合索引方案
假设有一个表
table a
column x,y,.....
现在有一个 sql ,select * from a where x = ? and y in (?,?,?,...)
x 的区分度很低,y 的区分度很高。
联合索引是建( x,y )还是( y,x )。
考虑到区分度高索引列在前面的原则似乎是因该是( y,x )。但是考虑到索引下推,似乎又应该是( x,y )?
假设有一个表
table a
column x,y,.....
现在有一个 sql ,select * from a where x = ? and y in (?,?,?,...)
x 的区分度很低,y 的区分度很高。
联合索引是建( x,y )还是( y,x )。
考虑到区分度高索引列在前面的原则似乎是因该是( y,x )。但是考虑到索引下推,似乎又应该是( x,y )?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK