Mysql索引

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mysql> explain select * from taobao_goods_refer where liveid=200184156149 and itemid=545968294976;
+----+-------------+--------------------+------+---------------------------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------------+------+---------------------------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | taobao_goods_refer | ALL | liveid_uid_itemid,liveid_itemid | NULL | NULL | NULL | 495819 | Using where |
+----+-------------+--------------------+------+---------------------------------+------+---------+------+--------+-------------+
1 row in set (0.00 sec)
mysql> explain select * from taobao_goods_refer where liveid='200184156149' and itemid=545968294976;
+----+-------------+--------------------+------+---------------------------------+---------------+---------+-------------+------+-----------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------------+------+---------------------------------+---------------+---------+-------------+------+-----------------------+
| 1 | SIMPLE | taobao_goods_refer | ref | liveid_uid_itemid,liveid_itemid | liveid_itemid | 90 | const,const | 1 | Using index condition |
+----+-------------+--------------------+------+---------------------------------+---------------+---------+-------------+------+-----------------------+

####参考
http://www.open-open.com/lib/view/open1478836003379.html