概述
在上一篇文章中,链接:https://www.cnblogs.com/xiao987334176/p/18377915
使用工具SQLyog进行导入,传输过程是单进程的,一个表一个表的传,一条条数据插入,所以传输速度会比较慢。
如果sql server mdf文件在200m左右,传输需要花费30分钟左右。
如果来了一个10GB左右的mdf的文件,需要25个小时,时间太漫长了。
mysql表结构重构
如果使用python多进程导入,那么导入顺序是错乱的。如果表结构包含外键关联,例如:
CREATE TABLE `DimAccount` (
`AccountKey` int NOT NULL AUTO_INCREMENT,
`ParentAccountKey` int DEFAULT NULL,
`AccountCodeAlternateKey` int DEFAULT NULL,
`ParentAccountCodeAlternateKey` int DEFAULT NULL,
`AccountDescription` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`AccountType` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Operator` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`CustomMembers` text COLLATE utf8mb4_unicode_ci,
`ValueType` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`CustomMemberOptions` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`AccountKey`),
KEY `FK_DimAccount_DimAccount` (`ParentAccountKey`),
CONSTRAINT `DimAccount_ibfk_1` FOREIGN KEY (`ParentAccountKey`) REFERENCES `DimAccount` (`AccountKey`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `DimAccount_ibfk_10` FOREIGN KEY (`ParentAccountKey`) REFERENCES `DimAccount` (`AccountKey`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `DimAccount_ibfk_11` FOREIGN KEY (`ParentAccountKey`) REFERENCES `DimAccount` (`AccountKey`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `DimAccount_ibfk_2` FOREIGN KEY (`ParentAccountKey`) REFERENCES `