Sign in

Radim @ boringSQL

@boringsql.com
65 followers 40 following 66 posts

Straightforward PostgreSQL and SQL tips, tricks, and tools to get stuff done (no fluff).

PostsRepliesMedia
Radim @ boringSQL @boringsql.com · 21/09/2026
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...
boringsql.com
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, an...
110
Radim @ boringSQL @boringsql.com · 11/09/2026
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...
boringsql.com
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.
110
Radim @ boringSQL @boringsql.com · 01/09/2026
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...
boringsql.com
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 ...
121
Radim @ boringSQL @boringsql.com · 18/08/2026
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
boringsql.com
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
000
Radim @ boringSQL @boringsql.com · 07/08/2026
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...
boringsql.com
PostgreSQL's MVCC is bad. So is everyone else's.
The critics are right: PostgreSQL's MVCC bloats tables and amplifies writes. Oracle, InnoDB, SQL Server, MongoDB, LSM stores, and etcd answer the same four design questions differently, and each pays ...
140
Reposted by Radim @ boringSQL
Pavlo Golub @pavlogolub.bsky.social · 13/07/2026
Only 10 hours left! 2026.pgconf.pl/call-for-pap...
2026.pgconf.pl
Call for Papers - PGConf.PL 2026
Submit your talk for PGConf.PL 2026!
001
Radim @ boringSQL @boringsql.com · 06/07/2026
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...
boringsql.com
VACUUM at the Page Level
Watch a VACUUM cycle with pageinspect, pg_freespace, and pg_visibility: how a dead tuple loses its storage, then its index entry, then its slot, and how the freed space gets reused.
020
Radim @ boringSQL @boringsql.com · 29/06/2026
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...
boringsql.com
Same rows, different SUM
Same query, same rows, different SUM totals in PostgreSQL. The culprit is parallel aggregation over double precision floats, not a bug. Here is the mechanism and the fix.
000
Radim @ boringSQL @boringsql.com · 15/06/2026
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...
boringsql.com
The NULL in your NOT IN
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.
000
Reposted by Radim @ boringSQL
lukas.fittl.com @lukas.fittl.com · 05/06/2026
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...
resources.pganalyze.com
043
Radim @ boringSQL @boringsql.com · 04/06/2026
Postgres chat with a view - amazing warmup for @pg-data.bsky.social - let’s go #postgres Chicago
010
Radim @ boringSQL @boringsql.com · 03/06/2026
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...
boringsql.com
pg_stat_statements: everything it tells you
What pg_stat_statements records and what it quietly drops: the queryid jumble that splits one query into many rows, the frozen first-seen query text, and averages that hide your p99.
010
Radim @ boringSQL @boringsql.com · 11/05/2026
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...
boringsql.com
Strong views on PostgreSQL VIEWs
Views are PostgreSQL's cleanest abstraction and its most rigid one. How rewrite rules, attribute numbers, and the dependency catalog conspire to make every column change a teardown, and what is missin...
010
Radim @ boringSQL @boringsql.com · 19/04/2026
The third boringSQL visualizer is live, and this one is the piece I've been building toward: MVCC. boringsql.com/visualizers/... #postgresql
boringsql.com
PostgreSQL MVCC Visualized
Interactive visualization of PostgreSQL's MVCC: xmin, xmax, snapshots, two concurrent sessions, and VACUUM reclaim.
100
Reposted by Radim @ boringSQL
Jimmy Angelakos @vyruss.org · 30/03/2026
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
LinkedIn LIVE: Jimmy Angelakos - PostgreSQL Mistakes and How to Avoid Them
021
Radim @ boringSQL @boringsql.com · 30/03/2026
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
boringsql.com
Good CTE, bad CTE
The planner treats CTEs very differently depending on how you write them. Here's what happens under the hood, version by version, through PostgreSQL 18.
100
Reposted by Radim @ boringSQL
PostgresEDI @postgresedi.bsky.social · 10/03/2026
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
Lister Learning and Teaching Centre
032
Radim @ boringSQL @boringsql.com · 09/03/2026
Major progress for RegreSQL 2.0. It can now force pretty much any statistics. Yesterday I highlighted the current limitation of overriding statistics. Today I can show you planner being completely independent and choosing Bitmap Index Scan on table with 1 tuple.
020
Radim @ boringSQL @boringsql.com · 09/03/2026
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...
boringsql.com
Production query plans without production data
PostgreSQL 18 makes optimizer statistics portable. Export them from production and inject them into test databases to get realistic query plans without the data.
020
Radim @ boringSQL @boringsql.com · 27/02/2026
#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...
boringsql.com
PostgreSQL Statistics: Why queries run slow
Slow PostgreSQL queries? Stale statistics are often to blame. Learn how the query planner uses statistics to estimate row counts and how to fix them.
110
Radim @ boringSQL @boringsql.com · 24/02/2026
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.
252
Radim @ boringSQL @boringsql.com · 21/02/2026
#postgresql season is officially on. I'll be on the ground at 🇪🇺 Nordic pgDay in Helsinki (March) 🇪🇺 German pgConf in Essen (April) 🇺🇸 PGDATA in Chicago (June) 🇬🇧 pgDay in London (September) I’m looking forward to all the chats and fun that's ahead.
110
Radim @ boringSQL @boringsql.com · 19/02/2026
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...
boringsql.com
Inside PostgreSQL's 8KB Page
A byte-level tour of the 8KB page. PostgreSQL's atomic unit of storage. We deep dive into page headers, line pointers, and free space using pageinspect to see exactly how your data lives on disk.
110
Radim @ boringSQL @boringsql.com · 10/02/2026
"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...
medium.com
The Alchemy of Shared Buffers: Balancing Concurrency and Performance
Josef Machytka: Speaker portfolio
010
Radim @ boringSQL @boringsql.com · 06/02/2026
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
boringsql.com
Reading Buffer statistics in EXPLAIN output
Learn how to interpret buffer statistics in PostgreSQL EXPLAIN output. Understand shared hits, disk reads, temp spills, and planning buffers to accurately diagnose and fix query performance bottleneck...
010
Radim @ boringSQL @boringsql.com · 05/02/2026
There are weeks of full wins, and those where it's time to eat the humble cake. RegreSQL has been making great progress, but I've been fighting the fixture system more and more. After many conversations and endless evenings - it's time to admit: fixtures are a genuinely hard problem
110
Radim @ boringSQL @boringsql.com · 31/01/2026
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
010
Reposted by Radim @ boringSQL
Prague PostgreSQL Developer Day @praguepgdevday.bsky.social · 29/01/2026
That’s a wrap at #P2D2! 🎉 Huge thanks to our amazing speakers, organizers, and attendees for making it unforgettable. PostgreSQL, people, and Prague—what a combo. We can’t wait to do it again next year. See you soon — brzy na viděnou! 🇨🇿💙
032
Radim @ boringSQL @boringsql.com · 24/01/2026
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.
boringsql.com
Introduction to Buffers in PostgreSQL
How PostgreSQL actually manages memory, from shared_buffers and dirty pages to the OS page cache sitting underneath it all.
000
Radim @ boringSQL @boringsql.com · 18/01/2026
First testing of RegreSQL integration with Rails / ActiveRecord via `rake regresql:export`.
010
Radim @ boringSQL @boringsql.com · 16/01/2026
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...
postgres.fm
Postgres FM | RegreSQL
Nik and Michael are joined by Radim Marek from boringSQL to talk about RegreSQL, a regression testing tool for SQL queries they forked and improved recently. Here are some links to things they ment...
110
Radim @ boringSQL @boringsql.com · 14/01/2026
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.
032
Radim @ boringSQL @boringsql.com · 13/01/2026
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...
boringsql.com
The hidden cost of PostgreSQL arrays
Deep dive into PostgreSQL arrays: why they're document storage in disguise, the TOAST performance trap, GIN vs B-tree indexing, the dangerous ANY() operator, and when junction tables beat arrays.
000
Radim @ boringSQL @boringsql.com · 28/12/2025
Writing about instant clones of PostgreSQL databases was not a clever move. Now I have to keep repeating to myself: I will NOT rewrite the whole control plane I will NOT scrap everything for #freebsd jails I will NOT rebuild everything with native ZFS snapshots
000
Radim @ boringSQL @boringsql.com · 26/12/2025
Introducing pg-storage-visualiser - tool made for EDUCATIONAL purposes to help you better understand how hashtag #postgresql stores data (both tables and indexes). The repository is available at GitHub github.com/boringSQL/pg... www.youtube.com/watch?v=fRz1...
youtube.com
Introducing pg-storage-visualizer
YouTube video by boringSQL
000
Radim @ boringSQL @boringsql.com · 23/12/2025
Ha! Wanted to write about #postgresql 18's new features, but most got covered already. One I haven't seen mentioned yet is file_copy_method. It's foundation for some SQL Labs features I'm building, so let's spread the word. Instant database clones with PostgreSQL 18 boringsql.com/posts/instan...
boringsql.com
Instant database clones with PostgreSQL 18
Learn how to clone PostgreSQL databases instantly using reflinks. Turn slow template copies into milliseconds with PostgreSQL 18's new file copy options.
011
Radim @ boringSQL @boringsql.com · 20/11/2025
It's gonna be cold, grey, and dark, but thanks to Postgres community events, there's something to look forward to. My evenings are busy next week, but in a good way - are you going to join me? Mon, 24 Nov in Prague - lnkd.in/dP5es2Nc Thu, 27 Nov in Malmo - www.meetup.com/malmo-postgr...
020
Radim @ boringSQL @boringsql.com · 14/11/2025
Can't believe it's 5 years since my first pull request. Now sharing RegreSQL as my own fork. boringsql.com/posts/regres...
boringsql.com
RegreSQL: Regression Testing for PostgreSQL Queries
Stop deploying broken SQL queries. RegreSQL provides regression testing for PostgreSQL queries with performance baselines and automated warnings.
010
Reposted by Radim @ boringSQL
Markus Winand @winand.at · 14/11/2025
“Early in our company’s life, we built everything around modern data frameworks — until we realized the simplest, most reliable tool had been in front of us all along” blog.sturdystatistics.com/posts/sql/
blog.sturdystatistics.com
The Quiet Power of SQL – Sturdy Statistics Blog
093
Radim @ boringSQL @boringsql.com · 03/11/2025
Range types are one of PostgreSQL’s most underutilized features — let’s change that boringsql.com/posts/beyond... #postgresql
boringsql.com
Beyond Start and End: PostgreSQL Range Types
Discover PostgreSQL range types for cleaner schemas and atomic conflict detection. Use tstzrange, daterange, and int4range to enforce data integrity with exclusion constraints.
000
Radim @ boringSQL @boringsql.com · 14/09/2025
Back after the summer break with a new article on PostgreSQL security: performing common maintenance tasks without distributing SUPERUSER privileges. boringsql.com/posts/postgr...
boringsql.com
PostgreSQL maintenance without superuser
Learn about PostgreSQL maintenance without superuser privileges. Predefined roles like pg_monitor and pg_maintain provide secure database administration.
000
Radim @ boringSQL @boringsql.com · 07/04/2025
Attending ViennaDB meet up
100
Reposted by Radim @ boringSQL
PostgreSQL @postgresql.activitypub.awakari.com.ap.brid.gy · 07/04/2025
Time to Better Know the Time in PostgreSQL Article URL: notso.boringsql.com/posts/know-th... notso.boringsql.com/posts/know-the-… Event Attributes
notso.boringsql.com
Time to Better Know The Time in PostgreSQL | boringSQL
Deep dive into SQL & PostgreSQL to build reliable, rock-solid solutions with tips and tricks that keep business online. Data is everything. Explore, learn and innnovate to get them where you need faster and more efficiently.
012
Radim @ boringSQL @boringsql.com · 09/02/2025
Back with "VIEW inlining in PostgreSQL" notso.boringsql.com/posts/view-i...
notso.boringsql.com
VIEW inlining in PostgreSQL | boringSQL
Deep dive into SQL & PostgreSQL to build reliable, rock-solid solutions with tips and tricks that keep business online. Data is everything. Explore, learn and innnovate to get them where you need fast...
000
Radim @ boringSQL @boringsql.com · 31/12/2024
A good way to end 2024 - migrating personal servers to FreeBSD
120
Radim @ boringSQL @boringsql.com · 04/12/2024
Meet me and other PostgreSQL enthusiasts in London (UK) next week www.meetup.com/london-postg...
meetup.com
Elephants At The Watering Hole, Wed, Dec 11, 2024, 6:30 PM | Meetup
**HI Everybody** Come along and talk about PostgreSQL with fellow PostgreSQL users, specialists, developers and all round enthusiasts of PostgreSQL. This is a relaxed soci
000
Radim @ boringSQL @boringsql.com · 01/12/2024
Impostor syndrome always hits me hard when something gets this much exposure 🙈
140
Radim @ boringSQL @boringsql.com · 01/12/2024
You can probably guess where this leads. Since transactions are already a pain for developers, imagine the chaos when issues hits the production. Locks and a growing queue of waiting statements are inevitable… Fun starts in 3, 2, 1.
010
Radim @ boringSQL @boringsql.com · 01/12/2024
Preparing a draft for the next article, which touches on transaction isolation (not the main topic though). This means the text needs to be super clear and include plenty of examples. Transactions are the number one source of pain for the majority of developers (unfortunately).
010
Reposted by Radim @ boringSQL
Comfortably Numb @numb.comfortab.ly · 28/11/2024
ORM are evil. SQL is meant to be handcrafted.
6684