Atop the Shoulders of…
In Chapter 4, I discussed the idea of standing atop the shoulders of giants. Information architecture and database normalization techniques are highly developed areas of research. It should be no surprise that scholarly papers dealing with key selection go back more than 25 years. Here we have a perfect example of where we should not neglect to sit atop the shoulders of our predecessors.
In 1981, Ronald Fagin of IBM Research Laboratories introduced domain key/normal form (DK/NF) in his paper “A Normal Form for Relational Databases That Is Based on Domains and Keys,” published in the journal ACM Transactions on Database Systems. In his paper, Fagin proved mathematically that a schema design in which keys are chosen as the smallest set of columns that naturally and uniquely identify a row of data absolutely prevents anomalies, such as the one we created earlier where a movie showtime could occur in an auditorium that didn’t exist in the theatre the movie was set to play in. Sometimes these keys are a single id column, sometimes they are single columns that have intrinsic, natural meaning, and sometimes they are composite keys made up of mutiple columns. The overriding point is that there is no one-size-fits-all solution. Each table must be analyzed on a case-by-case basis to determine how it contributes to the whole of the schema.
The best relational databases we have today grew out of the research of past decades. Even a concept that may be taken for granted ...
Get Enterprise Rails now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.