This article describes the database transaction isolation level on the impact of the lock, by comparing the transaction isolation level 0 and 1, to understand the relationship between the lock and dirty time.
Experiment: set 0 and 1 respectively, isolation level, the implementation of two different but related issues there. The experimental environment is as follows:
1, the right to access the user database (in this case aca_database) and modify database tables and queries have permissions.
2, the database contains tables auths, including salary column (data type is money), there is a certain amount of data (in 1 million lines).
1, as in the same machine, can be performed separately two "SQL Advantage", respectively legitimate account login, prepare their own implementation of a transaction.
2 Open the user interface in their database aca_database, set the isolation level to 1 (also goes for the default value):
set transaction isolation level 1, see the current isolation level using select @ @ isolation
3, the implementation of the first two sentences of the first transaction, suspending and later committed or rolled back.
update auths set salary = salary +100
4, the implementation of the second transaction select sum (salary) from auths
5, the end of the normal execution of a transaction, but only changes in the memory buffer to complete the transaction and did not really end, do not release the corresponding lock, the second transaction in the wait state. Executable sp_lock and sp_who command.
6, step 3 in order to submit or rollback, the second transaction to be implemented.
7, to change the transaction isolation level is 0, repeat steps 3-4. No change in the first transaction, the second transaction will soon come under the first transaction is made to modify the data results, it seems that the implementation of the response on the first transaction is not subject to influence.
8 Repeat step 6 the end.
Through the above experiments we know that:
1, transaction isolation level 0 allows dirty read transaction isolation level 1, does not allow dirty read, but rather wait for real before the end of a modified transaction and release the lock.
2, isolation level 0, if the modification is to rollback the last transaction, then the query time transaction will not read the correct data.
3, satisfied that there is no rollback transaction possible, and called for greater efficiency and parallel implementation, only then we may consider setting isolation level to 0.
Flash to MPEG
Switch Network Device
INFOMATION Helpdesk And Remote PC
Easy To Use Graphic CAD
My Experience With AutoCAD Rendering
Baidu's sensual JOURNEY
Year Season: How To Make Cash "flow Up"
SWF to MP4
How to avoid price War
British grams, Novel Medicine 1000 Chain layout help
Shop Audio CD Players
Suspected Of Extortion Donews Producer Liu Ren Denies Allegations
Call of operations of Foreign carriers
Citrix Appoints CAO Heng Kang As vice president and general manager of Greater China
DVR-MS to MPG