Radim @ boringSQL

@boringsql.com

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

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

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.

boringsql.com

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.

Bild

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

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.

boringsql.com

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.

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

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

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

postgres.fm

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