如果想要最少的并发量,应该选择哪种隔离模式?

发布于 2024-07-23 12:39:33 字数 53 浏览 3 评论 0原文

如果需要尽可能地减少并发性,哪种隔离级别(可重复读、可序列化、已提交读、未提交读)效果最好?

If you need to minimize concurrency as much as possible, which isolation level (repeatable read, serializable, read committed, read uncomitted) would work best?

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

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

发布评论

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

评论(2

这个俗人 2024-07-30 12:39:33

可串行化提供了最大的隔离性,因此并发性也最低。

http://en.wikipedia.org/wiki/Isolation_(database_systems)

Serializable gives the most isolation, thus least concurrency.

http://en.wikipedia.org/wiki/Isolation_(database_systems)

握住我的手 2024-07-30 12:39:33

我猜您确实希望在这里尽可能地最大化并发性,以提高性能。 不幸的是,仅仅选择隔离模式并不能解决问题。 关于这些隔离模式的真正问题是,您可以在您的特定应用程序中使用它们吗?

这实际上取决于应用程序的详细细节,并且这可能不是我们可以在 Stack Overflow 上调试的内容。

然而,一般来说,假设您没有发生数据损坏,从最高并发到最低并发,Oracle 的隔离级别为:

  1. 读取未提交
  2. 、读取已提交、
  3. 可重复读取、
  4. 可串行化。

对于 PostgreSQL 来说,情况有所不同,因为它使用不同的同步模型 (MVCC),读取是免费的,但写入时则面临回滚的风险。

我想这个问题的真正答案是,询问并获取许多天的学习材料,或者只是雇用某人来处理您的特定情况。 虽然它非常技术性,但没有硬性规定:您需要了解正在发生的事情背后的理论和具体情况,才能提出有用的建议。

I'm guessing you really want to maximize concurrency as much as possible here, to increase performance. Unfortunately, simply choosing an isolation mode won't do the trick. The real question about those isolation modes is, can you use them in your particular application?

That really depends on the intimate details of your application, and that's probably not something we can debug on Stack Overflow.

However, in general, assuming you don't get data corruption, from most concurrent to least, the isolation levels for Oracle are:

  1. read uncommitted
  2. read committed
  3. repeatable read
  4. serializable.

It's different for, say, PostgreSQL because it uses a different synchronization model (MVCC), where reading is free, but when you write you run the risk of rollback.

I suppose the real answer to this question is, ask and get leads to many days of study materials, or just hire someone to deal with your particular situation. While it's very technical, there are no hard and fast rules: you need to understand both the theory behind what's going on and the specific situation in order to make a useful recommendation.

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