Get things done, without drama.

boringSQL is practical PostgreSQL and SQL writing: byte-level internals, reproducible experiments, and the production edge cases that documentation glosses over.

No hype, no framework churn. Just 8KB pages, execution plans, interactive visualizers, and open-source tools for keeping your database boring.

Want to stay in the loop? Subscribe to the newsletter.

Your biggest tenant runs someone else's plan

A prepared query on a skewed multi-tenant table gets planned for the small tenants, and the EXPLAIN you run by hand shows you a different plan.

11 min

B-tree pages, sorted and sparse

Why a PostgreSQL B-tree index stays the same size after VACUUM, shown page by page with pageinspect: leaves, high keys, and which new keys can reuse the free space.

11 min

Getting rid of a 4 TB table in PostgreSQL

Dropping a large table writes 80 KB of WAL, then stalls replay on every replica while the files are unlinked: 16 s for a cold 1 TB table on ext4, 80 ms on XFS. Plus what batched deletes and copy-and-swap cost when the table still has traffic.

20 min

How TABLESAMPLE picks rows

TABLESAMPLE picks addresses, not rows: SYSTEM samples come in bundles, BERNOULLI with REPEATABLE drifts after an UPDATE, and a hashed key gives you the same rows tomorrow.

9 min

Postgres relation files, filed under base/

The files behind a PostgreSQL table: relfilenode versus OID, the fsm, vm, and init forks, 1GB segments, and what od on the file shows that pageinspect on the buffer doesn't.

9 min

What REPACK (CONCURRENTLY) costs while it runs

PostgreSQL 19 comes with online table rewrites. Measured against pg_repack and pg_squeeze REPACK (CONCURRENTLY) is the fastest and the lightest on WAL under writes. Here's what it does to vacuum, readers, writers and old snapshots while it runs, and what to check before you start it.

15 min

Where PostgreSQL stores row locks

What SELECT FOR UPDATE, FOR SHARE, and a foreign key check actually write into the tuple header. t_xmax as a locker, the infomask bits that say so, MultiXactIds when two sessions lock the same row, and the pg_multixact files that grow behind them.

10 min

The unbearable lightness of one more index

Thirty PostgreSQL schemas written by coding agents, loaded and measured. The indexes are competent; the cumulative cost is not.

16 min

Read your own writes, off the primary

WAIT FOR in PostgreSQL 19 lets a reader block until the replica has replayed a specific LSN. Measured against sticky routing, sleeps, and synchronous commit, on a replica that misses the write 99% of the time.

15 min

The curious case of Google's AlloyDB

AlloyDB offers Postgres wire compatibility with a divergent storage engine. A deep-dive review into HTAP claims, ScaNN limits, adaptive autovacuum, and costs

35 min