mysql强制索引和禁止某个索引
2016-11-17 02:08
253 查看
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")
例如:
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")
相关文章推荐
- MYSQL强制使用索引和禁止使用索引
- MYSQL强制使用索引和禁止使用索引
- MYSQL强制使用索引和禁止使用索引
- MYSQL强制使用索引和禁止使用索引
- MYSQL强制使用索引和禁止使用索引
- MYSQL强制使用索引和禁止使用索引
- mysql强制索引和禁止某个索引
- mysql强制索引和禁止某个索引
- Mysql_mysql force Index 强制索引
- 【转】mysql force Index 强制索引
- Mysql强制索引
- mysql force Index 强制索引[转]
- 强制MySQL查询走索引和强制查询不缓存
- mysql 强制走索引
- MySQL force Index 强制索引概述
- mysql强制索引
- mysql force Index 查询强制使用索引
- Mysql之禁止使用索引
- mysql 强制索引,忽略索引
- mysql 强制索引