PostgreSQL: A Complete Guide
PostgreSQL

What is PostgreSQL?

The world's most advanced open-source relational database

5-min readLast verified Jul 2026

PostgreSQL in 60 seconds

WHAT IT IS

A free, open-source relational database with deep SQL support, native JSON, and hundreds of extensions.

WHY IT'S USED

The default backend behind most new SaaS apps thanks to its depth, ACID guarantees, and mature ecosystem.

STRENGTHS
  • +Solid ACID transactions and MVCC so writers never block readers
  • +Native JSON via jsonb, so you don't need a separate document store
  • +Extension ecosystem: pgvector, PostGIS, TimescaleDB, and hundreds more
LIMITATIONS
  • Not natively distributed, so it scales vertically before horizontally
  • Vacuum tuning and replication setup have real learning curves
  • Connection-per-process model needs a pooler (PgBouncer) in production
BEST KNOWN FOR
SaaS backendsE-commerce and financial systemsGeospatial applicationsVector similarity searchAnalytics with mixed relational and JSON data
Jump to at a glance, how it works, or quick start for the full picture on PostgreSQL.

At a glance

CategoryRelational
PronunciationPronounced "post-gres-Q-L" (four syllables). Commonly shortened to "Postgres" in conversation.
First released1996
Latest release18.4 (May 2026)
LicensePostgreSQL License
Written inC
Runs onLinux, Macos, Windows, Bsd
DeploymentSelf-hosted, Managed
Wire protocolpostgresql
Query dialectsql, plpgsql
Consistencystrong
ACID supportnative
JSON supportnative
Full-text searchnative
Vector supportextension
HA modelprimary-standby
Managed byamazon-rds, google-cloud-sql, azure-database, neon, supabase, crunchy-bridge, aiven, tembo, timescale

What is PostgreSQL?

PostgreSQL, or Postgres for short, is a free open-source relational database. It stores data in tables, speaks SQL, and enforces ACID on transactions. What sets it apart from other relational databases is depth. It supports JSON as a native data type, geographic queries through the PostGIS extension, full-text search, and vector similarity search through pgvector. One engine covers workloads that used to need a stack of specialized ones.

It started as a research project at UC Berkeley in 1986, became Postgres95 in 1995, then took the PostgreSQL name in 1996 when SQL support landed. Today the PostgreSQL Global Development Group runs the project. No owning company, no VC-backed vendor calling the shots. That model is a big reason Postgres has stayed reliably open source for four decades while other databases like MongoDB, Redis, and Elasticsearch have moved to more restrictive licenses.

Postgres today runs everything from small embedded workloads to petabyte-scale analytics. Instagram, Reddit, Skype, Notion, and Spotify all run it in production. Managed services like AWS RDS, Google Cloud SQL, Supabase, and Neon have made it the default database for most new applications. By community adoption, it is the fastest-growing traditional database.

How PostgreSQL works

PostgreSQL is a client-server database. A single postmaster process listens on a TCP port (default 5432) and forks a dedicated backend for each incoming connection. Every backend handles one client at a time, which is why a connection pooler like PgBouncer or pgcat is essential in production. Thousands of short-lived connections would otherwise spawn thousands of processes.

Each SQL query goes through parse, rewrite, plan, and execute. The cost-based planner uses table statistics, index availability, and expected row counts to pick the cheapest access path. You inspect its decisions with EXPLAIN and EXPLAIN ANALYZE, which is where most performance work starts.

Data lives in heap tables, which are unordered files of row-versioned tuples for MVCC. Writes go to the Write-Ahead Log first for durability, then to the heap pages. The WAL also doubles as the replication stream, so physical replicas apply the same WAL records the primary writes. Background processes handle checkpointing, autovacuum, the writer, the wal-writer, and the stats collector. Extensions plug in through hooks. pgvector adds an HNSW index type, PostGIS adds new data types and operators, and TimescaleDB reshapes the planner for time-series workloads.

