A general introduction on NoSQL paradigm
Pre-2000s: The Rise of Relational Databases
Late 1990s to Early 2000s: The Emergence of Web 2.0
1998: The term NoSQL Introduced
NoSQL
.2000s: The Birth of NoSQL
2009: The Term 'NoSQL' Gains Popularity
2010s: Rapid Growth and Adoption
Document Stores
Key-Value Stores
Column-Family Stores
name | id | dob | city | transaction_id | debit | credit | |
---|---|---|---|---|---|---|---|
John Doe | 12345 | john@coursebook.io | 20-01-1972 | Surabaya | tx12345 | 500 | |
John Doe | 12345 | john@coursebook.io | 20-01-1972 | Surabaya | tx12346 | 300 | |
Ryan Mikes | 23456 | ryan@coursebook.io | tx12347 | 1000 |
Graph Databases
multi-model databases
. To keep it simple, the term implies support of more than one type of NoSQL data model,
allowing developers to be more flexible in their development requirements.
These databases have a unified database engine that can handle multiple data models within a database instance. Examples are CosmosDB and ArangoDB.
CAP theorem
, which states that a distributed system can only guarantee two out of three properties:
Consistency, Availability, and Partition Tolerance. As a result, developers may need to make trade-offs between these properties based on their application’s requirements.
SQL Databases | NoSQL Databases | |
---|---|---|
Language | Structured Query Language (SQL). | Varies based on the type of NoSQL database used. |
Schema | Fixed schema, it will be difficult to change the schema once data is stored. | Flexible schema, each set of data can contain different types of data. Schema is easier to changed if required. |
Scalability | Vertically scalable. | Optimized for horizontal scaling. NoSQL were developed with the aim to solve challenges of big data. |
Properties | SQL Databases use the ACID (Atomicity, Consistency, Isolation, Durability) property. | NoSQL Databases use the CAP (Consistency, Availability, Partition Tolerance) property. |
JSON
and JSONB
(binary JSON) data types, enabling the storage of semi-structured data.
JSON stores data in text format, while JSONB stores it in a binary format that is optimized for efficient processing and querying.
hstore
is quite similar with JSON/JSONB, but is simpler. Keys and values in hstore must be text, and does not support nested structures or complex data types.
Depending on your data and specific use case, both options can be considered.
to_tsvector
here is used to parse and normalize a document string, hence the elements of a tsvector
are lexemes. Words like disputes
would be normalized to dispute
,
allowing for a more robust and powerful search.
XML
and Large Object Storage (LOBs)
. We can even use advanced indexing techniques to efficiently query data which are stored in JSONB format.
In conclusion, PostgreSQL is more than just a traditional relational database; it is a highly flexible platform capable of handling a wide range of unstructured and semi-structured data types.
This versatility makes PostgreSQL an ideal choice for modern applications that require both the reliability of an RDBMS and the flexibility to handle diverse data types. My take is: you can get a subset of
NoSQL in PostgreSQL, but you can’t get a subset of SQL relational features in NoSQL.