Cleaning up the Database

Home Forums Legacy Support Support queries Other issues Cleaning up the Database

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #214440
    italymadeeasy
    Spectator
    Hi there, with more than 8000 students we have accumulated a lot of "comments" and "user activity" entries in our database. since answers to quiz questions and assignments are "comments" you can see how quickly these add up. We have tables with nearly 100,000 rows. What can be safely deleted from the Database without affecting user grades and other important things? Cheers
    #214663
    logan
    Member
    Hello, you could delete only questions comments but not assignments.
    #214743
    italymadeeasy
    Spectator
    Thanks! Are "questions" easily marked in the database (I am not the expert and would need to ask my developer)? Cheers
    #215060
    Mk
    Moderator
    Well you have to do something like this : $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->comments} WHERE comment_ID IN (SELECT * FROM {$wpdb->comments} as c LEFT JOIN {$wpdb->posts} as p ON c.comment_post_ID= p.ID WHERE p.post_type=%s)",'question'));   as this is a delete query you need to carefully test and then run this .
    #215184
    italymadeeasy
    Spectator
    Thanks!
    #215419
    Mk
    Moderator
    Please use it carefully. If you find any other issue please don't hesitate to ask. Thank you.
    #227391
    MeesterGijs
    Spectator
    Dear @italymadeeasy, I read your post from over a year ago about this same issue. I now have 2000 students enrolled in all courses and tables of over 520,000 (wp_usermeta), 330,000 (wp_postmeta) and 300,000 (wp-bp_activity) rows. Do you have any advice for me? More expensive hosting with more CPU and RAM? Or build a new website from scratch without wordpress or plugins? I'm curious to get your advice. My site is: meestergijs.nl Thanks, Gijs
    #227552
    MrVibe
    Keymaster
    We have build a tool for this in WPLMS it self. Please check WP ADmin - LMS - Settings - Admin functions - Delete old question comments. https://prnt.sc/paczs1 As we're caching the quiz results in activity meta, there is no need to saving comments to questions whose results are already cached.
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Cleaning up the Database’ is closed to new replies.