Practice
Solution
Step 1: Recall Durability definition
Durability means once a transaction commits, its changes survive system failures.Step 2: What ensures durability?
Changes must be flushed to stable storage (disk) before acknowledging commit.Step 3: Analyze options
A is incorrect because volatile memory is not durable. B is about visibility, not durability. D contradicts durability.Final Answer:
Option C -> Option CQuick Check:
Durability requires stable storage flush before commit acknowledgment.
- Assuming volatile memory is enough for durability
- Confusing visibility with durability
Solution
Step 1: Locate insertion point in clustered index B-tree
The clustered index is a B-tree; the database finds the leaf node where the key fits.Step 2: Insert row physically in sorted order
The row is inserted in sorted order within the leaf page.Step 3: Handle leaf page fullness
If the leaf page is full, it splits, and parent nodes are updated to maintain B-tree properties.Step 4: Update parent nodes
Parent nodes reflect new keys and pointers after split.Final Answer:
Option D -> Option DQuick Check:
Clustered index insertion -> B-tree leaf insert + possible split [OK]
- Thinking rows are shifted physically like an array (Option A)
- Assuming append-only insertion (Option B)
- Confusing clustered and non-clustered index insertion order (Option C)
Solution
Step 1: Recall Atomicity meaning
Atomicity means all-or-nothing execution of a transaction.Step 2: Analyze each option
A is correct; C is correct as partial updates violate atomicity; D is correct as logging and rollback implement atomicity.- B is incorrect because Atomicity does not prevent interruption by other transactions; that is Isolation's role.
Final Answer:
Option B -> Option BQuick Check:
Atomicity is about completeness, not concurrency control.
- Confusing Atomicity with Isolation
- Assuming Atomicity controls transaction scheduling
Solution
Step 1: Analyze read-write blocking
MVCC is designed to avoid read-write blocking, so this is correct.Step 2: Analyze visibility of most recent data
Incorrect because MVCC provides snapshot isolation; transactions see a consistent snapshot as of their start time, not necessarily the most recent committed data.Step 3: Analyze version visibility determination
MVCC uses transaction IDs or timestamps to determine visibility, so this is correct.Step 4: Analyze cleanup requirements
Periodic vacuuming or cleanup is required to remove obsolete versions, so this is correct.Final Answer:
Option B -> Option BQuick Check:
MVCC snapshots are fixed at transaction start, not always the latest data [OK]
- Assuming MVCC always shows the latest committed data
- Believing MVCC causes read-write blocking
- Ignoring the need for version cleanup
SELECT category, product_id, total_sales,
RANK() OVER (ORDER BY total_sales DESC) AS rank
FROM (
SELECT category, product_id, SUM(sales_amount) AS total_sales
FROM sales
GROUP BY category, product_id
HAVING SUM(sales_amount) > 200
) sub
ORDER BY category, rank
Solution
Step 1: Examine window function usage
The RANK() function lacks PARTITION BY category, so ranking is global, not per category.Step 2: Understand impact on results
Without partitioning, ranks mix products from all categories, breaking per-category ranking requirement.Final Answer:
Option A -> Option AQuick Check:
Adding PARTITION BY category fixes ranking scope [OK]
- Confusing HAVING and WHERE
- Forgetting partition in window functions
