Why All Data Should Be Thought of As Relational

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

I don't mean to be particularly ranty today, but I have this thought, and it bothers me that I feel like I am the only one that has it.

You see, the relational model of all data fitting into tables with pre-defined columns that may reference other tables is a really, really powerful model. It is so powerful, that you should think of all data as organized this way, even if it doesn't seem to be.

If your data isn't organized this way, then you are doing something wrong.

See, there is a reason that object-oriented databases never took off. It is simply because they didn't give you anything above relational databases. You could do all of the OO stuff in a relational database. (Don't tell the OO database people this. At the time, they would get all upset at you for saying something like that.)

There is a reason that relation databases kicked butt over hierarchical databases. It is because data doesn't always fit into a hierarchy. In fact, data rarely fits into a hierarchy. But if data does fit into a hierarchy, it is easily described in a relational way.

There is a reason that no one is using XML to store their data. It is because ultimately, that data needs to be imported into a relational format before it can become useful. In fact, if you look at the trend of XML formats, they are more and more becoming like a relational format. Else why the abundance of unique ids, limited attributes, etc?

If you look at all the various ways data is stored, in any programming language, then you will see that it is ultimately relational. C's structs, Perl's hashes and lists, Python's dicts, sets, and lists, Lisp's lists, these are all subsets of a relational database. In fact, it was the foundation of Lisp that made PostgreSQL possible. PostgreSQL ultimately stores all its data in lists.

What can you do when you data is stored in a relational format? Why, you can partition it if you need to. You can query it. You can rationalize about it. It all becomes really nice in the end.

See Also