如果使用LOAD DATA INFILE失败,是否会回滚所有插入操作? [英] Will all inserts performed when using LOAD DATA INFILE be rolled back if it fails?

查看:402
本文介绍了如果使用LOAD DATA INFILE失败,是否会回滚所有插入操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MySQL连接器.NET的MySQLBulkLoader对象从C#使用LOAD DATA INFILE将24 GB数据加载到MySQL 5.5表中。



I我想知道是否在发生故障(由于任何原因,甚至是警告)的情况下,大容量插入是否可以像在事务中完成的那样适当地回滚,或者我是否应该期望看到已经提交的第一个成功记录。 p>

相关MySQL手册上的页面在这方面不是很有帮助。

解决方案

MySQL处于自动提交模式(默认值)尝试将每个语句包装在其自己的事务中。



如果使用InnoDB,则

如果使用MyISAM,则


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.

解决方案

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

这篇关于如果使用LOAD DATA INFILE失败,是否会回滚所有插入操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