用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1458|回复: 3
收起左侧

[讨论/交流] 索引使用问题

[复制链接]
发表于 2014-4-21 18:08:45 | 显示全部楼层 |阅读模式
select message.* from totoro_message as message left join totoro_message_status as status on message.id = status.mid where message.to_uid = 0 and status.uid is null order by message.create_time desc
我在 totoro_message 表上建了一个多列索引(to_uid, create_time)
explain 语句后发现确实使用上了这个索引,但似乎只使用了一半,结果显示using filesort。
请问 ,要怎么把using filesort去掉?


发表于 2014-4-22 16:16:55 | 显示全部楼层
感觉索引建少了还是,嘿嘿
发表于 2014-4-22 16:17:11 | 显示全部楼层
http://www.ccvita.com/169.html
发表于 2014-4-28 11:13:38 | 显示全部楼层
left join的话索引建在totoro_message_status试试

本版积分规则