Remove Spam Content and Inactive Members from Your Database

While diagnosing possible causes for a Pligg site running slower than I would like, I came up with some SQL queries to perform some spring cleaning on a Pligg database. The following 3 queries will remove stories and comments flagged as spam, then remove inactive members who haven’t interacted with the site by submitting content or casting votes. I don’t suggest that everyone use these methods to clean up their database. Pligg doesn’t discard spammer data from your database by default so that the spammers can’t just register again on your site. We maintain their user information (email, username, IP address) so that we can use that information to block them.