Skip to content
Part IA Michaelmas Term

Storage, Consistency, and CRUD

Storage classifications

Databases can be classified along three axes:

By medium

TypeDescription
In-coreData held entirely in primary memory (RAM). Fast, but capacity-limited and ephemeral.
Secondary storageData held on disk or SSD. Persistent, high capacity, but slower access.

By persistence

TypeDescription
EphemeralData disappears when the process exits or the machine loses power.
PersistentData survives process termination and power cycles.

By scale

TypeDescription
In-core (big data fits)The entire dataset can reside in RAM. Simplifies design.
Big dataThe dataset exceeds available RAM. Requires careful management of what is in memory and what is on disk.

Write patterns

PatternCharacteristicsExample use case
Read-optimisedData rarely changes; heavy read traffic. Indexes built aggressively.Reference data, product catalogues
Transaction-optimisedMany concurrent queries and updates. Locking and logging dominate.Banking, ticket booking
Append-only journalData is never overwritten; only appended. Old state preserved.Audit logs, event sourcing

Consistency models

ACID (strong consistency)

Atomicity, Consistency, Isolation, Durability. Every transaction is an indivisible unit: it either completes entirely or has no effect. After a transaction commits, all subsequent reads see its effects. This is the traditional model in relational DBMSs.

BASE (relaxed consistency)

Basically Available, Soft state, Eventual consistency. The system may not be immediately consistent after an update, but if updates cease, all replicas will eventually converge. This model is common in distributed NoSQL systems.

PropertyACIDBASE
ConsistencyStrong, immediateEventual
AvailabilityMay block during partitionsPrioritised
ComplexityHigher for the DBMSHigher for the application
Typical useFinancial transactionsSocial media, content delivery

Data arrangement

ModelStructure
RelationalData in tables with rows and columns. Schema enforced.
Semi-structured (document)Data as nested documents (JSON, XML). Schema flexible or absent.
GraphData as nodes and edges. Rich support for path-oriented queries.

Consistency checks

A DBMS can enforce several kinds of constraint:

CheckDescriptionExample
Value rangeA field’s value must fall within a specified domainweight cannot be negative
Foreign key referential integrityA value referencing another record must point to something that existsA patient’s GP must exist in the Doctors table
Value atomicityEach field holds one piece of informationDo not cram two street names into a single address field
Entity integrityEvery row must be identifiableNo row may have a NULL primary key

Summary

  • Databases are classified by storage medium (in-core vs. secondary), persistence (ephemeral vs. persistent), and scale.
  • Write patterns range from read-optimised to append-only.
  • ACID provides strong guarantees; BASE trades consistency for availability and partition tolerance.
  • Consistency checks — domain, referential, atomicity, entity — protect data quality.