Support » Plugin: GamiPress » Gamipress_logs_meta table is huge – how to empty?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author rubengc


    Hi @peeld

    the logs, they are used to store the user actions that GamiPress uses to meet if user meets the conditions or not
    Getting a great amount of log entries is common when you have a great amount of users

    Is true that actually there isn’t any way to clean up logs yet (we have plans on release an add-on for that purpose)

    Meanwhile, you can remove the logs manually by running the following database query:
    DELETE FROM table_name WHERE type=’event_trigger’ AND date < ‘date_to

    Replace table_name by your site gamipress_logs table (commonly is {prefix}gamipress_logs)
    And replace date_to with the date you want to keep the logs, for example, if you want to remove all logs from October (month number 8) you can set the date to ‘2019-09-01’
    Always will be removed log BEFORE the date you entered

    Also, a great query that could clean up unused logs meta is the following one that will remove all logs metas from logs that have been removed:
    DELETE lm FROM logs_meta_table lm LEFT JOIN logs_table l ON l.log_id = lm.log_id WHERE l.log_id IS NULL

    Replace logs_meta_table by your site gamipress_logs_meta table (commonly is {prefix}gamipress_logs_meta)
    Replace logs_meta by your site gamipress_logs table (commonly is {prefix}gamipress_logs)

    IMPORTANT: Don’t copy and paste the SQL queries, pay attention to the parts you need to replace, always described after the queries

    Best regards

    Thanks for this. Glad to hear about the planned add on!

    There’s apparently an error in the sql statement, something about

    2 errors were found during analysis.

    Unexpected keyword. (near “ON” at position 75)
    Unrecognized statement type. (near “ON” at position 75)

    I guess I’ll leave it alone for now 🙂

    Plugin Author rubengc


    Hi @peeld

    On the second query, have you replaced the 2 table names?

    Best regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.