DBMS 80/20 Cheat Sheet: Core Concepts for UCS3001
A DBMS stores data once, enforces rules, and keeps concurrent work correct; normalization removes redundancy, while serializability and logging keep transactions reliable.
Core Principles
- Three-schema architecture: external views, conceptual logic, internal storage; schema = blueprint, instance = current data
- Data independence: physical changes need no logical-schema change; logical changes are harder to achieve
- FD X→Y: equal X values force equal Y values; test super keys via attribute closure X+
- 1NF atomic cells; 2NF no partial dependency; 3NF no transitive dependency on non-prime attributes; BCNF every determinant is a super key
- Conflict serializable: no cycle in precedence graph; view serializable is more general but harder to test
- Recovery: WAL forces log to disk before data page; UNDO uncommitted, REDO committed
- 2PL: growing then shrinking lock phase; guarantees conflict serializability but deadlocks remain possible
Action Steps
- Draw ER diagram, mark keys and cardinalities (achieves correct table mapping)
- Map 1:N by placing the '1' side's PK as FK on 'N' side
- Map M:N with a junction table keyed by both foreign keys
- Compute closures of candidate keys to find all keys (reveals hidden dependencies)
- Split partial dependencies first, then transitive ones (reaches 3NF safely)
- Build precedence graph for schedule; topological order yields equivalent serial order
- Always write WHERE before UPDATE/DELETE (prevents full-table changes)
Formulas
- Attribute closure test: $$X^+ = \{A_1,\dots,A_n\} \Rightarrow X \text{ is super key if } X^+ = R$$
- Armstrong Transitivity: $$X \rightarrow Y \wedge Y \rightarrow Z \Rightarrow X \rightarrow Z$$
- Lossless binary split test: $$(R_1 \cap R_2) \rightarrow R_1 \text{ or } (R_1 \cap R_2) \rightarrow R_2$$
Key Terms
- Lossless-join decomposition: Joining decomposed relations recreates the original exactly, with no lost information or spurious rows.
- Write-ahead logging (WAL): Log record of a change reaches stable storage before the changed data page is written to disk.
- MVCC: Keeps multiple data versions so readers see consistent earlier versions while writers create new ones.
- Multiple granularity locking: Locks at database, table, page or row levels; intention locks (IS, IX, SIX) signal planned lower-level locks.
- Two-phase commit (2PC): Coordinator collects prepare votes from all sites, then commits only if every participant votes yes.
Pro Tips
- Use IS NULL, not = NULL: comparisons with NULL evaluate to UNKNOWN and silently drop rows
- Use HAVING for aggregate conditions because WHERE runs before grouping
- Read-read operations never conflict, so many schedules pass conflict tests without locking
- Strict schedules are cascadeless, and cascadeless schedules are recoverable, not the reverse
- Ternary relationships should not be split into binary ones; you lose which supplier supplies which part to which project
Pitfalls to Avoid
- Writing UPDATE/DELETE without WHERE changes every row, destroying data silently
- Replacing a ternary relationship with binary ones loses the original combined meaning
- Assuming 3NF implies BCNF: a prime-attribute determinant can pass 3NF but fail BCNF
- Indexes speed reads but add cost to every INSERT, UPDATE and DELETE
- Ignoring deadlock risk in basic 2PL: serializable schedules can still freeze
Myth vs Reality
- The 80/20 rule guarantees good exam marks.: The guide calls it a study strategy only; it prioritises high-value concepts but guarantees no marks.
- Higher normal form is always better.: BCNF may sacrifice dependency preservation; denormalization is deliberate for read-heavy workloads.
Real World Examples
- Bank transfer of 500 from account A to B: Wrap both UPDATEs in BEGIN/COMMIT so atomicity rolls back half-finished transfers after failure.
- ENROLLMENT(StudentID, CourseID, StudentName, CourseTitle, Grade): StudentName depends on StudentID alone, so split into STUDENT, COURSE and ENROLLMENT for 2NF.
Statistics
- Syllabus hours per unit (5 units): 8 hours each, 40 total
- Bank transfer example amount: 500 from Account A to B
Related cheat sheets
More like this