What is PostgreSQL?
PostgreSQL (often just "Postgres") is a powerful, open-source relational database. It stores data in tables with rows and columns, and lets you define strict relationships between them — so your data stays consistent and correct. It has been refined for over 30 years and is trusted by everyone from startups to banks.
When should you use it?
Reach for PostgreSQL when your data has structure and relationships — users who have orders, orders that have items. When you need your data to be reliable and correct above all (it never silently loses or corrupts data), and when you might need advanced features later (full-text search, JSON columns, geographic data). It is the default sensible choice for most serious applications.
How to set it up
Install locally with your package manager (brew install postgresql on Mac, apt install postgresql on Linux), or run it in Docker with one command: docker run -e POSTGRES_PASSWORD=secret -p 5432:5432 postgres. For production, a managed service like AWS RDS or Supabase runs it for you.
How it connects to your code
From Python, connect with the psycopg library. From Node.js, use pg. You write SQL queries (SELECT * FROM users WHERE age > 18) and the database returns rows. An ORM like SQLAlchemy or Prisma can write the SQL for you.
PostgreSQL Reference Topics 14 planned
These are the topics planned for this reference. They are not written yet — the list is published so you can see what is coming. Everything already complete on this site is linked from the Languages section.
History, origin (POSTGRES project at Berkeley, 1986), and where it sits today.
Guide in progressLocal install via package manager, or a single Docker command.
Guide in progressBeyond the SQL standard: arrays, JSONB, ranges, and more.
Guide in progressOrganizing structured data with strict typing and constraints.
Guide in progressB-tree, GIN, GiST, and BRIN — picking the right index type.
Guide in progressSELECT, WHERE, ORDER BY, and PostgreSQL's SQL dialect quirks.
Guide in progressINNER, LEFT, and how foreign keys enforce referential integrity.
Guide in progressHow PostgreSQL guarantees atomicity, consistency, isolation, durability.
Guide in progressStoring and querying semi-structured data inside a relational database.
Guide in progressBuilt-in text search without a separate search engine.
Guide in progressSaved queries vs. pre-computed, cached results.
Guide in progressEXPLAIN ANALYZE, connection pooling, and common bottlenecks.
Guide in progresspg_dump, WAL-based replication, and point-in-time recovery.
Guide in progressDrivers and ORMs: psycopg, pg, Prisma, SQLAlchemy.
Guide in progress