应该使用已提交读或可序列化作为隔离级别的场景?
我试图找出在什么情况下哪种隔离级别(可序列化和已提交读)更好。链接http://download.oracle.com/docs/cd/B14117_01/server.101/b10743/consist.htm#i17894,我正在浏览主题选择隔离级别,根据文章中的一些陈述,我得到了一些清晰的认识和一些疑问。
声明:- 读取已提交隔离可以提供相当多的并发性,但由于某些事务的幻像和不可重复读取而导致结果不一致的风险有所增加。
问题1:-读提交隔离如何提供比可序列化更多的并发性?根据我的理解,可序列化事务也不会限制并发事务。
声明:- Oracle 可序列化事务中的所有查询都会在单个时间点查看数据库
问题:- 我认为它们在这里意味着什么,当可序列化事务开始时说时间 t1 那么所有数据都将从时间 t1 时数据库的状态呈现。对吗? 不确定我们调用的交易何时真正开始。 是在我们获得连接时还是在第一个查询被触发时?
声明:- Oracle 的可序列化隔离适用于两个并发事务发生概率相对较低的环境修改相同的行,并且长时间运行的事务主要是只读
问题:- 假设两个事务 tran1 和 tran2 在时间 t1 开始。如果 tran1 在时间 t2 更新 row1,并稍后在时间 t3 tran2 获取同一行,tran2 会获得 tran1 完成的更新行吗? (我认为不会,因为 tran2 将获取时间 t1 时存在的数据状态。对吗?)
声明:- 编码可序列化事务需要应用程序开发人员进行额外的工作检查“无法序列化访问”错误并撤消并重试该事务。
问题:- 不确定开发人员何时会收到“无法序列化访问”错误。 在下面的场景中我们会遇到同样的错误吗
假设两个事务 tran1 和 tran2 在时间 t1 开始。如果 tran1 在时间 t2 更新 row1,并稍后在时间 t3 tran2 更新相同的 row1。在这种情况下它会抛出“无法序列化访问”错误吗? 如果是,oracle 是否在可序列化事务的情况下在内部维护版本,以便了解用户已更新行?
I am trying to figure out which isolation level (among serializable and read committed )is better in what scenarios..At link http://download.oracle.com/docs/cd/B14117_01/server.101/b10743/consist.htm#i17894, I was going thru topic choice of isolation level, I got some clarity and some questions based on some statements in the article.
Satement :- Read committed isolation can provide considerably more concurrency with a somewhat increased risk of inconsistent results due to phantoms and non-repeatable reads for some transactions.
Question1:- How Read committed isolation provides more concurrency than serializable?As per myunderstanding serializable transactions also does not restrict concurrent transactions.
Statement:- All queries in an Oracle serializable transaction see the database as of a single point in time
Question:- I think what they mean here , when serializable transaction begin say at time t1 then all the data will be presented from the state of Database which was at time t1.Right?
Not sure when we call the transaction actually begins. Is it when we get the connection or when first query is fired?
Statement:- Oracle's serializable isolation is suitable for environments where there is a relatively low chance that two concurrent transactions will modify the same rows and the long-running transactions are primarily read only
Question:- Say two transactions tran1 and tran2 begin at time t1. If tran1 updates the the row1 at time t2 and later at time t3 tran2 fetches the same row will tran2 get the updated row done by tran1 ? (i think no because tran2 will fetch the state of data which was present at time t1.Right?)
Statement:- Coding serializable transactions requires extra work by the application developer to check for the "Cannot serialize access" error and to undo and retry the transaction.
Question:- Not sure when developer will get “Cannot serialize access” error. Will we get the same error in below scenario
Say two transactions tran1 and tran2 begin at time t1. If tran1 updates the row1 at time t2 and later at time t3 tran2 updates the same row1. Will it throw the “Cannot serialize access” error in this case? If yes Does oracle maintain the version internally in case of serializable transactions so that it gets to know row has been updated by user?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想查看已提交的数据,请选择已提交的读。每个查询可以看到不同的提交数据。
如果您希望多个查询看到相同的结果,请选择可序列化。在您的交易结束之前,将返回相同的结果。
两者都有局限性。选择所需的隔离级别。不要选择超出您需要的隔离级别。
If you want to see committed data, choose read committed. Each query could see different committed data.
If you want to see the same results for multiple queries, choose serializable. The same results will be returned until your transaction ends.
Both have limits. Choose the isolation level that is needed. Do not choose an isolation level that does more than you need.