升级后mysql查询变慢

发布于 2024-09-09 04:01:31 字数 209 浏览 4 评论 0原文

我不知道我们的系统团队对mysql做了什么。但我的一个 jsp 页面需要大约 15 秒才能加载。升级只用了1秒。

相关表中只有大约200条条目。该页面与数据库的连接次数约为 60 次。奇怪的是,这么小的页面却出现这个问题。

其他查询mysql的JSP页面也有这个问题。

我想知道如何“调试”这个问题,以便我可以告诉我们的系统团队如何更改。非常感谢您的回复!

I don't know what our Systems team did to mysql. But one of my jsp pages takes about 15 seconds to load. It took only 1 second before upgrade.

There are only about 200 entries in related tables. And the page connects about 60 times to the database. It is weird that such small page has this issue.

Other JSP pages that query mysql have this issue too.

I want to know how to "DEBUG" this issue so I can tell our Systems team how to change. Your reply is highly appreciated!

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

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

发布评论

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

评论(2

明天过后 2024-09-16 04:01:31

首先要尝试的事情之一是从 mysql 控制台运行相同的查询,并查看它们是否存在相同的性能问题。如果是这样,您可以使用“EXPLAIN”来查看查询分析器,看看它是否做了坏事。虽然只有 200 个条目,但这可能不是索引问题。

您的页面应该只物理连接到数据库一次。如果你做了 60 次,那就不好了。

这可能是连接池的问题,池大小设置得太小,因此它会阻塞等待连接变得可用。这个性能问题是否一致?

One of the first things to try is running the same queries from the mysql console, and seeing if they have the same performance problems. If so, you can use "EXPLAIN" to see the query analyzer and see if it is doing something bad. With only 200 entries though, it probably isn't an index issue.

Your page should only physically connect to the DB once. If you're doing it 60 times, that isn't good.

It could be an issue with connection pooling, that the pool size is set too small, so it is blocking waiting on a connection to become available. Is this performance problem consistent?

欲拥i 2024-09-16 04:01:31

尝试使用

explain select <your query>

这里的链接来配合它
http://dev.mysql.com/doc/refman/5.1/ en/explain.html

try with

explain select <your query>

here is link to go with it
http://dev.mysql.com/doc/refman/5.1/en/explain.html

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