如果失败,使用 LOAD DATA INFILE 时执行的所有插入是否都会回滚?

发布于 2024-12-05 17:54:41 字数 312 浏览 5 评论 0原文

我使用 C# 中的 LOAD DATA INFILE,使用 MySQL Connector for .NET 的 MySQLBulkLoader 对象,将 24 GB 数据加载到 MySQL 5.5 表中。

我想知道如果发生失败(出于任何原因,甚至是警告),批量插入是否会正确回滚,就好像它是在事务中完成的一样,或者我是否应该看到已经提交的第一个成功记录。

MySQL 手册上的相关页面信息不是很丰富在这方面。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨光如昨 2024-12-12 17:54:41

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

如果您使用 InnoDB 那么
如果您使用 MyISAM 那么

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文