Database Design Challenges
This chapter focuses on real-world database design, where performance, consistency, simplicity, flexibility, and storage requirements may conflict.
5.1 Conflicting Design Forces
Introduction / Definition
Database design involves competing goals. Normalization can reduce redundancy but may increase joins. Indexes can accelerate reads but increase storage and write cost. Strong consistency can simplify correctness but may constrain throughput or availability in distributed systems.
Syntax / Structure
Consistency ↔ Performance
Normalization ↔ Fewer joins
Read speed ↔ Write cost
Storage efficiency ↔ Redundancy
Detailed Explanation
An e-commerce system may keep normalized source tables for correctness while using indexes, summary tables, caches, or materialized views for frequent read workloads. The correct solution depends on measurable requirements.
Example
PRODUCT(Product_ID, Name, Category_ID)
CATEGORY(Category_ID, Category_Name)
A reporting layer may precompute frequent aggregates.
Output / Result
The design preserves a source of truth while adding a specialized read path.
Important Points / Notes
- There is no universally perfect schema.
- Evaluate conflicts using workload and requirements.
- Document deliberate compromises.
Mini Practice Question
Give one example of two database design goals that can conflict.
5.2 Design Trade-offs
Introduction / Definition
A design trade-off means accepting some cost or limitation to gain another benefit. Examples include normalization versus denormalization, more indexes versus faster writes, and fresh computation versus precomputed results. Good trade-offs are evidence-based and tested against real workloads.
Syntax / Structure
- Requirement → Alternatives → Cost/Benefit → Risk → Measurement → Decision
Detailed Explanation
If a dashboard repeatedly computes an expensive aggregate, it can calculate it on every request or precompute it. Precomputation may reduce response time but introduces maintenance and freshness concerns.
Example
Option A: compute AVG(Marks) at request time.
Option B: store/update a summary value for dashboard reads.
Output / Result
Option A favors simplicity and freshness; Option B may favor faster reads.
Important Points / Notes
- Consider read/write frequency.
- Consider freshness requirements.
- Consider storage and maintenance.
- Do not denormalize without a reason.
Mini Practice Question
When is denormalization a reasonable design choice?
5.3 Resolution of Design Conflicts
Introduction / Definition
Design conflicts can be resolved systematically by identifying requirements, measuring current behavior, evaluating alternatives, testing realistic workloads, and monitoring after deployment. Often the best solution is layered: normalized base tables can coexist with indexes, caches, summary tables, or materialized views.
Syntax / Structure
1. Identify conflict
2. Define measurable requirement
3. Compare alternatives
4. Prototype/test
5. Implement controlled change
6. Monitor and revise
Detailed Explanation
If a report takes 8 seconds but must run in under 2 seconds, inspect the execution plan first. Potential solutions include better indexes, query rewriting, pre-aggregation, caching, or materialized views. Choose the least costly solution that meets the target without sacrificing correctness.
Example
Problem: Report = 8 s
Target: < 2 s
Investigate: execution plan → indexes → query rewrite → precomputation/cache
Output / Result
The conflict is resolved through measured optimization rather than guesswork.
Important Points / Notes
- Use evidence rather than intuition.
- Prefer the simplest solution meeting the target.
- Test under realistic load.
- Monitor after deployment.
- Preserve a reliable source of truth.
Mini Practice Question
A report takes 10 seconds and must be below 3 seconds. List three actions you would investigate.
Quick Revision Sheet
Concept
Key Idea
DBMS
Software that manages databases and controlled access to stored data.
Schema / Instance
Schema = structure; instance = current database state.
Relation
Mathematical table-like structure of tuples and attributes.
Degree / Cardinality
Degree = number of attributes; cardinality = number of tuples.
FD
X → Y means X determines Y.
1NF
Atomic values; no repeating groups.
2NF
1NF plus no partial dependency on a composite key.
3NF
2NF plus removal of problematic transitive dependency.
BCNF
Every determinant of a non-trivial FD is a superkey.
4NF
Controls non-trivial multivalued dependencies.
Primary Key
Uniquely identifies a row and cannot be NULL.
Foreign Key
References a key in another relation.
Selection
σ_condition(R) filters rows.
Projection
π_attributes(R) selects columns.
Join
Combines related tuples.
Relational Calculus
Declarative formal query approach.
Relational Algebra
Operational formal query approach.
SQL
Practical language for relational databases.
Index
Auxiliary access structure that can speed suitable queries.
B+ Tree
Balanced multiway index structure with linked leaves.
ACID
Atomicity, Consistency, Isolation, Durability.
Transaction
Logical unit of work committed or rolled back.
Throughput
Completed operations / elapsed time.
Design Trade-off
Balance between competing database requirements.
Important Mathematical Notation
- R(A₁, A₂, …, Aₙ) — relation schema
- X → Y — functional dependency
- X ↠ Y — multivalued dependency
- σ_condition(R) — selection
- π_attributes(R) — projection
- R ∪ S — union
- R − S — set difference
- R × S — Cartesian product
- R ⋈ S — join
- Throughput = completed operations / elapsed time
- B-tree search is approximately logarithmic in the number of keys, with branching factor affecting tree height.
Practice Set
- Explain the difference between data and information with a database example.
- Compare 2-tier and 3-tier DBMS architecture.
- If A → B and B → C, what dependency follows by transitivity?
- Explain how normalization reduces update anomalies.
- Write relational algebra for students with Marks > 75 and project their names.
- Write SQL to find average salary by department.
- Explain one benefit and one disadvantage of indexing.
- Explain ACID properties using an online payment example.
- Differentiate response time and throughput.
- Give one database design conflict and explain how you would resolve it.
End of Notes
These notes provide a complete book-wise foundation for the 4-credit Mathematics to Data Management course, with mathematical notation, database theory, SQL, performance concepts, transaction concepts, and practical design examples.