MySQL Forums
Forum List  »  Performance

Server just hanging (Copying to tmp table)
Posted by: Thomas Deliduka
Date: August 11, 2005 11:25AM

I did searches on the forum and I cannot find the answers I need. I also searched through the mailing lists.

This doesn't sound like a problem that should be that unique so I'm guessing y'all will know the answers.

I'm running the server on Mac OS X Server version 4.0.25-Standard I installed the standard pre-compiled version.
The server is a dual G5 with 4GB of RAM.

Every few hours my server will get stuck with select queries, these queries have been optimized to the hilt. It is different types of queries that end up making it hang. i can give specifics if you need. Essentially one of about three queries end up making the server sit and hang "Copying to tmp table". After restarting the server or killing the offending queries I can run them manually and get outputs in less than 0.20 seconds. I don't know what is causing the problem.

I turned on query caching thinking it may help, it did speed up my sites but it hasn't helped the problem. I also tweaked the other settings knowing that I have a ton of RAM at my disposal with no hint of hitting the limit. But nothing has really helped. Here is my my.cnf file:

set-variable = max_connections=1000
set-variable = tmp_table_size=500M
set-variable = query_cache_size=250M
set-variable = query_cache_limit=50M
set-variable = key_buffer_size=100M
set-variable = table_cache=5M
set-variable = sort_buffer_size=16M
set-variable = read_buffer_size=5M

I notice my wait_timeout is set to 28800 perhaps I should shorten things up.

I can't figure out where the temp files are saved if I'm actually hitting that. The thing is, my RAM usage is never very high so I can't imagine that I'm hitting the tmp_table_size limit. So, the "Copying to tmp table" seems to be a false error or, worse, something wrong with my RAM.

Does anyone have any suggestions at all?

One query that has been locking up the server lately is this one from PHPBB:
explain SELECT phpbb_topics.topic_title, phpbb_topics.topic_replies, phpbb_topics.topic_views, phpbb_topics.topic_id, phpbb_users.username, phpbb_users.user_realname, phpbb_posts.post_id, phpbb_posts.poster_id, phpbb_posts.post_time FROM ((phpbb_topics INNER JOIN phpbb_posts ON phpbb_topics.topic_last_post_id = phpbb_posts.post_id) INNER JOIN phpbb_users ON phpbb_users.user_id = phpbb_posts.poster_id) INNER JOIN phpbb_forums ON phpbb_forums.forum_id = phpbb_topics.forum_id WHERE (phpbb_forums.auth_view <= 0 ) AND (phpbb_forums.auth_read <= 0 ) AND phpbb_forums.forum_id NOT IN (5, 6, 2, 11) AND phpbb_topics.topic_status <> 2 ORDER BY post_time DESC LIMIT 5;

The output is:
table type possible_keys key key_len ref rows Extra
phpbb_forums ALL PRIMARY NULL NULL NULL 11 Using where; Using temporary; Using filesort
phpbb_topics ref forum_id,topic_last_post_id forum_id 2 phpbb_forums.forum_id 2041 Using where
phpbb_posts eq_ref PRIMARY,poster_id,p_id PRIMARY 3 phpbb_topics.topic_last_post_id 1
phpbb_users eq_ref PRIMARY PRIMARY 3 phpbb_posts.poster_id 1

I don't see why this one would end up locking up the server. Essentially what happens is more people are waiting for connections and the system quickly hits the max connections limit.

Options: ReplyQuote

Written By
Server just hanging (Copying to tmp table)
August 11, 2005 11:25AM
December 07, 2006 10:30AM
September 23, 2005 01:56AM
October 05, 2005 04:58AM
October 05, 2005 11:49PM
October 06, 2005 01:34AM
October 06, 2005 04:57PM
January 21, 2008 10:14AM
January 21, 2008 10:53AM
May 19, 2008 09:41AM
February 05, 2008 10:27AM
March 12, 2008 08:37AM
November 14, 2008 12:31AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.