slow query
-
We have a rather large phpBB site, and our server crashed due to slow queries piling up. We traced it down to a query in the “updated topics” widget in this plugin.
To solve it we changed the query in class.wp.w3all-phpbb.php
from:
SELECT * FROM ".$config["table_prefix"]."posts, ".$config["table_prefix"]."topics WHERE (SELECT MAX(topic_last_post_time) FROM ".$config["table_prefix"]."topics WHERE topic_visibility = 1) AND ".$config["table_prefix"]."topics.forum_id NOT IN(".$no_forums_list.") AND ".$config["table_prefix"]."posts.post_id = ".$config["table_prefix"]."topics.topic_last_post_id AND ".$config["table_prefix"]."posts.topic_id = ".$config["table_prefix"]."topics.topic_id AND ".$config["table_prefix"]."posts.post_visibility = 1 ORDER BY post_time DESC LIMIT 0,$ntopicsto:
SELECT T.*, P.* FROM ".$config["table_prefix"]."topics AS T, ".$config["table_prefix"]."posts AS P WHERE T.topic_visibility = 1 AND T.forum_id NOT IN(".$no_forums_list.") AND T.topic_last_post_id = P.post_id AND P.post_visibility = 1 ORDER BY T.topic_last_post_time DESC LIMIT 0,$ntopicsand were wondering if it would be a good idea to change this in the official plugin as well? There are a couple of different variant of the query being used in the plugin, I think they would all need this changed?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘slow query’ is closed to new replies.