~/topics/postgres

postgres

everything written here about postgres — a lost-update race that ate 79% of every vote, two-axis state machines with check constraints, and auditing a side project like it was about to go viral

postgres is the default. every product i have built stores its state here, and almost everything i have learned the hard way about concurrency, i learned from it.

what does this blog cover about postgres?

concurrency bugs first. the textbook lost update — a read-modify-write vote handler that silently discarded 79% of every rating change under load, which is the kind of number that only shows up if you go looking. read committed does not mean what people assume it means, and that post is the proof.

then data modelling: encoding “may we publish this” and “how faithful is this text” as two orthogonal columns rather than one overloaded status enum, with check constraints as the structural backstop rather than a comment in the code.

and performance under a load that has not arrived yet — seeding a fake gone-viral database, running EXPLAIN ANALYZE over the hot paths, and finding the public stats page that was a denial-of-service i was hosting myself.

the queries themselves live on the go side — sqlc + pgx over an orm — and the isolation boundary is covered under security .