UPDATE LOW_PRIORITY 是否返回正确的受影响行数?

发布于 2024-11-13 09:03:46 字数 306 浏览 2 评论 0原文

我需要进行大量UPDATE,并且不需要经常阅读表格。

所以我想到使用 UPDATE LOW_PRIORITY 但它返回正确数量的 affected_rows() 吗?

或者考虑到它不是立即提交,它无法知道有多少记录会受到影响?

mysql_query("UPDATE LOW_PRIORITY table SET view = view + 1 WHERE id = 123");
echo mysql_affected_rows();

I need to make a lot of UPDATE and I don't need to read the table often.

So I thought of using UPDATE LOW_PRIORITY but does it return the correct number of affected_rows() ?

Or considering it's not instantly committed it can't know how many records will be affected?

mysql_query("UPDATE LOW_PRIORITY table SET view = view + 1 WHERE id = 123");
echo mysql_affected_rows();

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

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

发布评论

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

评论(1

深陷 2024-11-20 09:03:46

是的,它返回受影响的行数,LOW_PRIORITY 不会影响这部分。

使用 LOW_PRIORITY 关键字,UPDATE 的执行会被延迟,直到没有其他客户端从表中读取数据为止。这仅影响仅使用表级锁定的存储引擎(例如 MyISAM、MEMORY 和 MERGE)。

Yes it returns the affected rows number, LOW_PRIORITY doesn't affect this part.

With the LOW_PRIORITY keyword, execution of the UPDATE is delayed until no other clients are reading from the table. This affects only storage engines that use only table-level locking (such as MyISAM, MEMORY, and MERGE).

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