WITH UR for Uncommitted Reads in DB2 | Generated by AI

Home 2026.01

Question: What does “WITH UR” mean in DB2?

Answer:

In DB2 (IBM Db2), WITH UR is a clause you can add to a SELECT statement to specify the Uncommitted Read isolation level for that particular query.

What it does:

SELECT * FROM employee WHERE dept = 'A00' WITH UR;

Comparison of common DB2 isolation levels:

Isolation level Clause Locks taken Can read uncommitted data? Typical use case
UR WITH UR Almost none Yes (dirty read) Reporting, monitoring, non-critical reads
CS WITH CS Short read locks No Default for many applications
RS WITH RS Read stability locks No Need consistent view during query
RR WITH RR Strong repeatable read No Highest consistency, heavy locking

Advantages of USING WITH UR

Disadvantages / Risks

Summary

WITH UR = “I accept dirty / uncommitted data in exchange for maximum speed and zero blocking.”

It’s one of the most frequently used DB2-specific hints in production environments, especially on Db2 for z/OS.

References:


Back

x-ai/grok-4.1-fast

Donate