Build1 distinct publisher3 min readPublished
A dev.to walkthrough rebuilds Postgres snapshot visibility in about 100 lines of TypeScript. The instructive part is the accounting: two stamps per version, and a table that only grows.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
The number the demo does not print is the write count. Session A's DELETE has to visit every one of the million rows to stamp `xmax` on the live version, and it removes none of them [1][5]. The table Session B scans therefore still holds a million versions after the delete, each now carrying a death certificate [1]. "No locks, no blocking, no errors" [2] describes the relationship between the reader and the writer. It does not describe the writer's bill.
Run the same experiment as an UPDATE and the arithmetic doubles. An update here is a delete and an insert stapled together, so the million old versions stay and a million new ones are appended [6][2]. That is also the cheapest way to confirm a real Postgres is doing this rather than mutating in place: `SELECT ctid` before and after an UPDATE, and the row's physical address has moved [6].
The model being displaced is the table as a big mutable array, where UPDATE overwrites a slot and DELETE frees one [13]. Under that model the demo is impossible, because Session B has nothing left to read [13], and the only way to make in-place mutation safe was locks: readers waiting on writers, writers waiting on readers, and one long report capable of freezing every write to the table [3].
The two stamps alone still are not enough, and the post is honest about where they break. Take the naive rule that a version is visible when `xmax` is null. Session A stamps `xmax = 2` across the table and has not committed, so Session B sees nothing; then A issues ROLLBACK, and B has read a state of the world that never existed [8]. So `xmax = 2` has to mean either "gone" or "never happened" depending on the fate of transaction 2, and nothing stored on the version says which [3]. Visibility is a property of the reader plus the writer's status, not of the row.
That is precisely where the text I was given stops, mid-sentence, at "The fix: a stamp on" [9]. What the post promises past that point is about 100 lines of TypeScript pointed at real Postgres, with the columns matching one to one [11]. I can report the promise; I cannot report the result.
What survives from the part that exists is a small vocabulary. A transaction is a number from an incrementing counter, so txids double as timestamps and ordering comes free: smaller means earlier [7]. Versions are appended, never overwritten, and a row is the whole history in order [5]. The post's claim is that this same accounting is how Postgres, MySQL/InnoDB, Oracle and SQLite in WAL mode keep readers and writers out of each other's way [10]. If that holds, the hundred lines are worth more than the psql session that motivated them, because the psql session only shows you the outcome.
Ranked by verification strength, evidence, and original report placement.
In the source's demo, Session A runs BEGIN then DELETE FROM users, deleting all 1 million rows, and does not commit; Session B's SELECT count(*) returns 1000000.
In the demo, neither session waits on the other: no locks, no blocking, no errors.
The only way to make in-place mutation safe is locks, with readers waiting for writers and writers for readers; databases worked this way for years and one long-running report could freeze every write to the table.
The post's founding decision for MVCC: nothing is ever updated and nothing is ever deleted; the database only ever appends, so a logical row is a chain of versions.
Every version is stamped with xmin (the transaction that created it) and xmax (the transaction that deleted it, null if none); DELETE only sets xmax on the live version, dead versions stay physically present, and a row is the full history of values, oldest first, with nothing removed or overwritten.
UPDATE is implemented as a DELETE plus an INSERT; running SELECT ctid in Postgres before and after an UPDATE shows the row's physical address change.
Follow any of these and your For You feed starts watching them — no settings page required.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
One explainer, but mechanics are self-verifiable
Every substantive assertion is either shown as code in the post or reproducible by the reader (two psql sessions, SELECT ctid before and after an UPDATE), and the mechanisms named map onto documented Postgres internals such as pg_xact/clog. What holds the score down is that the cluster has exactly one source with no independent corroboration, the excerpt is truncated before the final visibility rule, and the promised one-to-one comparison against real Postgres columns is never shown.
No adoption signal in supplied sources
The cluster contains no release, deployment, benchmark, usage disclosure, download count, or any other adoption datum for the tutorial or its 100-line toy implementation. The post's remark that Postgres, MySQL/InnoDB, Oracle and SQLite use MVCC is an unsourced background assertion about long-standing engine design, not measured adoption of anything in this story, and inferring uptake from it would be guesswork.
Modest claims, undelivered payoff
The framing is restrained for the genre: the headline promise is about 100 lines of TypeScript, the mechanics claimed are standard and checkable, and no performance or novelty superlatives appear. The small positive gap comes from promises the supplied text does not keep -- 'no hand-waving' and a one-to-one column match against real Postgres are advertised but absent from the truncated excerpt -- and from the sweeping engine list (Postgres, InnoDB, Oracle, SQLite in WAL mode) being asserted without qualification or citation.
Educational series post, no commercial stake evident
The piece is an installment in an author's teaching series on a community publishing platform ('As always in this series: no hand-waving'), explaining vendor-neutral internals shared by four competing engines. No product, employer, sponsor, pricing or funding interest is disclosed or implied anywhere in the source. The residual incentive is ordinary audience-building: a provocative headline and a serialized cliffhanger that ends mid-rule, which rewards engagement and return visits.
Confident on mechanics, thin on corroboration
Confidence is moderate: the technical content is stable, long-established and checkable by any reader with psql, so misstatement risk is low. But the assessment rests on a single publisher, a single truncated excerpt, zero adoption data, and a claim ledger whose description of where the text ends conflicts with the supplied body -- all of which cap how far conclusions can be pushed.
build
The NestJS default path puts the query inside the business rule, and nothing fails when it moves1 distinct publisher
build
OpenClaw makes the channel the architecture, and the reasoning loop a lodger1 distinct publisher
build
In Postgres an UPDATE is an insert, and your page space pays for it1 distinct publisher
build
isinstance(amount, (int, float)) is not a number check: NaN walks through a withdrawal guard1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 27, 2026