Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have this in my.cnf:

tmpdir = /dev/shm

and I'm getting this in my error logs:

[23-Apr-2011 10:22:08] WordPress database error Incorrect key file for table '/dev/shm/#sql_30f1_0.MYI'; try to repair it for query  SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY RAND() DESC LIMIT 0, 5 made by require, require_once, include, get_posts, WP_Query->query, WP_Query->get_posts

The file size is very large - over 3 GB in size, but there are other tables in that directory getting the same error are 1024 bytes - not sure what is going on here

How do I try to repair a temp table? I'm getting this error A LOT!

Dan

PS on a separate note - anybody know where in thewordpress core this call is being made? I haven't been able to track it down - I want to disable it because of the ORDER BY RAND() call in it.

share|improve this question

migrated from stackoverflow.com Dec 30 '11 at 21:21

This question came from our site for professional and enthusiast programmers.

1 Answer 1

/dev/shm is shared memory. That will compete with OS for available RAM. You simply do not have enough RAM to hold that large temp table.

You need to comment out that line in /etc/my.cnf

[mysqld]
#tmpdir=/dev/shm

and restart mysql. That way, tmpdir default to the OS tmp folder, which is /tmp. That will put temp tables on disk.

If you still want /dev/shm, instead of commenting out tmpdir, just increase RAM on the server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.