Last active
August 23, 2017 15:09
-
-
Save kbsali/7597954 to your computer and use it in GitHub Desktop.
Mysql InnoDB + MyIsam bulk insert statements
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
LOCK TABLES `table_name` WRITE; | |
SET autocommit=0; | |
SET foreign_key_checks=0; | |
SET unique_checks=0; | |
/*.... | |
INSERT ... ON DUPLICATE KEY UPDATE | |
INSERT IGNORE INTO | |
....*/ | |
SET unique_checks=1; | |
SET foreign_key_checks=1; | |
COMMIT; | |
SET autocommit=1; | |
UNLOCK TABLES; |
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
LOCK TABLES `table_name` WRITE; | |
/*!40000 ALTER TABLE `table_name` DISABLE KEYS */; | |
/*.... | |
INSERT INTO ... ON DUPLICATE KEY UPDATE | |
INSERT IGNORE INTO | |
....*/ | |
/*!40000 ALTER TABLE `table_name` ENABLE KEYS */; | |
UNLOCK TABLES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment