What kind of thing?
Customer, order, sensor?
Entities define the objects the system needs to represent.
Side 56
A study of persistent structured information. Databases turn real-world entities into schemas, queries and transactions while preserving integrity under repeated reads and writes.
Schema design translates a domain into entities, attributes and relationships.
Customer, order, sensor?
Entities define the objects the system needs to represent.
Name, time, status, amount?
Attributes encode the facts stored about each entity.
Primary + foreign keys.
Keys connect records without relying on ambiguous descriptive fields.
One-to-one, one-to-many, many-to-many?
Relationship structure determines joins and integrity rules.
Nullability, uniqueness, references.
Constraints push data correctness into the persistence layer.
Relational queries describe the result wanted without prescribing every physical step used to obtain it.
Predicates restrict the result to relevant records.
Return only the attributes needed for the task.
Joins reconstruct relationships distributed across normalized tables.
Counts, sums and averages compress many rows into group-level results.
Window functions preserve row detail while adding rank, running totals or comparisons.
Equivalent SQL can have very different physical query plans.
An index is an auxiliary structure that helps the database avoid scanning every row.
Supports equality and range queries efficiently.
Useful when ordering is not required.
Column order matters for which predicates can use the structure efficiently.
Including required columns can avoid extra table lookups.
Each insert, update and delete may require additional index work.
They protect data from partial updates and concurrent interference.
| Property | Meaning | Failure prevented |
|---|---|---|
| Atomicity | All or nothing | Half-completed update |
| Consistency | Rules remain satisfied | Invalid database state |
| Isolation | Concurrent work is controlled | Interference between transactions |
| Durability | Committed changes survive failure | Lost committed work |
Page layout, caching, logs and recovery connect high-level queries to storage hardware.
Databases read and write blocks rather than individual abstract rows.
Memory management strongly affects performance.
Logs enable crash recovery and durability.
Periodic checkpoints reduce how much log must be replayed after a crash.
Replication can improve availability and read scale while introducing consistency trade-offs.
Replication is not a substitute for independent backups.
Normalization reduces contradictory duplication; denormalization can deliberately trade purity for performance.
Separate facts so each authoritative fact has a clear home.
Encode business invariants with keys and checks where practical.
Design around actual query patterns rather than indexing every field.
Inspect query plans, latency and storage growth before optimizing.
Schema migrations must preserve data and application compatibility across versions.