jargon

Comparison

NormalisationvsSingle table inheritance

Normalisation

you store the customer's address in exactly one table so that changing it cannot leave four stale copies behind.

Structuring tables so each fact is stored once, with relationships expressed by keys rather than repetition. It makes writes correct by construction: there is no second copy to forget. The cost is joins on the read path, which is why every normalised schema eventually meets a report that needs six of them.

Full entry →

Single table inheritance

one table holds three kinds of thing, a type column says which, and most columns are null for most rows.

Mapping a whole inheritance hierarchy to one table with a discriminator column and the union of all subclass fields. It is the simplest of the three inheritance mapping strategies and the fastest to query, at the cost of nullable columns that the database cannot constrain. The alternatives — a table per class, or a table per concrete class — move the cost to joins or to duplicated columns instead; none of the three is free, which is the impedance mismatch in miniature.

Full entry →

Related comparisons