Friday, September 17, 2010

SYBASE Services



Services

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).

Steps:

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.

begin transaction

update auths set salary = salary +100

commit transaction

(Rollback transaction)

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.







Recommended links:



Storage Pager Tools



Unicom officially started selling 30 iPhone "contract USER" pay 1 month prognosis,



E-cology In The Pan Micro Series 45



Cattle Were Made With Maya The Whole Process Of Real Eye



Avc-free



Experience the wind took the new brilliant new housekeeper brilliant new listing 2008



Catalogs Security And Privacy:



Kaspersky characteristics of "internationalization" and "localization"



Multinational corporations, where the Moral bottom line



How to convert a mp4 to wmv



Top Ad Blockers



Domain name will be the first time Chinese and other non-Latin alphabet and opening support 11 langu



ogm On ps3



Art - Screen Savers Report



Production activities yourself menu bar



mp4 to ipod converter



No comments:

Post a Comment