Docs

Cleanup rules

Log tables grow forever. A cleanup rule deletes their old rows every night, after a backup, in small pieces players don't notice.

Adding a rule

Bank transactions, phone messages, admin logs: tables like these only ever grow. Under Maintenance → Cleanup you can add a rule per table: pick the table, its date column and how many days to keep. Rows older than that are deleted once a day.

  • Preview counts how many rows the rule would delete right now, without deleting anything. Saving a rule and running it both show that number and ask for confirmation.
  • A saved rule does not run straight away: its first automatic run is on the next day, after 05:00 server time (change the hour with Runs at above the rules). If the server is off at that hour, the rule runs after the next start. Run now runs it immediately.

How rows are deleted

  • Before deleting, the table is backed up. This can be switched off per rule. For each table the last 5 of these backups are kept; they are listed on the Backups tab as "before cleanup".
  • Rows are deleted in pieces of 2000 with a short pause in between, so players don't notice. One run lasts 10 minutes at most; what is left is deleted the following night.
  • The date column can be DATETIME, TIMESTAMP, DATE, or a number holding unix time in seconds or milliseconds. Rows whose date is empty or zero are never deleted.
  • Only real tables and date columns are accepted, and the server builds the DELETE itself; no SQL comes from the panel.

Every run is listed in the cleanup log with the number of deleted rows, how long it took and who started it. Rules and the log are stored in waw-sql-data/retention.json.

Settings

convardefaultmeaning
waw_sql_cleanup_hour5hour of the day, server time, after which the rules run. Only used until Runs at is saved in the panel
waw_sql_cleanup_chunk2000rows deleted per statement