CREATE EVENT AutoDeleteOldNotifications
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
ON COMPLETION PRESERVE
DO
DELETE LOW_PRIORITY FROM databaseName.tableName WHERE datetime < DATE_SUB(NOW(), INTERVAL 30 DAY)
Created
May 31, 2019 08:23
-
-
Save appkr/efdfb0dd9232a7e64339cb31bcaeb2fb to your computer and use it in GitHub Desktop.
Auto prune old database records with MySQL event
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment