These days query DB2 database, the old encounter select * from XXX with ur, curious what is the role of Ur, now record a bit.
DB2, there are four isolation levels: RS,RR,CS,UR,DB2 provides these 4 different levels of protection to isolate data. Isolation level is an important part of the locking strategy, it directly affects the lock range and the duration of the lock. Two applications, even if the same operation is performed, may result in different locking results due to the different isolation levels chosen.
1, ur (uncommited read) is commonly known as "dirty Read", in the absence of data submitted to be able to read the updated data, is the lowest isolation level, and provides the highest degree of parallelism.
2, CS (cursor stability) in a transaction in the query, allows to read the pre-submission data, the data submitted, the current query can be read to the data, update data when the table is not locked, in this isolation level, the cursor's "current" row is locked. If the row is only read, the lock continues until a new row is accessed or the unit terminates. If the row is modified, the lock continues until the work unit terminates.
3, RS (read stability) Read stability, in a transaction query, not allow to read other transaction update data, allow reading to other transaction committed new data, using read stability, in the same unit of work in a program process retrieved by the entire row will be locked. For a given cursor, it locks all rows that match the result set, for example, if you have a table with 1000 rows and the query returns 10 rows, then only the 10 lines are locked. Read stability uses a medium-level lock.
4, RR (Repeatable Read) is repeatable, repeatable read is the highest isolation level, providing maximum locking and minimal parallelism. All rows that produce the result set are locked, that is, the rows that do not have to appear in the final result sets are locked. No other program can modify, delete, or insert a row that affects the result set until the end of the work unit. Repeat read ensures that the same query that the program makes multiple times in a single unit of work returns results. When querying in a transaction, no data modification is allowed for this query table.
DB2 with UR