In DB2, if a database is defined without logging, which isolation level does it default to?

Difficulty: Medium

Correct Answer: Dirty read isolation

Explanation:


Introduction / Context:
This question focuses on DB2 isolation levels and logging. Logging supports transaction durability and recovery. When logging is disabled, certain isolation guarantees cannot be fully enforced, and DB2 adjusts the default isolation level accordingly. Understanding this behavior is important for designing safe applications.


Given Data / Assumptions:

    The database has been created without logging, often for specific workload types.

    Isolation levels control what kinds of uncommitted changes a transaction can see.

    Standard DB2 isolation levels include uncommitted read, committed read, cursor stability, and repeatable read.

    The question asks for the default isolation level chosen by DB2 in a no logging configuration.


Concept / Approach:
When logging is not present, DB2 cannot roll back changes in the same way it does for logged databases. The uncommitted read or dirty read isolation level relaxes consistency guarantees by allowing transactions to see changes that have not yet been committed. This aligns with the reality of a no logging environment, where durability and strict isolation are reduced to prioritize performance or special use cases.


Step-by-Step Solution:
1. Recall that dirty read isolation allows reading uncommitted data and is often associated with minimal logging or recovery. 2. Committed read and repeatable read require stronger guarantees that depend on logging to support rollback and consistency. 3. ANSI mode refers to a compatibility behavior rather than a single isolation level. 4. Because the database does not log changes, the safest assumption is that DB2 defaults to the weakest isolation level, dirty read. 5. Therefore, dirty read is the correct answer.


Verification / Alternative check:
DB2 reference materials indicate that databases without logging use uncommitted read behavior by default. Testing a no logging database and examining current isolation settings can also confirm this.


Why Other Options Are Wrong:
Committed read requires that only committed data be visible, which conflicts with a no logging scenario where rollback semantics are limited.
ANSI mode is not an isolation level and does not specifically describe behavior for no logging databases.
Repeatable read demands strong consistency guarantees that are not practical without logging and proper lock management.


Common Pitfalls:
A common misunderstanding is assuming that isolation levels are independent of logging. In reality, without logging, some guarantees cannot be met, and DB2 chooses a level consistent with reduced durability. Developers must be careful not to expect strict transactional behavior from a no logging database.


Final Answer:
A database without logging defaults to dirty read isolation.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion