Slow Queries – 300 second query times
-
Hello,
I’ve recently set up a BBPress forum for non-profit Bike Pittsburgh and their host, Pair Networks, shut down their database because of the load BBPress was putting on the server. Pair has since reinstated the db, but I was wondering if anyone could offer any insight as to how I might trim down the size of the queries that BBPress is putting through. A little background:
- I used this method to convert a WordPress XDForum into BBPress. I know the author of that post mentions that the method he uses might not be the most efficient, however at this point (after the conversion), I wouldn’t think that BBPress is using any of this info any more, correct?
- We’re running BBPress v. 0.9.0.2
- We’re using the following plugins: Akismet, Use Display Name, BBPress Private Messaging, Post Count Plus, Forum Last Poster, and Images Allowed
The information from the host was this:
With that said, we wanted to provide a follow up in terms of the nature of the problem itself. The problem is that the database is running some very inefficient queries, trying to sort through 2.5 million rows and are returning very few to no results. These queries take a long time to run and are called “slow queries”. As you gain in traffic, the more of these slow queries that are run, the higher the load on the server, and therefore the more affect you have on other customers.
I’ve included some examples of these queries below for your review:
# Time: 080930 20:55:01
# User@Host: bikepgh[bikepgh] @ [209.68.4.180]
# Query_time: 54 Lock_time: 0 Rows_sent: 10 Rows_examined: 2469001
SELECT forum_id, topic_id FROM bb_topics WHERE topic_last_post_id IN
(SELECT MAX
(topic_last_post_id) FROM bb_topics WHERE topic_status=0 GROUP BY
forum_id);
# Time: 080930 20:56:05
# User@Host: bikepgh[bikepgh] @ [209.68.4.180]
# Query_time: 71 Lock_time: 0 Rows_sent: 10 Rows_examined: 2469001
SELECT forum_id, topic_id FROM bb_topics WHERE topic_last_post_id IN
(SELECT MAX
(topic_last_post_id) FROM bb_topics WHERE topic_status=0 GROUP BY
forum_id);
# Time: 080930 20:56:43
# User@Host: bikepgh[bikepgh] @ [209.68.4.180]
# Query_time: 67 Lock_time: 0 Rows_sent: 10 Rows_examined: 2469001
SELECT forum_id, topic_id FROM bb_topics WHERE topic_last_post_id IN
(SELECT MAX
(topic_last_post_id) FROM bb_topics WHERE topic_status=0 GROUP BY
forum_id);
# Time: 080930 20:57:38
# User@Host: bikepgh[bikepgh] @ [209.68.4.180]
# Query_time: 52 Lock_time: 0 Rows_sent: 10 Rows_examined: 2469001
SELECT forum_id, topic_id FROM bb_topics WHERE topic_last_post_id IN
(SELECT MAX
(topic_last_post_id) FROM bb_topics WHERE topic_status=0 GROUP BY
forum_id);
# Time: 080930 21:20:46
# User@Host: bikepgh[bikepgh] @ [209.68.4.180]
# Query_time: 263 Lock_time: 0 Rows_sent: 10 Rows_examined: 2469001
SELECT forum_id, topic_id FROM bb_topics WHERE topic_last_post_id IN
(SELECT MAX
(topic_last_post_id) FROM bb_topics WHERE topic_status=0 GROUP BY
forum_id);
# Time: 080930 21:22:35
# User@Host: bikepgh[bikepgh] @ [209.68.4.180]
# Query_time: 281 Lock_time: 0 Rows_sent: 0 Rows_examined: 1952752
SELECT forum_id, topic_id FROM bb_topics WHERE topic_last_post_id IN
(SELECT MAX
(topic_last_post_id) FROM bb_topics WHERE topic_status=0 GROUP BY
forum_id);
As you can see, these queries are taking almost 300 seconds to complete
(query_time). This is an extremely high time, as a query on a shared server
should take under 10 seconds to complete.
I hope this helps provide some needed details for you. If we can be of any
further assistance, please do not hesitate to ask.
Any help as to what I might do in PHPMyAdmin or otherwise to help lower the load on the db would be VERY MUCH appreciated!
- You must be logged in to reply to this topic.