Practice
Solution
Step 1: Understand denormalized data updates
Denormalization duplicates data, so updates must be applied to all copies to maintain consistency.Step 2: Analyze update propagation
Most systems require explicit or programmatic updates to each redundant copy; automatic propagation is rare.Step 3: Evaluate options
The update occurs once in the primary table and automatically propagates to all redundant copies without delay incorrectly assumes automatic propagation without delay. The database engine prevents updates to denormalized fields to maintain integrity is false; updates are allowed but complex. Updates are queued and applied asynchronously, ensuring eventual consistency but possible stale reads describes an eventual consistency model, which may apply but is not guaranteed.Final Answer:
Option A -> Option AQuick Check:
Manual or programmatic updates risk temporary inconsistency in denormalized data [OK]
- Assuming automatic update propagation
- Believing denormalized fields are immutable
- Confusing synchronous and asynchronous update models
Solution
Step 1: Understand optimistic concurrency assumptions
Optimistic control assumes conflicts are rare and avoids locking during transaction execution.Step 2: Analyze behavior under high contention
When conflicts are frequent, many transactions abort and retry, reducing throughput.Step 3: Evaluate misconception
Believing optimistic control always improves throughput ignores the cost of retries and aborts in high-contention scenarios.Final Answer:
Option A -> Option AQuick Check:
Optimistic concurrency is beneficial mainly when conflicts are infrequent.
- Assuming no locks means always better performance
- Ignoring the cost of transaction retries
- Confusing optimistic validation with locking
Solution
Step 1: Understand strict 2PL behavior
Strict 2PL holds exclusive locks until commit, which can increase waiting times.Step 2: Analyze deadlock potential
Because locks are held longer, deadlocks can occur more frequently, reducing concurrency.Step 3: Evaluate options
B is incorrect; strict 2PL does not eliminate deadlocks. C is incorrect; locks are not released early. D is wrong; lock compatibility checks are essential. A correctly identifies the trade-off.Final Answer:
Option A -> Option AQuick Check:
Strict 2PL trades off concurrency for serializability, increasing deadlock risk.
- Believing strict 2PL prevents deadlocks
- Thinking locks can be released early in strict 2PL
- Ignoring lock compatibility checks
Solution
Step 1: Analyze query pattern filtering on status and recent dates
Queries filter on status and recent dates, so both columns are used in WHERE clause.Step 2: Evaluate current indexes
Clustered index on date helps range scans; non-clustered on status helps filtering but not combined efficiently.Step 3: Consider composite index benefit
A composite non-clustered index on (status, date) supports filtering by status and ordering by date efficiently.Step 4: Assess other options
Changing clustered index to status loses physical ordering benefits for date range queries; dropping indexes reduces performance; separate indexes cause extra lookups.Final Answer:
Option C -> Option CQuick Check:
Composite index on (status, date) + clustered on date -> best for combined filters [OK]
- Assuming clustered index must be on single most filtered column
- Ignoring composite index advantages
- Believing separate indexes always suffice for multi-column filters
Solution
Step 1: Understand Snapshot Isolation
Snapshot Isolation provides a consistent snapshot for reads and detects write-write conflicts at commit.Step 2: Identify Possible Anomalies
Dirty writes are prevented; lost updates are prevented by conflict detection; phantoms are not prevented by locking ranges.Step 3: Recognize Write Skew
Write skew can occur when two transactions read overlapping data and update disjoint rows, leading to inconsistent state.Step 4: Conflict Handling
Snapshot Isolation detects write-write conflicts and aborts one transaction to prevent lost updates, but write skew can still occur.Final Answer:
Option A -> Option AQuick Check:
Write skew is a subtle anomaly Snapshot Isolation does not prevent fully.
- Confusing dirty writes with dirty reads
- Assuming Snapshot Isolation prevents all anomalies including write skew
- Believing phantoms are prevented by Snapshot Isolation
