Joomla 1.6 mysql中的菜单问题(执行时间<10分钟)

发布于 2024-11-08 16:20:10 字数 1278 浏览 0 评论 0 原文

我发现底部的代码在我的服务器上执行了 10 多分钟。服务器本身非常好,我找不到任何合适的解释。 我使用的是 Joomla 1.6.3,数据是使用 jUpgrade 从 Joomla 1.5.23 迁移的,MySQL 客户端版本是 5.1.45。

SELECT a.*,COUNT(DISTINCT m1.id) AS count_published,COUNT(DISTINCT m2.id) AS count_unpublished,COUNT(DISTINCT m3.id) AS count_trashed
FROM `j16_menu_types` AS a
LEFT JOIN `j16_menu` AS m1 ON m1.menutype = a.menutype AND m1.published = 1
LEFT JOIN `j16_menu` AS m2 ON m2.menutype = a.menutype AND m2.published = 0
LEFT JOIN `j16_menu` AS m3 ON m3.menutype = a.menutype AND m3.published = -2
GROUP BY a.id
ORDER BY a.id asc;

如果有人能帮助我,我会非常高兴,因为我遇到了大麻烦:)

Ps 我已经下载了 db 并在我的计算机上检查了它 - 仍然相同,执行时间很糟糕。有什么办法可以解决这个问题吗?或者也许删除此 sql 部分而不会对 joomla 的管理进行重大更改? 好吧,在我的电脑上完成得相当快,但结果仍然远不能令我满意。 在此处输入图像描述

编辑 嗯,我发现了这个问题的一个已报告的错误。 http://joomlacode.org/gf/project/joomla /tracker/?action=TrackerItemEdit&tracker_item_id=24868

解决方案是:

CREATE INDEX idx_menu_published ON j16_menu (published);

但是,我不确定这将如何影响管理。我有人可以简单地告诉我这部分是如何工作的,我应该编辑 Joomla 核心代码还是只在 mysql 上使用上面的代码一次。我想知道每次编辑菜单时是否应该索引表。

I found that code in the bottom executes more than 10 minutes on my server. The server itself is quite good and I cannot find any suitable explanation for that.
I am using Joomla 1.6.3 the data is migrated from Joomla 1.5.23 using jUpgrade and MySQL client version is 5.1.45.

SELECT a.*,COUNT(DISTINCT m1.id) AS count_published,COUNT(DISTINCT m2.id) AS count_unpublished,COUNT(DISTINCT m3.id) AS count_trashed
FROM `j16_menu_types` AS a
LEFT JOIN `j16_menu` AS m1 ON m1.menutype = a.menutype AND m1.published = 1
LEFT JOIN `j16_menu` AS m2 ON m2.menutype = a.menutype AND m2.published = 0
LEFT JOIN `j16_menu` AS m3 ON m3.menutype = a.menutype AND m3.published = -2
GROUP BY a.id
ORDER BY a.id asc;

I would be very pleased if someone could help me since I am in big trouble :)

P.s. I have downloaded db and checked it on my computer - still the same, execution time is terrible. Is there any way to solve this problem? Or maybe to remove this sql part without significant changes in administration of joomla?
Well it was done quite faster on my PC but still the result is far from one which would satisfy my.
enter image description here

EDIT
Well, I've found a reported bug of this problem. http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=24868

And the solution is:

CREATE INDEX idx_menu_published ON j16_menu (published);

However, I am not sure how this will affect administration. I there is anyone who could briefly tell how this part works and should I edit Joomla core code or just use the above code on mysql once. I am wondering if I should index table everytime when I edit menu.

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

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

发布评论

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

评论(1

不可一世的女人 2024-11-15 16:20:10

如果您不介意比较的话,数据库/表索引只是一种黄页。它会自动更新。如果该索引解决了您的问题,您无需再做任何其他事情。你也不能破坏任何东西——所以尝试一下吧。

A database / table Index is just a kind of yellow pages if you don't mind the comparison. It updates automatically. If this Index fixes your problem there is nothing else you need to do or do again. You can't break anything either - so just give it a try.

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