SQL Server committed read snapshot test

Source: Internet
Author: User

1. Open the database submitted read snapshot option

2. The database has been submitted to read the test in snapshot mode

A) test table tests

b) Turn on transaction 1, update data C2 = ' 200 ' (not submitted)

BEGIN TRAN UPDATE SET = '  $ ' WHERE = ' A ' -- COMMIT

c) Query data (query is not blocked, C2 = ' 100 ')

SELECT *  from Test

d) Turn on transaction 2, update data C2 = ' 300 ' (uncommitted), update operation is blocked (waiting for transaction 1 commit)

BEGIN TRAN UPDATE SET = '  - ' WHERE = ' A ' -- COMMIT

e) COMMIT Transaction 1, re-query the data, the data has been updated to ' 200 ', transaction 2 blocking has been lifted

SELECT *  from Test

f) COMMIT TRANSACTION 2, query data, data has been updated to ' 300 '

SELECT *  from Test

3. Committed read mode vs committed read Snapshot differences:

A) If a transaction is not committed, the read operation will be blocked

4. Session level Set database isolation level

A) The original isolation level is a read-committed snapshot, and the query is not blocked

b) Session adjustment isolation LEVEL (repeatable Read), query blocked

SQL Server committed read snapshot test

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.