ADVANCEDFrequently Tested 4 min read 9 views
DBMS 2027 Rank-Decider: Relational Division (R ÷ S), SQL Double-NOT-EXISTS & ARIES WAL Recovery
Primitive operator expansion of Relational Division R(X,Y) ÷ S(Y), De Morgan double-NOT-EXISTS SQL pattern, Steal/No-Force Write-Ahead Logging (Undo vs Redo), and Blind-Write View Serializability.
1. Universal Quantification ("For All") in Relational Algebra & SQL
Since SQL has no FOR ALL keyword, rewrite via De Morgan’s law as (Double NOT EXISTS):
sql
-- Find Student IDs enrolled in ALL courses offered by 'CS' department
SELECT s.sid FROM Students s
WHERE NOT EXISTS (
SELECT c.cid FROM Courses c WHERE c.dept = 'CS'
AND NOT EXISTS (
SELECT 1 FROM Enrolled e
WHERE e.sid = s.sid AND e.cid = c.cid
)
);
Common Exam Mistake
Empty Divisor Edge Case: In the SQL double-NOT EXISTS query above, if the CS department offers courses (S is empty), the outer NOT EXISTS evaluates to TRUE for EVERY student in Students!
2. Crash Recovery: Write-Ahead Logging (WAL), Deferred vs Immediate Update
| Recovery Scheme | Buffer Policy | Uncommitted Writes on Disk? | On Crash: Committed Txns | On Crash: Aborted/Active Txns |
|---|---|---|---|---|
| Deferred Update | NO-STEAL / NO-FORCE | ❌ Never | REDO (need new value) | NO-UNDO (simply ignore!) |
| Immediate Update (ARIES) | STEAL / NO-FORCE | ✅ Possible | REDO (forward order) | UNDO (reverse log order!) |
- Two Golden WAL Rules: (1) Before a modified dirty page hits disk, its
<Ti, X, old, new>Undo log record must be flushed to stable storage (STEAL safety); (2) BeforeTiis declared committed to the user, all its log records through<Ti, COMMIT>must be flushed to stable storage (NO-FORCE durability)! - View Serializable WITHOUT being Conflict Serializable: Requires at least one Blind Write (writing without first reading )! If a schedule has zero blind writes, View Serializable Conflict Serializable!
Key Formulas Summary
Relational Division R(X, Y) ÷ S(Y) Using ONLY Primitive Operators (pi, sigma, x, -)
Note: Answers universal "FOR ALL" queries: Find X tuples paired in R with EVERY Y tuple in S!
#DBMS#Relational Division#SQL NOT EXISTS#Tuple Calculus#ARIES Recovery#WAL#GATE CS 2027
Practice Questions on This Chapter (2)
Q1GATE CS 2027 ExpectedMCQMEDIUM
+2M • -0.67
Let have tuples with distinct values of , and let be non-empty with tuples. What are the minimum and maximum possible numbers of tuples in the Relational Division ?
⚡ Click an option above to verify instantly
Q2GATE CS 2026–27 Expected MSQMSQHARD
+2M • 0 Neg
Which of the following statements regarding Database Concurrency & Crash Recovery are ALWAYS TRUE?
☑️ Multiple Select Question — pick one or more options, then click Check Answer.