Transaction Isolation level Massive number of Writes

a 夏天 提交于 2019-12-25 04:14:10

问题


I may be talking nonsense but:

Which isolation level is "best" for lots of Threads running on lots of connections, executing lots of updates and writes using transactions? Or isolationlevels are only for reads?

--EDIT DBMS ... InnoDB mysql... best.. well what i want is to run parallel transactions of writes/updates, and if for example we have two updates on the same Column, i do not whant to get concurrency problems...

so parallel writes/updates, which all run with locking on the database --EDIT After couple of readings came to this conclusion

http://dev.mysql.com/doc/refman/5.0/en/innodb-lock-modes.html

So Update takes row lock, not a shared lock, so there should be no problems when updating. But one must check beforehand which thread comes to the connections that locks.. So there should be no concurent updates to the databse on the same row... so

NO:

t1 - T1: update (id 1) 
t2 - T2: update (id 1)

One must care that two threads do not come to update the same row... but from database point of view, as long it is InnoDB and has lowest level of Isolation READ_UNCOMMITED, there should not be a problem I will come with an update after couple of moths :D


回答1:


As a rule of thumb: the higher your isolation leven (higher meaning: more isolation) the more locks and overhead you get. So if you want to go as fast and as parallel as possible you want no isolation at all.

Of course this might destroy your business logic, so I think there really is no alternative to looking at all the isolation levels available and checking them against your requirements.



来源:https://stackoverflow.com/questions/9519610/transaction-isolation-level-massive-number-of-writes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!