赞
踩
mysql> explain select * from stu where age=18\G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: stu
partitions: NULL
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 9
filtered: 11.11
Extra: Using where
1 row in set, 1 warning (0.00 sec)
建立索引
mysql> create index index_name on stu(age);
Query OK, 0 rows affected (0.16 sec)
Records: 0 Duplicates: 0 Warnings: 0
再次查询
mysql> explain select * from stu where age=18\G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: stu
partitions: NULL
type: ref
possible_keys: index_name
key: index_name
key_len: 5
ref: const
rows: 1
filtered: 100.00
Extra: NULL
1 row in set, 1 warning (0.11 sec)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。