Will all inserts performed when using LOAD DATA INFILE be rolled back if it fails?

时光总嘲笑我的痴心妄想 提交于 2019-12-13 01:14:26

问题


I use LOAD DATA INFILE from C# using the MySQLBulkLoader object of the MySQL Connector for .NET, to load 24 GB of data into a MySQL 5.5 table.

I am wondering whether in case of failure (for any reason, even warnings), the bulk insertion would be properly rolled back as if it had been done within a transaction, or if I should expect to see the first successful records already commited.

The relevant page on the MySQL manual is not very informative in this regard.


回答1:


MySQL in auto-commit mode (the default) tries to wrap every single statement in its own transaction.

If you use InnoDB then yes
If you use MyISAM then no



来源:https://stackoverflow.com/questions/7491338/will-all-inserts-performed-when-using-load-data-infile-be-rolled-back-if-it-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!