mysql 强制索引和禁止某个索引
mysql强制索引和禁止某个索引
1、mysql强制使用索引:force index(索引名或者主键PRI)
例如:
select * from table force index(PRI) limit 2;(强制使用主键) select * from table force index(ziduan1_index) limit 2;(强制使用索引"ziduan1_index") select * from table force index(PRI,ziduan1_index) limit 2;(强制使用索引"PRI和ziduan1_index")
2、mysql禁止某个索引:ignore index(索引名或者主键PRI)
例如:
select * from table ignore index(PRI) limit 2;(禁止使用主键) select * from table ignore index(ziduan1_index) limit 2;(禁止使用索引"ziduan1_index") select * from table ignore index(PRI,ziduan1_index) limit 2;(禁止使用索引"PRI,ziduan1_index")
相关推荐
ribavnu 2020-11-16
moyekongling 2020-11-13
Ida 2020-09-16
liuweiq 2020-09-09
苏康申 2020-11-13
vitasfly 2020-11-12
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
vivenwan 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
jazywoo在路上 2020-11-11