What is PostgreSQL?
PostgreSQL, often called Postgres, is a relational database known for reliability, strict standards support and powerful extensions such as PostGIS and pgvector. It powers everything from small web apps to large financial systems.
Developers use it as their main data store; database administrators and platform engineers keep it fast, backed up and highly available. This roadmap covers both views.
How to use this PostgreSQL roadmap
Developers can stop after step 4 and be very effective. Anyone aiming for DBA or platform roles should finish all six steps.
Run Postgres locally with Docker and load a real sample dataset. Practising on empty tables hides almost every performance lesson.
1Step 1: Install and query
Get Postgres running and write your first real queries.
What is it?
Start with installation, the psql shell and core SQL: SELECT, INSERT, UPDATE, DELETE, joins and aggregates.
What to learn
Get comfortable in psql. GUI tools are nice, but psql works on every server.
Learn each topic here
Installing Postgres
Use Docker, a package manager or a managed service. Learn the default port 5432 and the postgres superuser.
Why it matters: Every later step needs a running server.
psql basics
Connect, list tables with \dt, describe with \d and run scripts with \i.
Why it matters: Fast and always available.
Core SQL
Filtering, sorting, joins and GROUP BY with aggregates.
Why it matters: Most daily work is plain SQL.
Data types
integer, numeric, text, timestamp with time zone, boolean, uuid, jsonb and arrays.
Why it matters: The right type prevents bugs.
Sample datasets
Load a dataset such as the Pagila sample database to practise.
Why it matters: Realistic data, realistic problems.
Example
bash
docker run -d --name pg -e POSTGRES_PASSWORD=devpass -p 5432:5432 postgres:17
psql -h localhost -U postgres
\l
\dtStarting Postgres in Docker for local practice and opening psql.
Helpful resource: PostgreSQL tutorial (official)
2Step 2: Schema design
Model data so it stays correct as the app grows.
What is it?
Good schemas use normalisation, keys and constraints so bad data cannot get in.
What to learn
Push rules into the database with constraints. Application checks get skipped; constraints do not.
Learn each topic here
Normalisation
Split data into tables to avoid duplication, up to third normal form for most apps.
Why it matters: Fewer update errors.
Keys
Primary keys, foreign keys, natural versus surrogate keys and identity columns.
Why it matters: Relationships stay consistent.
Constraints
NOT NULL, UNIQUE, CHECK and exclusion constraints.
Why it matters: The database enforces your rules.
JSONB
Store flexible attributes with indexing support.
Why it matters: Mix relational and document styles.
Migrations
Version schema changes with tools like Flyway, Alembic or Prisma Migrate.
Why it matters: Teams change schemas safely.
Example
sql
CREATE TABLE orders (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
customer_id bigint NOT NULL REFERENCES customers(id),
total numeric(12,2) NOT NULL CHECK (total >= 0),
status text NOT NULL CHECK (status IN ('pending','paid','shipped')),
created_at timestamptz NOT NULL DEFAULT now()
);A table that refuses negative totals, unknown statuses and orphan orders.
Helpful resource: PostgreSQL data definition docs
3Step 3: Advanced SQL
Write queries that replace pages of application code.
What is it?
Window functions, CTEs, upserts and full-text search let you do heavy lifting inside the database.
What to learn
When you are about to loop over rows in code, check whether a window function can do it.
Learn each topic here
Window functions
ROW_NUMBER, RANK, LAG and running totals over partitions.
Why it matters: Reporting queries get simple.
CTEs and recursion
WITH clauses for readable steps and recursive queries for trees.
Why it matters: Hierarchies like categories or org charts.
Upserts
INSERT … ON CONFLICT to insert or update in one statement.
Why it matters: Safe syncing.
Full-text search
tsvector, tsquery and ranking.
Why it matters: Search without another system.
Functions and triggers
PL/pgSQL for logic that must run inside the database.
Why it matters: Use sparingly, but know how.
Example
sql
SELECT customer_id, created_at, total,
SUM(total) OVER (PARTITION BY customer_id ORDER BY created_at) AS running_total
FROM orders
WHERE status = 'paid';A running total per customer with one window function.
Helpful resource: Window functions tutorial
4Step 4: Indexes and query performance
Find out why a query is slow and fix it.
What is it?
EXPLAIN ANALYZE shows how Postgres runs a query. Indexes, statistics and query rewrites fix most slow queries.
What to learn
Read execution plans bottom-up and compare estimated rows to actual rows.
Learn each topic here
EXPLAIN ANALYZE
See scan types, join methods, row estimates and timing.
Why it matters: The main performance tool.
B-tree indexes
Default index type for equality and range queries, including multi-column order.
Why it matters: Most indexes you create.
Other index types
GIN for JSONB and full text, GiST for geometry, BRIN for huge time series.
Why it matters: The right index for the data.
Partial and covering indexes
Index only active rows, or include extra columns for index-only scans.
Why it matters: Smaller, faster indexes.
pg_stat_statements
Track the queries that use the most total time.
Why it matters: Fix what matters most.
Example
sql
EXPLAIN ANALYZE
SELECT * FROM orders WHERE customer_id = 42 AND status = 'paid';
CREATE INDEX CONCURRENTLY idx_orders_cust_status
ON orders (customer_id, status);Checking a plan and then adding a composite index without locking writes.
Helpful resource: Use The Index, Luke
5Step 5: Transactions, concurrency and operations
Keep data correct under load and keep the server healthy.
What is it?
MVCC, isolation levels, locks, vacuum and backups are what separate a developer from a database administrator.
What to learn
Test your backups by restoring them. An untested backup is a guess.
Learn each topic here
MVCC and isolation
Read committed, repeatable read and serializable, and what each prevents.
Why it matters: Avoid subtle data bugs.
Locks and deadlocks
Row and table locks, lock waits and how to read pg_locks.
Why it matters: Outages often start with a lock.
Vacuum and autovacuum
Clean up dead rows, prevent bloat and transaction ID wraparound.
Why it matters: Neglect slows everything.
Backups
pg_dump for logical backups, base backups and WAL archiving for point-in-time recovery.
Why it matters: Data loss ends companies.
Roles and security
Users, roles, grants, row-level security and pg_hba.conf.
Why it matters: Least privilege for data.
Example
bash
pg_dump -Fc -d shop -f shop_2026-11-13.dump
createdb shop_restore_test
pg_restore -d shop_restore_test shop_2026-11-13.dumpTaking a compressed backup and proving it restores.
Helpful resource: PostgreSQL backup and restore docs
6Step 6: High availability, scaling and extensions
Expert level: run Postgres for serious workloads.
What is it?
Replication, failover, connection pooling, partitioning and extensions let Postgres scale far further than most teams expect.
What to learn
Add a connection pooler before adding servers. Many "scaling" problems are too many connections.
Learn each topic here
Streaming replication
Primary and replicas, synchronous versus asynchronous.
Why it matters: Read scaling and standby servers.
Failover tooling
Patroni or managed services that promote a replica automatically.
Why it matters: Uptime during failures.
Connection pooling
PgBouncer to share a small number of server connections.
Why it matters: Postgres connections are expensive.
Partitioning
Split huge tables by range or list, often by date.
Why it matters: Faster queries and easy archiving.
Extensions
PostGIS for maps, pgvector for AI embeddings, TimescaleDB for time series.
Why it matters: Postgres becomes a multi-tool.
Example
sql
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE docs (id bigserial PRIMARY KEY, body text, embedding vector(1536));
CREATE INDEX ON docs USING hnsw (embedding vector_cosine_ops);
SELECT id, body FROM docs ORDER BY embedding <=> $1 LIMIT 5;Using pgvector for semantic search inside Postgres.
Helpful resource: Patroni documentation
PostgreSQL roadmap project ideas
Each project should include the schema, sample data and a short note on performance numbers before and after your changes.
SQL question bank
Answer 25 business questions on a sample database.
Booking schema
Constraints, keys and migrations for a booking app.
Reporting queries
Window-function reports replacing application code.
Performance tuning
Speed up slow queries on a million-row table.
Backup and PITR drill
WAL archiving and a timed point-in-time recovery.
HA cluster
Patroni, replicas, PgBouncer and a failover test.
Tips to finish this PostgreSQL roadmap
- Use real data volumes. Performance problems hide in small tables.
- Read the official docs. The PostgreSQL manual is one of the best in software.
- Keep a query journal. Save slow queries and their fixes; patterns repeat.
- Learn one managed service. Most jobs use RDS, Cloud SQL, Azure Database or similar.
Career paths and next steps
PostgreSQL skills support backend developer, data engineer, database administrator, database reliability engineer and platform engineer roles.
Next, learn a backend language deeply, or move into data engineering and cloud databases.
Related roadmaps
PostgreSQL Roadmap FAQs
Is PostgreSQL hard to learn?
Basic SQL takes a few weeks. Tuning and operations take months of practice.
PostgreSQL or MySQL, which should I learn?
Both are good. PostgreSQL has richer features and is increasingly the default for new projects.
Is PostgreSQL free?
Yes. It is open source under a permissive licence.
Can PostgreSQL be used for AI apps?
Yes. The pgvector extension stores embeddings and runs similarity search.