mysql> explain select * from test where id/2<100\G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: test
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 1534755
Extra: Using where
1 row in set (0.78 sec)
ERROR:
No query specified
mysql> explain select * from test where id<100*2\G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: test
type: range
possible_keys: idx_test
key: idx_test
key_len: 4
ref: NULL
rows: 16296
Extra: Using where
1 row in set (0.09 sec)
ERROR:
No query specified
3.3其他优化
MYSQL文档中分别对于join、order by、group by等的优化都做了详细讲述,我们在这里就不给出具体的实例了,大家参考MYSQL联机文档。
| 第1页: MYSQL服务器系统变量 | 第2页: MYSQL服务器状态变量 |
| 第3页: MYSQL服务器关键参数优化 | 第4页: 一个函数调试工具 |
| 第5页: MYSQL数据库的SQL执行计划解释器 | 第6页: 优化WHERE子句 |
| 第7页: MYSQL高速缓存管理 |