We recently decided to clear out old comments on blog entries on one of our WordPress sites. We have almost six years worth of comments and data on this particular blog, most of it pertaining to old news items. While the discussions were interesting and engaging in their day, they now represent tens – maybe hundreds – of thousands of lines of database entries.
Data purists may shriek in horror, but we decided to prune these old comments rather than keep them for what little historical value they had. There’s a fairly handy line of MySQL code that can be run to delete old comments:
delete from wp_comments where date_sub(now(), interval 360 day) > comment_date ORDER BY comment_date ASC LIMIT 4000;