Types and Examples of NoSQL Databases
NoSQL databases are growing with very rapid speed because of their exciting features like more flexibility and scalability, schema-free architecture, easy replication support, simple API, consistent / BASE (not ACID), support for big data and more.
What is NoSQL database?
NoSQL is a non-relational DBMS, that does not require a fixed schema, avoids joins, and is easy to scale. The purpose of using a NoSQL database is for distributed data stores with humongous data storage needs. NoSQL is used for Big data and real-time web apps. For example, companies like Twitter, Facebook, Google collect terabytes of user data every single day.
What is NoSQL?
When people use the term “NoSQL database”, they typically use it to refer to any non-relational database. Some say the term “NoSQL” stands for “non SQL” while others say it stands for “not only SQL.” Either way, most agree that NoSQL databases are databases that store data in a format other than relational tables. If you want to find out more about NoSQL databases, our programming experts are always eager to share their knowledge with you.
The popularity of NoSQL has been driven by the following reasons:
- The pace of development with NoSQL databases can be much faster than with a SQL database.
- The structure of many different forms of data is more easily handled and evolved with a NoSQL database.
- The amount of data in many applications cannot be served affordably by a SQL database.
- The scale of traffic and need for zero downtime cannot be handled by SQL.
- New application paradigms can be more easily supported.
NoSQL databases deliver these benefits in different ways.
Before going into the different NoSQL databases, let’s look at relational databases so you have something to compare them to. In data modelling, many approaches are possible. Relational databases generally strive toward normalization: making sure every piece of data is stored only once. Normalization marks their structural setup. If, for instance, you want to store data about a person and their hobbies, you can do so with two tables: one about the person and one about their hobbies. As you can see in figure 1, an additional table is necessary to link hobbies to persons because of their many-to-many relationship: a person can have multiple hobbies and a hobby can have many persons practicing it.
Figure 1 Relational databases strive toward normalization (making sure every piece of data is stored only once). Each table has unique identifiers (primary keys) that are used to model the relation between the entities (tables), hence the term relational.
Features of NoSQL
Unlike relational databases, where data is stored in relations, different big data analytics solutions and data models in NoSQL databases make them flexible to manage data. Each data model is designed for specific requirements.
Examples of data models include document, graph, wide-column, and key-value.
The concept is to allow multiple data models in a single database. By doing so, the need for deploying and managing different databases for the same data cancels out.
NoSQL databases use the shared-nothing architecture, implying that the database has no single control unit or storage. The advantage of using a distributed database is that data is continuously available because data remains distributed between multiple copies. On the contrary, Relational Databases use a centralized application that depends on the location.
3. Flexible Schema
Unlike relational databases where data is organized in a fixed schema, NoSQL databases are quite flexible while managing data. While relational databases were built typically to manage structured data, NoSQL databases can process structured, semi-structured or unstructured data with the same ease, thereby increasing performance.
4. Eliminated Downtime
One of the essential features is the eliminated downtime. Since the data is maintained at various nodes owing to its architecture, the failure of one node will not affect the entire system.
5. High Scalability
One of the reasons for preferring NoSQL databases over relational databases is their high scalability. Since the data is clustered onto a single node in a relational database, scaling up poses a considerable problem. On the other hand, NoSQL databases use horizontal scaling, and thus the data remains accessible even when one or more nodes go down.
Types of NoSQL Databases
NoSQL databases use a different approach. Based on a data model there are a few types of databases in the NoSQL world. Here are the five main types of NoSQL databases:
- Key-value stores
- Column-oriented databases
- Document databases
- Graph databases
- Multi-Model Databases
MongoDB, CouchDB, CouchBase , Amazon SimpleDB, Riak, Lotus Notes are Document-oriented NoSQL databases.
Tokyo Cabinet/Tyrant, Redis, Riak, Voldemort, Oracle BDB, Amazon SimpleDB are Key-value stores Databases.
Cassandra, HBase and Hypertable are Column family stores Databases.
Neo4J, InfoGrid, Infinite Graph, OrientDB, FlockDB are Graph databases. Lets discuss these types of databases in detail.
1. Key-Values Stores
The main idea here is using a hash table where there is a unique key and a pointer to a particular item of data. The Key/Value model is the simplest and easiest to implement. But it is inefficient when you are only interested in querying or updating part of a value, among other disadvantages.
Key-value pair storage databases store data as a hash table where each key is unique, and the value can be a JSON, BLOB(Binary Large Objects), string, etc.
Key-value stores store everything as a key and a value.
The value in a key-value store can be anything: a string, a number, but also an entirely new set of key-value pairs encapsulated in an object. Figure 6 shows a slightly more complex key-value structure.
Examples: Tokyo Cabinet/Tyrant, Redis, Voldemort, Oracle BDB, Amazon SimpleDB, Riak
Key-value nested structure.
2. Column Family Stores
These were created to store and process very large amounts of data distributed over many machines. There are still keys but they point to multiple columns. The columns are arranged by column family.
They deliver high performance on aggregation queries like SUM, COUNT, AVG, MIN, etc. as the data is readily available in a column.
Column-based NoSQL databases are widely used to manage data warehouses, business intelligence, CRM, Library card catalogs.
Examples: Cassandra, HBase, Hypertable
3. Document Databases
These were inspired by Lotus Notes and are similar to key-value stores. The model is basically versioned documents that are collections of other key-value collections. The semi-structured documents are stored in formats like JSON. Document databases are essentially the next level of Key/value, allowing nested values associated with each key. Document databases support querying more efficiently.
Newspapers or magazines, for example, contain articles. To store these in a relational database, you need to chop them up first: the article text goes in one table, the author and all the information about the author in another, and comments on the article when published on a website go in yet another. As shown below, a newspaper article can also be stored as a single entity; this lowers the cognitive burden of working with the data for those used to seeing articles all the time.
Examples: CouchDB, MongoDb, Amazon SimpleDB, Riak, Lotus Notes
4. Graph Databases
Instead of tables of rows and columns and the rigid structure of SQL, a flexible graph model is used which, again, can scale across multiple machines. NoSQL databases do not provide a high-level declarative query language like SQL to avoid overtime in processing. Rather, querying these databases is data-model specific. Many of the NoSQL platforms allow for RESTful interfaces to the data, while other offer query APIs.
Compared to a relational database where tables are loosely connected, a Graph database is a multi-relational in nature. Traversing relationships as fast as they are already captured into the DB, and there is no need to calculate them.
Graph base databases mostly used for social networks, logistics, spatial data.
Node—: The entities themselves. In a social network this could be people.
Edge: The relationship between two entities. This relationship is represented by a line and has its own properties. An edge can have a direction, for example, if the arrow indicates who is whose boss.
Graphs can become incredibly complex given enough relation and entity types. Graph databases like Neo4j also claim to uphold ACID, whereas document stores and key-value stores adhere to BASE.
5. Multi-Model Databases
Multi-model databases are designed to handle multiple data models against a single integrated backend. They are a brand-new in the NoSQL world, and there will be much more buzz around this type of database in the future.
OrientDB, for example, is a multi-model database, combining NoSQL types. OrientDB is graph database where each node is a document.
The possibilities are endless, and because the world is becoming increasingly interconnected, graph databases are likely to win terrain over the other types, including the still-dominant relational database. A ranking of the most popular databases and how they’re progressing can be found at http://db-engines.com/en/ranking.
Figure – Top 20 databases ranked by popularity according to DB-Engines.com in May 2023.
Originally published February 24, 2014 4:55 am, updated on May 29 2023 for relevance and comprehensiveness.
Subscribe to our Newsletter
Get The Free Collection of 60+ Big Data & Data Science Cheat Sheets. Stay up-to-date with the latest Big Data news.