HOWTO · PostgreSQL

PostgreSQL Is Not a NoSQL Database

This article will teach the reader the different types of databases such as NoSQL and which type of database PostgreSQL belongs to.

Every database comes from a different class of database management systems. There are several types of database management systems, and these are the following:

  1. Relational database
  2. Object oriented database
  3. Hierarchical database
  4. Network database
  5. NoSQL databases

This tutorial will focus on relational databases, hierarchical databases, and NoSQL databases. We will cover the databases used in each DBMS and how they differ.

Relational Database

A relational database uses tables to capture data in records, and these tables have relationships that are constrained using primary keys and foreign keys.

The image below shows a relational database table divided into rows and columns. The columns represent the fields, and the rows represent the records.

Relational Database Table

Relational databases include:

  1. MariaDB
  2. SqLite
  3. MySQL
  4. PostgreSQL

Hierarchical Database

A hierarchical database stores the data as records. These records are organized into a tree-like or parent-child structure, with the parent having many children nodes connected through links.

The image below shows how hierarchical data is organized.

Hierarchical Data Image

The hierarchical databases include:

  1. The IBM information management system (IMS)
  2. RDM Mobile

NoSQL Database

NoSQL databases are used in distributed systems to store huge amounts of data. These databases are used in real-time applications and Big data.

These databases are best suited to store hierarchical data, and they store data in formats such as JSON, XML, and YAML.

The NoSQL database data store types include key-value store, document store, column store, and graph-based.

The following image shows how the key-value store is used to store data in NoSQL databases.

Key Value Data Store Image

The NoSQL databases include:

  1. MongoDB
  2. Redis

PostgreSQL Is Not a NoSQL Database

PostgreSQL is a relational database that can execute queries using JSON, a format used by the NoSQL database as mentioned above.

The JSON format is the most common method used to interact with semi-structured data, and a developer might infer that PostgreSQL is a NoSQL database due to this reason, but that is not the case.

Note that even if you use the JSON format while working with PostgreSQL, the data is recorded in tables that have relationships.

The following image shows JSON data structure, which can be used with databases that support JSON such as PostgreSQL and NoSQL databases such as MongoDB.

JSON Structure