Stack Picker
a developer-grade decision engine
Back to the picker
Database

PostgreSQL

The gold-standard open-source relational database.

Official site
Monthly cost
Free
Free to self-host; hosting costs extra
Popularity
5/5
LLM knowledge
5/5
Difficulty
Medium
#open-source#self-hostable

What PostgreSQL is good at

Strengths
  • +Rock solid
  • +Rich feature set (JSON, FTS, vectors)
  • +Huge ecosystem
Tradeoffs
  • You manage scaling yourself
  • Backups and HA are on you

Coding-agent prompt

You're working with PostgreSQL. Follow these rules:

- Parameterized queries only — never string-interpolate user input into SQL.
- Index columns that appear in `WHERE`, `JOIN`, `ORDER BY`. Check `pg_stat_user_tables` to find missing indexes.
- Use `jsonb` (not `json`) for schemaless columns; index with `GIN`.
- Row-Level Security (`ALTER TABLE ... ENABLE ROW LEVEL SECURITY`) for multi-tenant isolation.
- Transactions with `BEGIN; ... COMMIT;` for any multi-statement mutation.
- Use `EXPLAIN ANALYZE` before shipping anything slow.
- Prefer `text` over `varchar(n)` unless you have a hard business constraint on length.

Beginner's guide to PostgreSQL

In one line: A powerful, free database where you store data in tables with rows and columns.

Postgres is a relational database — data lives in tables, like very strict spreadsheets. You query it with SQL (Structured Query Language): 'give me all users who signed up this week'. It's the gold-standard open-source database.

Think of Excel, but built for millions of rows and many users at once.

Try it in your terminal
  • brew install postgresql@16

    Install Postgres on macOS.

  • psql -d postgres

    Open the Postgres command-line shell.

Popular pairings with PostgreSQL

Browse all categories