我有一个单表的 47 GB MySQL 转储:
http://dumps.wikimedia.org/commonswiki/latest/commonswiki-latest-image.sql.gz
我最终希望它进入 PostgreSQL,但由于我没有找到一种简单的方法将 MySQL SQL 转换为我想的 PostgreSQL SQL,我将它放入 MySQL,然后编写一个小的 ETL 脚本来执行此操作。
我最初尝试使用 MySQL WorkBench Data Import/Restore 加载它,但它失败了。
现在我已经运行split -l 2000 commonswiki-latest-image.sql并有 20 个文件,每个文件大约 2 GB,但它仍然失败:
23:12:28 Restoring C:\temp\commonswiki\xaa.sql
Running: mysql.exe --defaults-extra-file="c:\users\jmurdoch\appdata\local\temp\tmpi_ltz8.cnf" --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=mediawikiimages < "C:\\temp\\commonswiki\\xaa.sql"
ERROR 2013 (HY000) at line 331: Lost connection to MySQL server during query
Operation failed with exitcode 1
00:54:17 Import of C:\temp\commonswiki\xaa.sql has finished with 1 errors
Run Code Online (Sandbox Code Playgroud)
它也非常慢,因为它在近 2 个小时内只导入了 209236 行,但我认为有大约 2000 万个项目要导入,所以按照这个速度导入需要 …