← thecodex.expert · The Codex Family of Knowledge
Databases

PostgreSQL

The world's most advanced open-source relational database. Structured data, real relations, rock-solid.

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.

What is PostgreSQL Coming soon

History, origin (POSTGRES project at Berkeley, 1986), and where it sits today.

Guide in progress
Installing PostgreSQL Coming soon

Local install via package manager, or a single Docker command.

Guide in progress
Data Types in PostgreSQL Coming soon

Beyond the SQL standard: arrays, JSONB, ranges, and more.

Guide in progress
Tables and Schemas Coming soon

Organizing structured data with strict typing and constraints.

Guide in progress
Indexes in PostgreSQL Coming soon

B-tree, GIN, GiST, and BRIN — picking the right index type.

Guide in progress
Querying with SQL Coming soon

SELECT, WHERE, ORDER BY, and PostgreSQL's SQL dialect quirks.

Guide in progress
Joins and Relations Coming soon

INNER, LEFT, and how foreign keys enforce referential integrity.

Guide in progress
Transactions and ACID Coming soon

How PostgreSQL guarantees atomicity, consistency, isolation, durability.

Guide in progress
JSON and JSONB Coming soon

Storing and querying semi-structured data inside a relational database.

Guide in progress
Full-Text Search Coming soon

Built-in text search without a separate search engine.

Guide in progress
Views and Materialized Views Coming soon

Saved queries vs. pre-computed, cached results.

Guide in progress
Performance Tuning Coming soon

EXPLAIN ANALYZE, connection pooling, and common bottlenecks.

Guide in progress
Backup and Replication Coming soon

pg_dump, WAL-based replication, and point-in-time recovery.

Guide in progress
Connecting from Application Code Coming soon

Drivers and ORMs: psycopg, pg, Prisma, SQLAlchemy.

Guide in progress