In the beginning, things were relational
Okay, so maybe not the very beginning, but pretty early on.
I think it's fair to call the relational model the classic approach
.
At the least, relational databases have been the de facto off-the-shelf solution for information storage and retrieval for the past 40 years.
Most of us are familiar with the relational model, but let's quickly review:
- relations are tuples, each field in the tuple is an attribute with a domain, as specified by a schema
- relations can be retrieved by matching combinations of their attributes
- relations can be joined via their common attributes
Here's what our schema and relations might look like in a relational database:
I can't help but notice that there are several awkward things about this model.
First of all, there is an impedance mismatch between the data we are collecting, and how it is handled by the database.
Our variable length lists were transformed into separate relations, tied to their owner
by an id.
We had to define three types of relations initially, and must use those whenever we want to work with the data.
This places a cognitive burden on not only the developer, but also on the machine.
There is a ubiquitous layer of mapping between the natural
form of the data, and the relational form, and that is not free.
Secondly, we are required to declare all the attributes our relations may have up front.
During development especially, this can be an onerous burden.
When multiple parts of the system are evolving in parallel, such a rigid structure can slow down iterations on the system itself.
Of course in other cases, we may find such structure valuable, but in this particular case, it feels unnecessary.
Finally, in the real world, we need to give the database more information in order to feasibly handle the ways we are going to search.
We generally declare indices along with our schema, so that the database knows to make retrieval by those attributes more efficient.
Any property we want to search by must be an attribute within a relation, we cannot derive properties just for searching.
The support for partial text matches are foreign to the relational model, and would need to be handled by custom extensions to the model, specific to the particular database we are using.
I can't help feeling that this is all more complicated than it needs to be.