Created
June 16, 2021 14:43
-
-
Save phamquocbuu/36f1bc4f5f7cc87a8bf37f14161d7ab4 to your computer and use it in GitHub Desktop.
Auto repeat delete records in MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
CREATE PROCEDURE clean_someTable() | |
BEGIN | |
REPEAT | |
DO SLEEP(1); | |
DELETE FROM xxx_table where status=2 LIMIT 100000; | |
UNTIL ROW_COUNT() = 0 END REPEAT; | |
END$$ | |
DELIMITER ; | |
-- call clean_someTable(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment