SQL优化新手寻找工具/脚本

发布于 2024-08-17 17:50:39 字数 1539 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瀟灑尐姊 2024-08-24 17:50:39

学习使用和理解 EXPLAIN 命令。
打开慢查询日志和不使用索引的日志查询

Learn to use and understand EXPLAIN command.
Turn on slow query log and log query not using an index

眼中杀气 2024-08-24 17:50:39

好吧,我们应该做的第一件事是让 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';

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文