Brandur
brandur.org · Personal blog · on HN since 2013
Brandur Leach, a software engineer formerly at Stripe and Heroku, writes long technical articles on Postgres, APIs, and web architecture.
What HN saysCommenters repeatedly recommend it for deep dives on Postgres and idempotent APIs, and praise its design and original thinking.
187HN people shared it
84linked it in comments
232stories submitted
10Kstory points
3 months agolast shared
2013people per year2026
Most-shared posts
- 1Implementing Stripe-Like Idempotency Keys in Postgres12 people · 245 points · first shared 2017 · 41 comments on HN
- 2Identity Crisis: Sequence vs. UUID as Primary Key10 people · 34 points · first shared 2022 · discussion on HN
- 3Homepage9 people · first shared 2018
- 4logfmt (2013)8 people · 3 points · first shared 2016 · discussion on HN
- 5Articles8 people · first shared 2017
- 6Soft deletion probably isn't worth it7 people · 738 points · first shared 2022 · 494 comments on HN
- 7Postgres Job Queues and Failure by MVCC7 people · 174 points · first shared 2015 · 48 comments on HN
- 8Using Atomic Transactions to Power an Idempotent API7 people · 85 points · first shared 2017 · 8 comments on HN
- 9Learning from Terminals to Design the Future of User Interfaces6 people · 1.0K points · first shared 2017 · 370 comments on HN
- 10How Postgres Makes Transactions Atomic6 people · 656 points · first shared 2017 · 48 comments on HN
- 11Rate Limiting, Cells, and GCRA6 people · 11 points · first shared 2015 · discussion on HN
- 12In Pursuit of Production Minimalism5 people · 386 points · first shared 2017 · 82 comments on HN
- 13Redis Streams and the Unified Log5 people · 261 points · first shared 2017 · 48 comments on HN
- 14Transactionally Staged Job Drains in Postgres5 people · 115 points · first shared 2017 · 31 comments on HN
- 15Using Canonical Log Lines for Online Visibility5 people · 16 points · first shared 2016 · discussion on HN
What HN people wrote when they linked it
karbon0x · 2023-12-25
Anything from Brandur is usually great - https://brandur.org/
Also, https://www.applied-cartography.com/ from Justin Duke
frakkingcylons · 2021-05-27
https://brandur.org has lots of interesting posts about databases, especially Postgres. Also posts about interesting technical problems and their solutions. One of my favorites is this one about implementing an idempotent API:
https://brandur.org/http-transactions
hashamali · 2020-09-21
Lot of great mentions so far. Another one I'd throw in is https://brandur.org/
Beautiful design and excellent deep dives on technical topics that interest me personally (Postgres, web architecture, etc).
bnchrch · 2018-08-06
http://brandur.org/ is one I've recently discovered but it's become by far my favourite both in design, content and how it's built.
A lot of original thought I can agree with as an engineer
DarkCrusader2 · 2026-07-06
Given the unanimous consensus on HN that Postgres is all you will ever need. I will present 2 resources which I came across recently which changed my perspective on this blind reverence for Postgres for everything.
First is this Oxide and Friends episode [1] where Bryan and gang explains war stories related to operating Postgres during their Joyent days and why they went with Cockroach DB for Oxide.
Second is this amazing blog from brandur which explains several issues with using Postgres as high throughput queue and some mitigations.
Online forums like Hacker news can be a bit echo chamber-y. It is always good to ensure that the people you are taking advice from are solving the same problem as you.
[1] https://oxide-and-friends.transistor.fm/episodes/whither-cockroachdb/
[2] https://brandur.org/postgres-queues
simonw · 2026-01-28
> Oban allows you to insert and process jobs using only your database. You can insert the job to send a confirmation email in the same database transaction where you create the user. If one thing fails, everything is rolled back.
This is such a key feature. Lots of people will tell you that you shouldn't use a relational database as a worker queue, but they inevitably miss out on how important transactions are for this - it's really useful to be able to say "queue this work if the transaction commits, don't queue it if it fails".
Brandur Leach wrote a fantastic piece on this a few years ago: https://brandur.org/job-drain - describing how, even if you have a separate queue system, you should still feed it by logging queue tasks to a temporary database table that can be updated as part of those transactions.
greener_grass · 2025-11-27
> The real answer to all this is to use a provider that supports idempotency keys. Then when you can retry the action repeatedly without it actually happening again. My favorite article on this subject: https://brandur.org/idempotency-keys
Turtles all the way down?
Let's say you are the provider that must support idempotency keys? How should it be done?
moebrowne · 2025-08-16
It's well documented that soft delete is more of a headache than it's worth
https://brandur.org/soft-deletion
dondraper36 · 2025-08-16
In Go, for example, there is a mixed approach of pgx + sqlc, which is basically a combo of the best Postgres driver + type-safe code generator (based on raw SQL).
https://brandur.org/sqlc
Even though I often use pgx only, for a new project, I would use the approach above.
hoipaloi · 2025-04-24
Counter point: "Soft Deletion Probably Isn't Worth It" https://brandur.org/soft-deletion
rednafi · 2025-01-06
Here are my favorites:
- Jacob Kaplan-Moss (https://jacobian.org/) [Engineering leadership, OSS]
- Anton Zhiyanov (https://antonz.org/) [SQL, Go, Python]
- Julia Evans (https://jvns.ca/) [SQL, Linux, Python, Go, Web]
- Brandur Leach (https://brandur.org/) [Postgres, Go, Ruby, Web]
- Brandon Rhodes (https://rhodesmill.org/brandon/) [Python, Astronomy, Linux]
- Nathanial J Smith (https://vorpus.org/blog/) [Python, Async, Linguistics]
I also write occasionally at https://rednafi.com.
carderne · 2024-07-14
Last time this discussion came up, someone shared this nice article[0] about all the different ID options. It mentions Stripe IDs, which have pretty prefixes like "prod_foo" and "user_bar". These are great for users of their API (no wondering what an ID refers to) and for internal tooling and debugging, but have to be stored as inefficient varchars, which is not great for indexing and whatnot.
So I spent the weekend creating "UPID"[1], which is like ULID but prefixable! Up to four characters for the prefix, 40 bits of time (256ms precision, but could change in a revision) and still 64 bits of randomness. So you can do pretty Stripe-style IDs without losing the benefits of a neat 128-bit UUID column. Have implemented it for Python, Rust and Postgres, maybe worth a kick around for someone!
[0] https://brandur.org/nanoglyphs/026-ids
[1] https://github.com/carderne/upid
ZephyrBlu · 2024-06-05
This is a tech-focused selection from my personal list, with a few more business-y sources thrown in:
- https://erikbern.com
- https://lethain.com
- https://commoncog.com
- https://scattered-thoughts.net
- https://danluu.com
- https://ideolalia.com
- https://staysaasy.com
- https://collabfund.com
- https://blog.nelhage.com
- https://jacobian.org
- https://equalventures.substack.com
- https://defmacro.org
- https://spakhm.com
- https://apenwarr.ca
- https://scarletink.com
- https://benkuhn.net
- https://cpojer.net
- https://brandur.org
- https://zeptonaut.com
Let me know if you want some reading recommendations for any of these!
cloverich · 2023-07-09
I briefly used Fathom and think they are great, especially if you are hosting a static site on something like Github pages, or some other equivalent. Yet I regret that I can't get free server-side analytics. My pages are being served by a server, I just want it to count logs for me. If I ever move back to a self-hosted solution, I'd definitely love to give something like goaccess[1] a try.
Any static hosting sites that provide this for free today?
[1]: https://brandur.org/minimal-analytics
derekperkins · 2022-04-06
This is a great article going into more specifics. https://brandur.org/idempotency-keys
indiv0 · 2022-02-07
He also has an excellent newsletter! For example: https://brandur.org/nanoglyphs/029-path-of-madness
koolba · 2022-01-22
This is a fantastic (like all of his writings!) write up on building idempotent web services: https://brandur.org/http-transactions
scary-size · 2021-09-20
Here are mine:
- https://franz.hamburg
- https://www.project-daily.com
Some blogs I follow via RSS (using the awesome NetNewsWire app):
- https://brendangregg.com
- https://brandur.org/
- https://ferd.ca/
mawise · 2021-07-15
I'd love to see more sites skip out of GA entirely. If you use server logs for analytics you get better fidelity[1]. You can probably eliminate the cookie consent banner if you're only storing login or session-continuity (required for functionality) cookies.
[1]: Based on this analysis: https://brandur.org/minimal-analytics
crote · 2019-12-08
In my opinion, one of the best websites is brandur's (https://news.ycombinator.com/user?id=brandur).
Not a huge fan of the homepage, but the articles look sublime. Example: https://www.brandur.org/sortsupport-inet
xrd · 2019-11-07
This is the most important comment in this thread. For more, read this excellent article:
https://brandur.org/graphql
LiamPa · 2019-09-28
https://brandur.org/articles
Great articles and I personally love the diagrams.
brobinson · 2018-05-02
This article is excellent and covers transactions/MVCC: https://brandur.org/postgres-atomicity
hathawsh · 2018-04-27
The same author wrote a Rust article filled with a lot of great content: https://brandur.org/rust-web
pselbert · 2018-01-25
This article from Brandur does a great job of explaining a use case for Redis Streams [0]. As part of that he begins by explaining what they are, how they work, and a bit about how they differ from Kafka.
[0]: https://brandur.org/redis-streams
brandur · 2017-08-28
I wrote this one. I've been working with Ruby roughly six years, but didn't understand its memory internals at all beyond the surface level until I started doing the research for this one.
If there's one takeway/point of interest that I'd recommend looking at, it's the novel way that Ruby shares a pointer value between actual pointers to memory and special "immediate" values that simply occupy the pointer value itself [1]. For example, a fixnum (most integers) has its binary value shifted by one bit to the left, and then a "1" flag applied in its rightmost position so that Ruby can recognize it. It doesn't have to go to heap, and the runtime can take advantage of that for faster calculations.
[1] https://brandur.org/ruby-memory#value
munro · 2017-08-16
> https://brandur.org/assets/postgres-atomicity/heap-tuple-visibility.sv…
These diagrams are really beautiful, I love the subtle separation in the lines showing that they're made of hypens. Is there some software that makes these easy to generate?
bretthopper · 2025-12-23
craigkerstiens · 2024-07-23
I love when friends do this. It's hard to keep up with people and what they're up to. Publishing and letting people subscribe to me is a great way to share things. A few examples of some friends who are doing this:
Justin Searls (fairly known in Ruby and Rails community) mostly quit a lot of various social channels though publishes on some of them one direction. He started a podcast that wasn't meant to be guests of some specific topic, it's just him updating you on things. What he's working on, what he's learning, random stories, etc. - https://justin.searls.co/casts/
Brandur who I've worked with at a couple of places (Heroku previously, and now Crunchy Data) who writes great technical pieces that often end up here also has more of a personal newsletter. While there are technical pieces in there at times he'll also talk about personal experiences my favorite one is some of the unique experiences hiking the Pacific Trail (https://brandur.org/nanoglyphs/039-trails).
2143 · 2022-04-23
I had read the portion you quoted and found it interesting as well.
I've always been fascinated by long running processes. I'm sure you might have heard about the Clock of the Long Now [1] (Wikipedia article [2] seems more useful than the official website), which is meant to work for 10000 years. It's under construction, but their strategies to handle adversities over a 10000 year period worth looking into.
Related to that, I've read about an attempt by a software engineer presumably named Brandur who, inspired by the aforementioned clock, has attempted to build a software that would send out tweets for the next 10000 years [3]. While I personally feel it probably wouldn't succeed because there's too many things that can go wrong, it was nice to read the considerations that went into the program. Perhaps more than tweeting for the next 10000 years itself, Brandur was really trying to point out that it's difficult to build long lasting software products.
Writing software that endures for a long time without too much additional maintenance is something I'd like to do.
Another long running — though in comparison to the above much smaller — group of equipments are the space probes Voyager 1 (launched in 1977), Voyager 2 (1977) and New Horizons (2006). Unless I'm mistaken they all continue to function in limited ways and continue to send back data to the earth. Isn't it mind-blowing that something that left Earth about 45 years ago still works?! (Or maybe it's not mind…