Skip to content

Instantly share code, notes, and snippets.

@sagarchauhan005
Last active November 27, 2021 13:16
Show Gist options
  • Save sagarchauhan005/ade6463225b1a71b25091100dd013e93 to your computer and use it in GitHub Desktop.
Save sagarchauhan005/ade6463225b1a71b25091100dd013e93 to your computer and use it in GitHub Desktop.
#Method 1 (https://stackoverflow.com/questions/879327/quickest-way-to-delete-enormous-mysql-table)
CREATE TABLE new_foo LIKE foo;
RENAME TABLE foo TO old_foo, new_foo TO foo;
DROP TABLE old_foo;
#Method 2 (https://stackoverflow.com/questions/2300396/force-drop-mysql-bypassing-foreign-key-constraint)
SET foreign_key_checks = 0;
Truncate table foo;
SET foreign_key_checks = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment