Every row lock in #postgres is a write to the page. the locker's xid goes into the same field as a delete marker; flags say "not actually deleted". commit doesn't clean up, vacuum does, at 3am. pg_locks shows nothing. the row is not unlocked. boringsql.com/posts/row-lo...
Radim @ boringSQL
Radim @ boringSQL
@boringsql.com
Straightforward PostgreSQL and SQL tips, tricks, and tools to get stuff done (no fluff).
64 followers40 following66 posts
Are AI agents over-indexing the schemas they create? First it was a hunch. Then I had to verify it. And there was it! Every agent dumps its indexes onto the single table taking all the writes. boringsql.com/posts/unbear...
postgres 19 has WAIT FOR LSN, which means you can finally drop the "sleep and hope" workarounds for reading your own writes from replicas. I did all the digging around. Sample Go implementation, and the Rails workaround (Active Record thinks WAIT FOR is a write 🙃) boringsql.com/posts/read-y...
@apatheticmagpie.bsky.social wrote the mechanics piece last week (seriously read hers first) she saved me from the boring part. what i did was stress-test it and measure what actually happens. clickhouse.com/blog/postgre...
Spent months benchmarking AlloyDB. The engineering is real, but the compatibility story is more nuanced than the marketing suggests. boringsql.com/posts/google... #postgres #benchmark #htap
Postgres MVCC is a 40-year-old design mistake" is one of those claims that just keeps getting repeated outside #postgresql community. So I wrote the article. And got the backlash. boringsql.com/posts/mvcc-b...
Striking while the iron was hot, we took it to Postgres FM with Michael and Nik and nobody in that room can be accused of being a fanboy. postgres.fm/episodes/mvcc
Radim @ boringSQL reposted
Everyone knows #postgres VACUUM reclaims dead tuples. Far fewer people can tell you that a deleted tuple loses its storage at one moment and its line-pointer slot at a completely different one. boringsql.com/posts/vacuum...
Everyone says store money as numeric, not float. Fewer people can say what breaks if you don’t. Your float SUM changes every run. Same rows, nothing touched, three different totals. That’s floats plus parallel aggregation. #postgres boringsql.com/posts/same-r...
A single NULL turns NOT IN into a query that silently returns zero rows, and the planner couldn't optimize around it for as long as anyone can remember, until a PostgreSQL 19 patch fixed that. boringsql.com/posts/not-in...
Radim @ boringSQL reposted
Gave a talk today at #PGData2026 on #Postgres plan management and monitoring. Some exciting changes coming to Postgres 19, and pg_stat_plans (plan statistics) now supports the new release. Full slides from the talk: resources.pganalyze.com/pganalyze_PG...
Postgres chat with a view - amazing warmup for @pg-data.bsky.social - let’s go #postgres Chicago
You trust #postgresql pg_stat_statements bit too much. That might be the problem. It's quietly bending what it reports, and none of it is a bug. Part 1 - everything it tells you boringsql.com/posts/pg-sta... Part 2 - everything it can't boringsql.com/posts/pg-sta...
Without fail, VIEWs are source of heated discussions. What should be a cleanest SQL abstraction layer comes with a lot of baggage. boringsql.com/posts/strong...
The third boringSQL visualizer is live, and this one is the piece I've been building toward: MVCC. boringsql.com/visualizers/... #postgresql
This is the core knowledge I will cover during my session(s) "Visualizing PostgreSQL Storage Internals" next week in Essen (German Postgres Conf) and in June at @pg-data.bsky.social
The third boringSQL visualizer is live, and this one is the piece I've been building toward: MVCC. boringsql.com/visualizers/... #postgresql
Radim @ boringSQL reposted
If you're interested in #PostgreSQL, make sure you attend my April 3rd LinkedIn Live event (10am ET/3pm BST)! I'll break down real #SQL anti-patterns from my book (via @manning.com) and fix them live. 👇 🎟️ Register: linkedin.com/events/74433... 📖 Book: hubs.la/Q03Nc0hv0 #Postgres #webinar
Rewriting badly written CTEs is a constant source of work for me. Not because CTEs are bad. Mostly because developers use them to force execution order on the database. "First do this, then do that". Learn more at boringsql.com/posts/good-c... #postgresql #sql
Radim @ boringSQL reposted
This week: #PostgreSQL #Edinburgh #meetup on 📅 Thurs, March 12th! Join @boringsql.com and @vyruss.org for talks on making sure your queries don't break production & on how easy it is to run #Postgres on #Kubernetes with @cloudnativepg.bsky.social 👇 luma.com/5pglgx8h #CloudNativePG #k8s #TechMeetups
What happens when you inject production statistics into a 10,000-row PostgreSQL test table? The query plan flips. PostgreSQL 18 makes this a one-liner. pg_dump --statistics-only Plain SQL, under 1MB, no data needed. Learn the mechanics in my latest blog post. boringsql.com/posts/portab...
#postgresql takes a bite of 30,000 rows from your 50 million row table and calls it a day. That's 0.06% of your data deciding if your query will be fast or slow. boringsql.com/posts/postgr...
Step 1: "LGTM, this query is fine" Step 2: Deploy to production Step 3: Pray 🙏 Step 4: SRE - "This query is definitely NOT fine" Step 5: "But... it worked on MY database" 🔥 No ifs. No buts. On 12 March @postgresedi.bsky.social find out how to become an atheist when it comes to your SQL queries.
Epitome of boring. What else to write on site called boringSQL then dry introduction of what is inside #postgresql 8KB page? boringsql.com/posts/inside...
To make it bit more fun, you can play with the 2nd visualizer. boringsql.com/visualizers/...
"The Alchemy of Shared Buffers" must have been amazing presentation by Josef Machytka during CERN pgDay (had to skip that one unfortunately). It's worth checking the slides. medium.com/@josef.machy...
Back to Buffers. This time you can learn how to read and understand Buffer statistics in EXPLAIN output in my latest article boringsql.com/posts/explai... #postgresql
That's where new project "fixturize" comes in: github.com/boringSQL/fi... its goal is to retrieve data snapshots with referential integrity intact, while masking sensitive data in the process.
Still recharging after this week. But it's that good kind of tired - the one you get when something actually matters. @praguepgdevday.bsky.social was my first time speaking at a bigger Postgres event. The RegreSQL session went well, but honestly? The conversations afterwards were the real thing
Radim @ boringSQL reposted
Buffers came up during Postgres FM chat and people asked why they matter so much. So I wrote about it - with interactive demos to make it click. Introduction to Buffers: boringsql.com/posts/introd... Do the visuals help you to grasp the concept easier? Let me know.
I got myself talking about the motivation behind RegreSQL on Postgres FM 🎙️ We nerded out a bit about why timing is a terrible metric, why buffers actually matter, statistics, performance – and why all of this is more relevant in the age of agentic coding. postgres.fm/episodes/reg...
Test if queries hit the right indexes at production scale – without needing to have production data. I'll show you exactly how during @praguepgdevday.bsky.social - Session "It works on my database - Regression testing of SQL queries" is last of the day, but I intend to make it worth staying for.
Where do you stand when it comes to #postgresql arrays? If you want to learn more, check out my latest deep-dive into the topic of arrays, exploring TOAST, GIN indexing gotchas, and when to just use a link table. boringsql.com/posts/good-b...