【发布时间】:2012-08-22 12:30:13
【问题描述】:
我有以下 MySQL 查询
explain select item_id from items use index(user_item_id) where user_id=9 and item_id=10000
返回以下内容
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE items ref user_item_id user_item_id 8 const,const 1 Using index
为什么类型是 ref 而不是 const?
user_item_id 是 user_id 和 item_id 的复合索引。
【问题讨论】:
标签: mysql indexing constants ref explain