SQL
SQL is a declarative language, which means the database decides how to run your query. These posts are about reading query plans, building the right indexes, understanding when the optimizer is lying to you, and the column-ordering and NULL rules that change behavior.
The Composite Index Nobody Can Read
Your composite index covers every column but EXPLAIN still shows a full scan. Column order, not column presence, determines whether PostgreSQL uses the index.
Read more BackendThe NULL Trap
NULL is a three-valued logic system that corrupts aggregations, breaks NOT IN subqueries, and hides rows from WHERE clauses. It is not just a missing value.
Read more BackendEXPLAIN ANALYZE Lies to You
PostgreSQL's EXPLAIN ANALYZE tells you the plan looks fast. It doesn't tell you the timing is cached, the estimates are stale, or the cost isn't milliseconds.
Read more BackendDatabase Indexes Explained for People Who Keep Forgetting
You've read about database indexes before. You've forgotten most of it. Here's the practical guide you'll actually remember, with PostgreSQL examples.
Read more DatabasePostgreSQL JSONB Deep Dive: Operators, Indexes, and the Tradeoffs Nobody Told You About
JSONB operators, GIN vs expression indexes, and the cost of JSONB over typed columns - all proved with EXPLAIN ANALYZE on 200k Postgres rows. Tests in the repo.
Read more DatabaseDatabase Indexes Explained: A PostgreSQL Walkthrough With EXPLAIN ANALYZE
B-tree, composite, partial indexes proved with EXPLAIN ANALYZE on 500k Postgres rows. Plus the three ways EXPLAIN ANALYZE lies to you. Tests in the repo.
Read more