mysql强制索引和禁止某个索引
2015-07-21 10:29
253 查看
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")
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")
相关文章推荐
- mysql修改数据库表的字段
- 【MySQL】通过select语句把一列数据拼接成一条字符串
- 【mysql】如何做到表内存在同名字段就更改记录,不存在就新增记录(replace的详细使用)
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决办法
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决办法
- ubuntu MySQL采用apt-get install安装目录
- mysql max_allowed_packet查询和修改
- mysql格式时间戳
- mysql查询一天,查询一周,查询一个月的数据
- MYSQL---数据定义
- 简单介绍下MYSQL的索引类型
- MySQL(9):列的属性
- 纪录: INNER JOIN,LEFT JOIN 之解惑
- mysql中文查询乱码解决
- MySQL修改root账号密码的方法
- 详解MySql基本查询、连接查询、子查询、正则表达查询
- windows下mysql慢查询开启的操作流程
- MySQL行列转换拼接
- MySQL-Slow-2
- MySQL字符串连接