Radim @ boringSQL's Avatar

Radim @ boringSQL

@boringsql.com

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

50
Followers
36
Following
42
Posts
27.11.2024
Joined
Posts Following

Latest posts by Radim @ boringSQL @boringsql.com

You just might be onto something 🀣 I've been looking for something for the back of the t-shirts and I think we have a strong candidate

Equality: 0.5%
Ranges: 33%
May your indexes be with you

27.02.2026 21:38 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

Or what about cases where there are no statistics at all? Like materialized CTEs, temporary tables, or computed expressions in WHERE clauses. The planner falls back to hardcoded constants. 0.5% selectivity for equality. 33% for ranges. Good luck.

27.02.2026 19:03 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
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.

#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...

27.02.2026 19:03 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

It's not magic. It's called SQL query regression testing. 🍻 as postmortem πŸ˜‰

24.02.2026 20:11 πŸ‘ 3 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

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.

24.02.2026 20:11 πŸ‘ 4 πŸ” 2 πŸ’¬ 2 πŸ“Œ 0

Busted :) These are the ones I'm speaking at - next time I'll have to do better proposal so Paris find me worthy πŸ˜‰

21.02.2026 10:33 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

#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.

21.02.2026 09:10 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
Inside the 8KB Page: PostgreSQL Page Layout Visualized Interactive visualization of PostgreSQL's 8KB page: header, line pointers, free space, and tuple data.

To make it bit more fun, you can play with the 2nd visualizer.

boringsql.com/visualizers/...

19.02.2026 21:48 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
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.

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...

19.02.2026 21:47 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0
Preview
The Alchemy of Shared Buffers: Balancing Concurrency and Performance Josef Machytka: Speaker portfolio

"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...

10.02.2026 09:52 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
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...

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

06.02.2026 19:38 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

While this led to 2748 lines dropped from RegreSQL it gets things done. Stay tuned for 2.0 release!

05.02.2026 20:20 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
GitHub - boringSQL/fixturize: Extract seed data from any PostgreSQL database Extract seed data from any PostgreSQL database. Contribute to boringSQL/fixturize development by creating an account on GitHub.

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.

05.02.2026 20:20 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

But it's not bad news. Agonising over fixtures forced me to look at the problem from another direction - how to quickly and securely use production data. Gave up on sampling, only to find a better solution:

graph-traversal based data extraction with masking to strip customer data and PII.

05.02.2026 20:20 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

While other changes leading up to v2.0 are strong quality-of-life improvements, I've decided to pull generated fixture support out of RegreSQL entirely for now.

05.02.2026 20:20 πŸ‘ 0 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

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

05.02.2026 20:20 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

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

31.01.2026 08:24 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

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! πŸ‡¨πŸ‡ΏπŸ’™

29.01.2026 08:15 πŸ‘ 3 πŸ” 2 πŸ’¬ 0 πŸ“Œ 0
Preview
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.

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.

24.01.2026 18:56 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Post image

First testing of RegreSQL integration with Rails / ActiveRecord via `rake regresql:export`.

18.01.2026 11:16 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
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...

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...

16.01.2026 20:12 πŸ‘ 1 πŸ” 0 πŸ’¬ 1 πŸ“Œ 0

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.

14.01.2026 22:27 πŸ‘ 3 πŸ” 2 πŸ’¬ 0 πŸ“Œ 0
Preview
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.

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...

13.01.2026 11:53 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0

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

28.12.2025 10:17 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Introducing pg-storage-visualizer
Introducing pg-storage-visualizer YouTube video by boringSQL

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...

26.12.2025 11:30 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
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.

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...

23.12.2025 06:55 πŸ‘ 1 πŸ” 1 πŸ’¬ 0 πŸ“Œ 0

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...

20.11.2025 19:28 πŸ‘ 2 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
Preview
RegreSQL: Regression Testing for PostgreSQL Queries Stop deploying broken SQL queries. RegreSQL provides regression testing for PostgreSQL queries with performance baselines and automated warnings.

Can't believe it's 5 years since my first pull request. Now sharing RegreSQL as my own fork.

boringsql.com/posts/regres...

14.11.2025 14:07 πŸ‘ 1 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0
The Quiet Power of SQL – Sturdy Statistics Blog

β€œ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/

14.11.2025 12:14 πŸ‘ 8 πŸ” 2 πŸ’¬ 0 πŸ“Œ 0
Preview
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.

Range types are one of PostgreSQL’s most underutilized features β€” let’s change that boringsql.com/posts/beyond...

#postgresql

03.11.2025 18:47 πŸ‘ 0 πŸ” 0 πŸ’¬ 0 πŸ“Œ 0