A create index idx_owner_name_age on people(name,age);
B:
create index idx_owner_name on people(name);
create index idx_owner_age on people(age);
请问A和B有什么区别?
复合索引的几个字段是否经常同时以AND方式出现在Where子句中?单字段查询是否极少甚至没有?如果是,则可以建立复合索引;否则考虑单字段索引;
create index idx_owner_name_age on people(name,age); 如果NAME字段不走索引,AGE字段肯定也不会走索引,如果NAME字段走索引,AGE就会走索引