Postgres is the most under-appreciated superpower in a modern stack. This page is what we actually do when we're brought in to make one fast — read EXPLAIN, add the right index, pick the right extension, and leave it running for years.
Seq Scan on orders (cost=0.00..48291.00 rows=2)
Filter: (customer_id = 42)
Rows Removed by Filter: 998,342
Buffers: shared read=4123
Planning Time: 0.2 ms
Execution Time: 812 msIndex Scan using orders_customer_id_idx
Index Cond: (customer_id = 42)
Buffers: shared hit=6
Planning Time: 0.1 ms
Execution Time: 1.2 msThe default. Equality, range, ORDER BY.
Equality only, smaller than B-tree, rarely worth it.
JSONB, arrays, full-text search. The workhorse of tsvector.
Geometric data, ranges, tsvector. PostGIS lives here.
Massive append-only tables with natural ordering (time-series).
`WHERE deleted_at IS NULL` — index only live rows. Smaller, faster.
Two queries answer 90% of it: `pg_stat_user_indexes` (which indexes are used) and `pg_stat_user_tables` (which tables are seq-scanning). If a table has millions of rows and `seq_scan > idx_scan`, you have a problem.
Tell us your goals — we'll recommend the right technology honestly, even if it isn't this one.