PostgreSQL
An open-source relational database with SQL, ACID transactions and rich types.
Joins, constraints, JSONB, full-text search and extensions such as pgvector make it a strong default.
Data & storage
SQL databases store related tables with a fixed schema, joins and strong transactions; NoSQL databases such as DynamoDB and Firestore store documents or key-value items modelled around access patterns and scale out easily, trading some relational power.
An open-source relational database with SQL, ACID transactions and rich types.
Joins, constraints, JSONB, full-text search and extensions such as pgvector make it a strong default.
Document and key-value stores such as Amazon DynamoDB and Google Firestore.
Flexible items, nested data and horizontal scaling; data modelled around the queries the app makes.
| Aspect | PostgreSQL | NoSQL databases |
|---|---|---|
| Data model | Tables and rows | Documents or key-value items |
| Schema | Defined up front | Flexible |
| Joins | Native, powerful | Rare; data is denormalised instead |
| Transactions | Full ACID | Supported, usually with limits |
| Best for | Relational data, reporting, money | Known access patterns at large scale |
SQL databases such as PostgreSQL store data in tables with a defined schema, relate tables with joins and enforce ACID transactions. NoSQL databases such as DynamoDB, Firestore and Couchbase store flexible documents or key-value items. They trade some relational features for flexible schemas and easier horizontal scaling.
Choose it when data is relational and integrity matters. Users, orders, payments, inventory and reporting are typical examples, where joins, constraints, transactions and complex queries are central. It is a strong default for most applications.
Choose one when access patterns are known and simple, such as fetching items by key. It also fits when you need very large scale with predictable latency, records vary in shape, or you want a fully managed serverless store. Firestore also suits mobile and web apps that need real-time sync and offline support.
PostgreSQL requires you to define tables and columns, and you change them through migrations. Document and key-value stores accept items of varying shape. DynamoDB only requires the key attributes. Production apps still enforce a schema, usually in application code or, in Firestore, with security rules.
PostgreSQL joins tables efficiently in one query. DynamoDB and Firestore have no server-side joins, so you embed related data, duplicate it or make several reads. Couchbase's SQL++ supports joins, but direct key lookups remain its fastest path.
PostgreSQL has full ACID transactions across any rows and tables. DynamoDB supports transactions of up to 100 items, at roughly double the capacity cost. Firestore and Couchbase support multi-document ACID transactions. In NoSQL designs, transactions are usually used sparingly, and single-item writes are preferred.
PostgreSQL usually scales vertically and with read replicas. Sharding is available through extensions or managed services. DynamoDB and Firestore spread data across partitions automatically. Couchbase scales by adding nodes and rebalancing data across them.
You list the queries the app needs first, then design keys and documents to answer each one in a single read. For example, you store an order with its line items, or give related items the same partition key. Data that is read together is stored together.
Its JSONB type stores JSON in a binary format with indexing and query operators. This lets relational and document-style data live in one database.
PostgreSQL offers B-tree, GIN, GiST, partial and expression indexes, and you can query almost anything. DynamoDB queries use the primary key or secondary indexes, and anything else needs a full scan. Firestore needs an index for every query and requires composite indexes for multi-field queries. Couchbase uses secondary indexes for SQL++ queries.
Practise every comparison in your dashboard.
Start learning