eli5 What is a non relational database ?


eli5 What is a non relational database ?

In: 11

A non-relational database (like nosql) uses a storage structure that isn’t the tabular storage (rows and columns) system that relational databases do.

They are more purpose driven and are useful, when tailored, for a large scale system serving large amounts of data, but has difficulties in being queried in a generalized way.

Think of it as a building that might not have bedrooms and bathrooms like a traditional house, but it purposely constructed to store caustic chemicals so is useful for that purpose.

A relational database consists of pre-defined tables, where the data in table one is referred to by data in table two.

In a non-relational database the tables are not pre-defined, they just contain lots of key-pair values per record.

So it might be that a record contains the key “foo”, but that the others don’t. You can still do the equivalent of “select foo from table”, you just only get the records back with that key.

Personally I don’t like this, but others have a good use for it.

A relational database is a database that relies on (related) tables for data storage. Typically they’ll use some flavor of SQL (structured query language) for access.

Any database that doesn’t rely on a tabular structure is not relational (or, more commonly, NoSQL). There are [several different types](https://en.wikipedia.org/wiki/NoSQL#Types_and_examples) of NoSQL database, and which one is best depends on context.

I like to think. Non relational simply as a filing cabinet. All these records go in this drawer, these different records go in this drawer. It doesn’t matter that the drawer is next a drawer holding unrelated files as long as each drawer only contains files of its type. We would still know where to go look for each file.

Versus a relational which would be like this filing cabinet has several drawers and each drawer contains a reference to the other drawers that might make this file more interesting if needed.

Which kind?

There is the hierarchical database ([https://en.wikipedia.org/wiki/Hierarchical_database_model](https://en.wikipedia.org/wiki/Hierarchical_database_model)) where data is organized into a tree structure. Very fast for certain kinds of searching, but not particularly popular anymore.

There is the navigational database ([https://en.wikipedia.org/wiki/Navigational_database](https://en.wikipedia.org/wiki/Navigational_database)), which a hierarchical is arguably a type of.

These were mostly popular when computers were still super expensive. But as relatively cheap disks and processors became available they were supplanted by the relational database.

Going forward, as computers continue to get faster, you now have object databases ([https://en.wikipedia.org/wiki/Object_database](https://en.wikipedia.org/wiki/Object_database)), NoSQL ([https://en.wikipedia.org/wiki/NoSQL](https://en.wikipedia.org/wiki/NoSQL)), and probably others as well.