create table test(c1 varchar(20) , c2 varchar(20) , c3 varchar(30)) ;
create index test_ix on test(c1,c2,c3) ;
– 会用到索引的查询
select * from test where c1 = ‘1’
select * from test where c1 = ‘1’ and c2 = ‘2’
select * from test where c1 = ‘1’ and c2 = ‘3’
select * from test where c1 = ‘1’ and c2 = ‘2’ and c3 = ‘3’
– 不会用索引的查询
select * from test where c2 = ‘2’
select * from test where c2 = ‘3’
select * from test where c2 = ‘2’ and c3 = ‘3’
– 个人意见,欢迎讨论。
最后
以上就是陶醉滑板最近收集整理的关于三个联合主键,查询的时候使用其中两个,对查询速度有什么影响的全部内容,更多相关三个联合主键,查询内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复