You can rename the table, perform the cleanup as necessary, and then return the table name again.
Example:
SET GLOBAL general_log = 'OFF'; RENAME TABLE general_log TO general_log_temp; DELETE FROM `general_log_temp` WHERE `event_time` < DATE(NOW()); RENAME TABLE general_log_temp TO general_log; SET GLOBAL general_log = 'ON';
techhero
source share