We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
学习使用和理解 EXPLAIN 命令。
打开慢查询日志和不使用索引的日志查询
Learn to use and understand EXPLAIN command.
Turn on slow query log and log query not using an index
好吧,我们应该做的第一件事是让 MySQL 通过 DESC 命令描述您的查询。这将允许您查看查询的详细执行计划。您应该特别对描述所使用的键的列感兴趣,因为正确的键使用可以有很大帮助。
描述查询的方法是简单地在其前面加上 DESC 关键字。举个例子:
DESC SELECT * FROM 用户 WHERE name = 'foo';
Well, the first thing one should do is have MySQL describe your queries through the DESC command. This will allow you to see a detailed execution plan for the query. You should especially be interested in the columns describing what keys are used, as proper key usage can help a lot.
The way to describe a query is to simply prefix it with the DESC keyword. As an example:
DESC SELECT * FROM user WHERE name = 'foo';