Free up MySQL Space in WordPress – Delete Akismet Logs

Akismet is owsome plugin to protect your WordPress site from the spams. However, before writing this article, i was checking the space used by the database. I was so surprised when i saw that the table named “wp_commentmeta” was having more than 11k records using 20MB of the space.

After some time, i found that Akismet uses that table as a log to display the reports about spam. Spams are automatically deleted by akismet, but entry for every spam was maintained in that table.

When i run below query to find the orphan comments meta :

Select * FROM wp_commentmeta WHERE comment_id NOT IN
(SELECT comment_id FROM wp_comments)

There were nearly 10k records which were orphans. To free up the memory, i run below query

DELETE FROM wp_commentmeta WHERE comment_id NOT IN
(SELECT comment_id FROM wp_comments)

With the help of above query, i free up nearlly 18MB of space.

Please leave your valuable feedback over the same problem.


Posted

in

by

Comments

One response to “Free up MySQL Space in WordPress – Delete Akismet Logs”

  1. Rilwis Avatar

    This is exactly the problem I’m having. My blog is slowed down a lot because of this problem. My table commentmeta has > 100k row, and > 100MB size (uncompressed)! After remove it, wow, it’s < 1 MB, and website is much faster!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.