Key concepts

Tables, rows, and schemas

Postgres organizes data into tables of rows and columns, grouped into schemas that act as namespaces. Every table has a strict column definition and types are enforced at write time. Schemas let you group related tables and control permissions at the group level, which is useful for multi-tenant setups.

ACID transactions

Every operation runs inside a transaction, and multi-statement transactions are ACID: atomic (all or nothing), consistent (constraints always hold), isolated (concurrent transactions don't interfere), and durable (committed data survives crashes). Isolation ranges from Read Committed to Serializable.

MVCC and vacuum

Postgres uses Multi-Version Concurrency Control: writes don't block reads and vice versa, and each transaction sees a consistent snapshot. The tradeoff is that old row versions accumulate and have to be cleaned up by VACUUM. In practice you let autovacuum handle this in the background without much intervention.

JSONB and JSON

Postgres has two JSON column types. json stores raw text, jsonb parses and stores in a binary format. Use jsonb in most cases. It supports GIN indexing for fast key and value lookups, operators like @> for contains and -> for get key, and often beats dedicated document stores at moderate scale.

Indexes and extensions

B-tree is the default index, but Postgres also ships GIN for arrays and JSONB, GiST for geometric and range types, BRIN for very large sorted tables, and Hash. The extension world is where it really opens up: pgvector for vector search, PostGIS for geospatial, TimescaleDB for time-series, pg_stat_statements for query profiling.

Replication and WAL

The Write-Ahead Log records every change before it hits disk. Physical replication ships raw WAL records to standby servers for byte-identical replicas. Logical replication sends row-level changes to subscribers, useful for cross-version upgrades. Streaming replication with a hot standby is the standard HA setup.

PostgreSQL by the numbers

Live GitHub adoption — updated daily

#4 of 33 open-source relational databases by GitHub stars
GitHub stars
21.5k
+300 in 30d
Forks
5.8k
Weekly growth
+77
stars in the last 7 days
Last commit
13d ago
Jul 2026

Who uses PostgreSQL

A handful of the companies running it in production

RedditInstagramNotionAirtableSkypeSpotify

When to use PostgreSQL

Best for

Transactional applications with relational data

Payments, orders, and user accounts, anywhere a single row must never desync. Decades of ACID tooling make Postgres the default when correctness beats raw throughput.

Complex analytical queries on operational data

Window functions, CTEs, lateral joins, and materialized views. The Postgres planner handles multi-join analytical workloads that trip up simpler engines like MySQL and MariaDB.

Mixed relational and JSON data

jsonb columns give you MongoDB-style flexibility inside a relational schema. You can join documents to tables, index nested keys, and query both together in a single round trip.

Geospatial and vector workloads

PostGIS is the default for spatial SQL, and pgvector puts similarity search right next to your existing data. Both behave like any other Postgres feature, indexed and queryable.

Not ideal for

Sub-millisecond key-value caching

Postgres runs one backend process per connection and hits disk before serving reads. That costs you microseconds where Redis and Memcached cost you nanoseconds on the same box.

Append-heavy time-series at massive volume

ClickHouse and dedicated time-series engines like InfluxDB and VictoriaMetrics ingest billions of rows a day faster than Postgres. TimescaleDB narrows the gap but not fully.

Global multi-region writes at scale

Vanilla Postgres scales up before it scales out. For horizontal writes across regions, look at CockroachDB, YugabyteDB, or TiDB, all Postgres wire-compatible so most drivers work.

Embedded or edge deployment

Postgres runs as a persistent server process. For embedded workloads like edge apps or offline-first clients, SQLite and DuckDB are simpler and start cold much faster.

PostgreSQL vs alternatives

Head-to-head specs against the top 5 alternatives

PostgreSQL vs MySQL
PostgreSQL
MySQL
Identity
License
PostgreSQL License
GPLv2
First released
1996
1995
Wire protocol
postgresql
mysql
Query dialect
sql, plpgsql
sql
Capabilities
ACID
Native
Native
Consistency
Strong
Strong
JSON
Native
Native
Vector
Extension
Native
Full-text
Native
Native
HA model
Primary-standby
Multi-master
Ecosystem
Managed providers
9
8
ORM support
10
8
Extensions
10
4
Use cases
Best for
General-purpose OLTP, complex queries with advanced SQL, geospatial data with PostGIS, and applications requiring strong ACID compliance
Web applications, SaaS platforms, and high-throughput OLTP workloads
Not ideal for
Extreme write-heavy workloads at massive horizontal scale, simple key-value caching, or real-time streaming without extensions
Complex analytical queries or workloads requiring advanced SQL features like CTEs with recursive optimization
PostgreSQL vs SQLite
PostgreSQL
SQLite
Identity
License
PostgreSQL License
Public Domain
First released
1996
2000
Wire protocol
postgresql
Query dialect
sql, plpgsql
sql
Capabilities
ACID
Native
Native
Consistency
Strong
Strong
JSON
Native
Native
Vector
Extension
Extension
Full-text
Native
Native
HA model
Primary-standby
None
Ecosystem
Managed providers
9
2
ORM support
10
8
Extensions
10
5
Use cases
Best for
General-purpose OLTP, complex queries with advanced SQL, geospatial data with PostGIS, and applications requiring strong ACID compliance
Embedded applications, mobile apps, local data storage, edge computing, and prototyping
Not ideal for
Extreme write-heavy workloads at massive horizontal scale, simple key-value caching, or real-time streaming without extensions
High-concurrency write-heavy workloads, multi-user client-server applications
PostgreSQL vs SQL Server
PostgreSQL
SQL Server
Identity
License
PostgreSQL License
Microsoft Commercial License
First released
1996
1989
Wire protocol
postgresql
tds
Query dialect
sql, plpgsql
sql, t-sql
Capabilities
ACID
Native
Native
Consistency
Strong
Strong
JSON
Native
Native
Vector
Extension
Native
Full-text
Native
Native
HA model
Primary-standby
Primary-standby
Ecosystem
Managed providers
9
3
ORM support
10
7
Extensions
10
6
Use cases
Best for
General-purpose OLTP, complex queries with advanced SQL, geospatial data with PostGIS, and applications requiring strong ACID compliance
Enterprise .NET applications, business intelligence, and Windows-centric data platforms
Not ideal for
Extreme write-heavy workloads at massive horizontal scale, simple key-value caching, or real-time streaming without extensions
Cost-sensitive projects or teams without Windows/Azure ecosystem investment
PostgreSQL vs MongoDB
PostgreSQL
MongoDB
Identity
License
PostgreSQL License
SSPL
First released
1996
2009
Wire protocol
postgresql
mongodb
Query dialect
sql, plpgsql
mql
Capabilities
ACID
Native
Native
Consistency
Strong
Tunable
JSON
Native
Native
Vector
Extension
Native
Full-text
Native
Native
HA model
Primary-standby
Raft
Ecosystem
Managed providers
9
1
ORM support
10
6
Extensions
10
Use cases
Best for
General-purpose OLTP, complex queries with advanced SQL, geospatial data with PostGIS, and applications requiring strong ACID compliance
Flexible-schema applications, content management, real-time analytics, and mobile/IoT backends
Not ideal for
Extreme write-heavy workloads at massive horizontal scale, simple key-value caching, or real-time streaming without extensions
Highly relational data with complex joins or strict referential integrity requirements
PostgreSQL vs Oracle
PostgreSQL
Oracle
Identity
License
PostgreSQL License
Oracle Commercial License
First released
1996
1979
Wire protocol
postgresql
oracle-net
Query dialect
sql, plpgsql
sql, pl/sql
Capabilities
ACID
Native
Native
Consistency
Strong
Strong
JSON
Native
Native
Vector
Extension
Native
Full-text
Native
Native
HA model
Primary-standby
Multi-master
Ecosystem
Managed providers
9
2
ORM support
10
5
Extensions
10
5
Use cases
Best for
General-purpose OLTP, complex queries with advanced SQL, geospatial data with PostGIS, and applications requiring strong ACID compliance
Mission-critical enterprise OLTP/OLAP workloads requiring maximum availability and scalability
Not ideal for
Extreme write-heavy workloads at massive horizontal scale, simple key-value caching, or real-time streaming without extensions
Small projects or startups due to high licensing costs and operational complexity

Quick start

Install Postgres locally, connect with psql, and run a first query. Under a minute if you have Docker.

Install with Docker (fastest)
docker run --name postgres -e POSTGRES_PASSWORD=secret -p 5432:5432 -d postgres:17
Or install natively
# macOS
brew install postgresql@17 && brew services start postgresql@17

# Ubuntu/Debian
sudo apt install postgresql-17 && sudo systemctl start postgresql
Connect with psql
psql postgresql://postgres:secret@localhost:5432/postgres
Create a table and insert a row
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email TEXT UNIQUE NOT NULL,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

INSERT INTO users (email) VALUES ('[email protected]');

SELECT * FROM users;

That is a working install. Connect from any language with the standard drivers, or reach for a GUI when you want to browse tables and run queries visually.

Frequently asked questions

What is PostgreSQL used for?
PostgreSQL is a general-purpose relational database used for anything from web apps and SaaS backends to data warehousing and geographic information systems. It powers big pieces of the modern web (Instagram, Reddit, Skype, Notion, Airtable) and is increasingly common as the storage layer for AI apps thanks to pgvector for embeddings. Its ACID guarantees, JSON support, and extension ecosystem often let one Postgres cluster replace three or four specialized systems in projects that don't need extreme scale in a single dimension.
Is PostgreSQL a SQL or NoSQL database?
PostgreSQL is a relational SQL database, but it supports many NoSQL-style patterns natively. You can store JSON documents (jsonb type), arrays, key-value data (via the hstore extension), and vector embeddings (via pgvector), all queryable alongside relational tables in a single query. This blurs the SQL vs NoSQL line. Teams that would have picked MongoDB or DynamoDB for schema flexibility a decade ago often pick Postgres with jsonb columns today.
Is PostgreSQL free?
Yes. PostgreSQL is open-source software under the permissive PostgreSQL License (a variant of the MIT/BSD family) and is free to use, modify, distribute, and run commercially. There are no license fees and no restrictions on production use. Managed cloud versions (AWS RDS, Google Cloud SQL, Azure Postgres, Supabase, Neon) charge for hosting infrastructure, but the database itself is still free. You can always self-host or move between providers.
Who owns and maintains PostgreSQL?
No single company owns PostgreSQL. It is maintained by the PostgreSQL Global Development Group (PGDG), a distributed collective of individual contributors and sponsoring companies (EnterpriseDB, Crunchy Data, Cybertec, and others). No owning entity, MIT-style license, distributed maintainers. That structure is a big part of why the project has stayed reliably open source for four decades while other databases like MongoDB, Elasticsearch, and Redis have moved to more restrictive licenses.
Is Postgres the same as PostgreSQL?
Yes. "Postgres" is the informal short name, and also the original name of the project when it was created at UC Berkeley in 1986. "PostgreSQL" is the official name adopted in 1996 to reflect the addition of SQL support. Most engineers say "Postgres" in conversation and "PostgreSQL" in formal documentation. Both refer to the exact same open-source relational database.

Skip the config files

Connect to PostgreSQL in 30 seconds. Browse tables, run queries, and edit rows visually — on localhost, self-hosted, or cloud.

Open PostgreSQL in 1bench