Talking about the four isolation levels of DB2

Source: Internet
Author: User

The isolation level defines the behavior that is used to control the concurrency transaction, which determines how the data is locked when data is accessed and how it is isolated from other processes.

Includes four levels, from high to Low:

RR (Repeatable Read)

RS (read stability)

CS (cursor stability)

UR (Uncommitted Read)

1.RR Isolation Level: Under this isolation level, DB2 locks all relevant records. During the execution of an SQL statement, all records executed by this statement are scanned with corresponding locks. During the execution of an SQL statement, all records executed by this statement are scanned with corresponding locks. The type of the specific lock is still determined by the type of operation, and if it is read, a shared lock, or an exclusive lock if it is an update. The type of the specific lock is still determined by the type of operation, and if it is read, a shared lock, or an exclusive lock if it is an update. Because all the records scanned for the results of the SQL statement are locked, the number of locks can be huge, and at this point the increase in the index can have a significant impact on the execution of the SQL statement, because the index affects the number of records scanned by the SQL statement. Since all the records scanned for the results of the SQL statement are locked, the number of locks can be huge, and at this point the increase in the index can have a significant impact on the execution of the SQL statement, because the index affects the number of records scanned by the SQL statement.

2.RS Isolation Level: The requirement for this isolation level is slightly weaker than the RR isolation level, which locks all qualifying records under this isolation level. Whether it is a read or an update, if the SQL statement contains a query condition, the corresponding lock is added to all qualifying records. Whether it is a read or an update, if the SQL statement contains a query condition, the corresponding lock is added to all qualifying records. If there is no conditional statement, that is, all records in the table are processed, all records are locked. If there is no conditional statement, that is, all records in the watch are processed, all records are locked.

3.CS Isolation Level: This isolation level locks only the records that are currently being processed.

4.UR Isolation Level: At this isolation level, there is no row-level lock if it is a read operation. For a non-read-only operation, its lock processing is the same as CS. For non-read-only operations, its lock processing is the same as CS. DB2 The default isolation level is CS. DB2 The default isolation level is CS. That is, cursor stability. That is, cursor stability.

Talking about the four isolation levels of DB2

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.