mysql分库分表

2018-09-26  本文已影响0人  bettermeLy

1、shard表查询必须带shardingkey

2、explain select * from table where a = 123 and b = 0 order by c desc;

查询优化需要设置三个字段索引ix_a_b_c

sql优化:http://blog.51cto.com/ustb80/1073352

3、explain select * from table where a = 123 and b in (1,2) and c = 0;

如果不使用in  命中ix_b索引

如果使用in  需要建立ix_a_b_c索引

4、索引优化:https://my.oschina.net/longniao/blog/110384

5、简书索引失效:https://www.jianshu.com/p/932bcdf2c89f

上一篇下一篇

猜你喜欢

热点阅读