1.insert select from
INSERT INTO individuals_id (id, param, flag)
SELECT
id,
1 AS param,
0 AS flag
FROM
entities_copy
WHERE
LENGTH(id) > 0
2.不同表之間update
UPDATE entities a,
entities_industries b
SET a.industries = b.industries
WHERE
a.id = b.id
AND LENGTH(b.industries) > 0
4.提高性能的表寫(xiě)入操作
--鎖表
LOCK TABLES `order` WRITE;
--禁用鍵
ALTER TABLE `order` DISABLE KEYS ;
--插入數(shù)據(jù)
INSERT INTO `order` VALUES (1,11,'UPDATED');
INSERT INTO `order` VALUES (2,11,'UPDATED');
--啟用鍵
ALTER TABLE `order` ENABLE KEYS;
--解鎖表
UNLOCK TABLES;
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者