A column named customer_id with no constraint, and 312 rows pointing at customers that had been deleted. Deciding what to do with the orphans is the work —…
A document store added for one collection of variable-shaped supplier payloads, in an application whose other forty tables are relational. The migration back was two days and the…
Filtering on a value inside a JSON array was a full scan until 8.0.17 added multi-valued indexes, and the syntax is unforgiving. The ARRAY keyword in the cast…
An order aggregate containing its lines, its shipments, its refunds and its notes, loaded in full to change a delivery address. Drawing the boundary by what belongs together…
A billing module everybody agrees should be separate, a team of four, and 88 classes that reference it. The boundary, drawn in code rather than in conversation.
MySQL 5.7 parses a CHECK constraint, stores it and never evaluates it, which is worse than rejecting it. A constraint that exists and does nothing is the worst…
An expression in a WHERE clause cannot use an index, and a generated column moves the expression somewhere indexable. The automatic substitution is the good part and requires…
A correlated derived table can reference columns from the row it is joined against, which expresses top-N-per-group directly. A window function with ROW_NUMBER reads more clearly and computes…