Latest Blog Posts

LISTEN Carefully: How NOTIFY Can Trip Up Your Database
Posted by Jimmy Angelakos on 2026-07-15 at 12:37

LISTEN Carefully: How NOTIFY Can Trip Up Your Database, POSETTE 2026

POSETTE: An Event for Postgres 2026 is an online event for PostgreSQL, brought to us by the Postgres team at Microsoft, which took place on June 16-18, 2026. I'll always have a soft spot for in-person conferences, but POSETTE is probably the best-run online event in our community, and I was delighted to be invited back to speak.

As it happens, I had already given this same talk in person earlier the same month, at PG DATA 2026 in Chicago on June 4-5. My sincere thanks go to the organisers of both events for having me. The recording of my talk is now up.

If you use PostgreSQL's LISTEN and NOTIFY for asynchronous inter-process communication, they may be hiding a serious performance bottleneck in a high-throughput database. I walk through a real production incident where NOTIFY quietly brought a busy database to a grinding halt: how the internal serialisation of notifications triggers AccessExclusive lock cascades on pg_database, and how to architect a fix using unlogged queue tables, transaction-level advisory locks (pg_try_advisory_xact_lock), and batching to move NOTIFY out of your transaction hot path.

🎞️ Video on YouTube: youtube.com/watch?v=2-5WYY2bFjs

📊 View the slides: LISTEN Carefully: How NOTIFY Can Trip Up Your Database (PDF)

Have you been bitten by NOTIFY in production? I'd like to hear about it, on Mastodon at @vyruss@fosstodon.org or on Bluesky at @vyruss.org.

All Your GUCs in a Row: event_source
Posted by Christophe Pettus in pgExperts on 2026-07-15 at 01:00
Windows PostgreSQL logs messages to the Event Log under a name you choose with `event_source`—but Windows won't understand that name until you register it with…

Replacing pgAgent with pg_timetable: Part 2 - Installing pg_timetable as a service in Linux
Posted by Regina Obe in PostGIS on 2026-07-14 at 20:07

As stated in Part 1, pgAgent is going away, so I'm focussing on setting up pg_timetable as similar to pgAgent that I can. For this second part, I'm going to go over how to configure pg_timetable as a service on Linux.

A heads up, i really loved the pgAgent UI in pgAdmin so I'm working on one for pg_timetable which is mostly patterned after the pgAgent one. You can see the pull request work in progress pg_timetable UI for pgAdmin. I'm in the middle of cleaning up some loose ends before it is ready for commit.

Continue reading "Replacing pgAgent with pg_timetable: Part 2 - Installing pg_timetable as a service in Linux "

LinkedIn Live: Fixing Bad SQL in PostgreSQL with Jimmy Angelakos
Posted by Jimmy Angelakos on 2026-07-14 at 12:37

LinkedIn Live: Fixing Bad SQL in PostgreSQL with Jimmy Angelakos

Back on Friday, April 3rd, I ran a live, hands-on LinkedIn Live session on fixing bad SQL in PostgreSQL. My apologies for the delay in sharing the recording: for various reasons I couldn't post it earlier, but here it is.

The session was based on Chapter 2 of my book, PostgreSQL Mistakes and How to Avoid Them (Manning), and it zeroes in on the common SQL anti-patterns that quietly lead to incorrect results and hidden performance issues.

I kept it hybrid: short, concise explanations paired with live terminal demos on real-world examples. For each mistake, I show you the problematic query in action, explain why it leads to incorrect results or slow execution, and then walk through a practical refactor that fixes it, often unlocking proper index usage and more efficient execution along the way.

It's a mix of everyday correctness pitfalls and the subtler performance traps, the kind that slip straight through code review and then quietly hurt you in production. If you write SQL or review database code, I hope you'll come away with concrete techniques you can apply immediately to write safer (and faster!) Postgres queries.

Without further ado, here's the recording:

Video on YouTube: youtube.com/watch?v=SxIgD1OfU_A

I'd love to hear what you think. You can always reach me at @vyruss@fosstodon.org with your questions, your own SQL horror stories, or the refactors that saved your bacon.

If you enjoyed this and want the whole collection of mistakes (and how to avoid them), the book is right here 👇

PostgreSQL Mistakes and How to Avoid Them

How SQL/PGQ Rewrites to Joins on PostgreSQL 19
Posted by Hans-Juergen Schoenig in Cybertec on 2026-07-14 at 05:00

This post is about what PostgreSQL actually does when you write GRAPH_TABLE syntax. It turns out the database rewrites your graph query into ordinary joins against the underlying tables, then plans them with the regular optimizer. This has three practical consequences you'll notice right away.

First, performance is predictable. The query plan shape follows directly from your pattern shape, just like join-heavy SQL. Second, the indexes that matter are the obvious ones — the same you'd add for equivalent joins. Third, EXPLAINshows you the join tree directly. There's no graph-specific plan node hiding anything from you.

The setup below is self-contained. Run it once and you're ready to follow along with everything that comes next.

Setup

We'll create a synthetic graph with 10,000 vertices and about 60,000 random directed edges. It loads in a few seconds and uses the prefix big_ so it won't collide with anything else you might have.

Drop existing objects first if you've run this before:

DROP PROPERTY GRAPH IF EXISTS big_social;
DROP TABLE IF EXISTS big_knows, big_person CASCADE;

Now create everything:

CREATE TABLE big_person (id int PRIMARY KEY, name text);
CREATE TABLE big_knows  (a int NOT NULL, b int NOT NULL, PRIMARY KEY (a,b));

INSERT INTO big_person SELECT g, 'P'||g FROM generate_series(1, 10000) g;

INSERT INTO big_knows
SELECT DISTINCT a, b FROM (
    SELECT (random()*9999)::int + 1 AS a,
           (random()*9999)::int + 1 AS b
    FROM generate_series(1, 60000)
) s
WHERE a <> b ON CONFLICT DO NOTHING;

ALTER TABLE big_knows ADD FOREIGN KEY (a) REFERENCES big_person(id);
ALTER TABLE big_knows ADD FOREIGN KEY (b) REFERENCES big_person(id);

CREATE PROPERTY GRAPH big_social
    VERTEX TABLES (big_person KEY (id) LABEL person PROPERTIES (id, name))
    EDGE TABLES (
        big_knows
            SOURCE KEY (a) REFERENCES big_person (id)
            DESTINATION KEY (b) REFERENCES big_person (id)
            LABEL knows
    );

ANALYZE big_person;
ANALYZE big_knows;

The R

[...]

All Your GUCs in a Row: escape_string_warning
Posted by Christophe Pettus in pgExperts on 2026-07-14 at 01:00
A twenty-year-old warning that stays silent on modern PostgreSQL—until it spots a real problem hiding in your connection settings.

Contributions for week 26 & 27
Posted by Cornelia Biacsics in postgres-contrib.org on 2026-07-13 at 15:43

On 2 July, 2026, the PostgreSQL Istanbul Meetup met for the first time, organized by Devrim Gßndßz, Gßlçin YĹldĹrĹm Jelínek & Bilge Korkmaz Erdim.

Speakers:

  • Viktoriia Hrechukha
  • Pavlo Golub

On 2 July 2026, the PostgreSQL User Group Estonia met, organized by Ervin Weber

Speakers:

  • Henrietta (Hettie) Dombrovskaya
  • Martin Vool

On 2 July, the Program Committee of PGConf Brazil met to finalize the schedule:

  • Rodrigo (Bill) Bernardi
  • TaĂ­s Medeiros
  • Marcelo Altmann
  • Ronaldo Andrade Silva
  • Rafael Thofehrn Castro

On 9 July, the Program Committee of PGDay Lowlands met to finalize the schedule:

  • Teresa Lopes (Chair)
  • Chelsea Dole
  • Stefan Fercot
  • Boriss Mejias
  • Ellert van Koperen

On 9 July, the PostgreSQL Edinburgh Meetup July 2026 met, organized by Jimmy Angelakos

Speakers:

  • Pat Wright
  • Martins Otun

Multi-media contributions:

PostgresEDI July 2026 Meetup — Public Speaking, AI Compliance
Posted by Jimmy Angelakos on 2026-07-13 at 12:37

Actual sunshine ☀️ in Edinburgh 😲 and a room full of Postgres people catching up over pizza: July was good to us. 🐘

Highlights from the PostgresEDI July 2026 meetup

Thursday, July 9th brought us to Paterson's Land at the University of Edinburgh, and to a wonderfully diverse pair of talks: one on finding your voice in the community, and one on building auditable AI systems on Postgres. Thanks to everyone who came along, to our two excellent speakers, to my co-organisers Jim Gardner and Denys Rybalchenko, and to pgEdge for kindly sponsoring the pizza and refreshments.

For those who couldn't make it, or for those who want to revisit the details, here is a recap of the talks with slides.

The Talks

Speaking and Community Involvement for the Introvert

Pat Wright (Redgate)

Pat Wright in front of his title slide Pat Wright, ready to talk about speaking

Pat, a PostgreSQL Advocate at Redgate, kicked off the evening by making the case that technical skills alone aren't enough: speaking and community involvement can set you apart in your career, even if you're an introvert. All it takes is passion for your topic and "20 seconds of courage".

Pat Wright presenting his abstract submission tips Pat sharing his tips for conference abstract submissions

He walked us through the whole journey with refreshingly practical advice: writing an abstract that gets accepted, rehearsing to an empty room before presenting to others, testing demos relentlessly (and having a backup), and learning to "pause the introvert" on the day. His parting challenge for everyone: meet three new people at your next event.

📊 View the slides: Speaking and Community Involvement for the Introvert (PDF)


One Engine, One Audit Trail: Traceable, SQL-First Retrieval for Compliance-Critical Systems

Martins Otun (Algonix AI)

Martins Otun presenting his title slide Martins Otun introducing SQL-first retrieval for compliance-critical AI

After the break, Martins, Founder & Principal AI Engineer at Algonix AI, showed us how to build AI retrieval systems for regulated industries using PostgreSQL and pgvector, where auditability and compliance aren't an afterthought but a core part

[...]

All Your GUCs in a Row: enable_tidscan
Posted by Christophe Pettus in pgExperts on 2026-07-13 at 01:00
TID scans only happen when you explicitly ask for them via `ctid`, making `enable_tidscan` a knob you'll almost certainly never touch.

Swiss PgDay 2026 [UNLOGGED]
Posted by Pavlo Golub in Cybertec on 2026-07-13 at 00:00

We at CYBERTEC usually spend a lot of time producing polished community documentaries, but sometimes you just want to push the raw data straight to the output. Welcome to the UNLOGGED experiment for Swiss PgDay 2026!

In Postgres, an UNLOGGED table skips the write-ahead log for pure speed and zero crash recovery. That’s exactly what this first video is: a fast, uncompressed cut to capture the immediate, boots-on-the-ground vibe from Swiss PgDay 2026 while the team compiles the official documentary.

I’m dropping this as a test to see if you enjoy this faster, unedited format. Check it out and let me know if you want to see more of these!

Watch the video on YouTube.

The tests passed. The plan didn't.
Posted by Radim Marek on 2026-07-12 at 18:16

TL;DR - RegreSQL 1.0 tested that your queries return the right rows. 2.0 tests that they return them the right way, and it does the checking against production's real statistics instead of your empty dev database, which lies.

A migration cleanup dropped an index nobody thought was load-bearing. Every test passed: same rows, same order, green. Three days later the API started timing out on a query that hadn't changed a character, because the planner had quietly switched it from an index scan to a sequential scan over a table that had kept growing.

The first version of RegreSQL would have passed that change too. It tests what your queries return: run them, diff the rows against a committed expected file, go red when the output changes. That catches the query that now returns the wrong rows. It says nothing about the query that returns the right rows the wrong way, which is most of what takes a database down.

Version 2.0 tests that.

Test the plan, not just the rows

Here is that failure on a laptop. An orders table, an index on customer_id, and a query that reads one customer's orders:

-- orders-by-customer.sql
select id, total
  from orders
 where customer_id = :cid
order by id;

Baseline it and run the tests. Green:

$ regresql test
  ✓ 2 passing

Now drop the index the way that migration did, and run the same tests again:

$ regresql test
  ✓ 1 passing
  ✗ 1 failing

FAILING:
  orders-by-customer.1.buffers (3898 > 109 * 102%, +3476.1%)
  Expected buffers: 109
  Actual buffers:   3898 (+3476.1%)

  Cost (info):      7962.41 (baseline: 421.03)

  ⚠️ Table 'orders': Bitmap Heap Scan → Seq Scan

Here is the whole loop, start to failure, as it actually runs:

Animated terminal recording: regresql init, baseline --analyze, and regresql test passing with 2 passing; then a migration drops orders_customer_id_idx and the next regresql test fails with orders-by-customer.1.buffers reading 3898 vs an expected 109 (+3476.1%) and table 'orders' flipping from a Bitmap Heap Scan to a Seq Scan

The output check still passes; the rows didn't change. The plan check catches what the output check can't: the same query, returning the same result, now runs a sequential scan instead of the bitmap index scan it used before, reading thirty-five times the buffers. That failure blocks the merge. And the diff names the table and

[...]

All Your GUCs in a Row: enable_sort
Posted by Christophe Pettus in pgExperts on 2026-07-12 at 01:00
Disable `enable_sort` to fix a slow sort? Wrong target. Slow sorts need more `work_mem` or better indexes—not this GUC.

Postgres community events: isn't it time to tap the capabilities of the digital era?
Posted by Andrei Lepikhov in pgEdge on 2026-07-11 at 23:26

I've been going to conferences and meetups of all kinds since 2004. And today — much like in the era when a Nokia brick was giving people their first, still-primitive taste of mobility — these events follow the same format: you give a talk, you answer questions from the room, and the slides get posted somewhere. These days a video lands on YouTube too. Sometimes a chat survives the event, filled mostly with logistics. And that's about it.

I get it: the way humans interact and consume information doesn't really change, our analog bandwidth is limited, and the format — refined over centuries — is probably close to optimal. But why do we limit ourselves artificially and use almost none of what information technology has to offer?

Concretely, here's what I want to discuss.

Delays

For some mysterious reason, we still wait days, weeks, sometimes months for the slides and the video of a talk that matters to us. What stops organisers from publishing the slides before the talk starts, and the audio/video right after it ends? Editing isn't what makes a technical talk valuable — I can rewind to the right moment myself.

Access

Sure, people pay for tickets — but mostly for the chance to meet in person, argue, and soak up the atmosphere. The commercial upside of events like PGConf.dev or PGConf.EU is hardly the main point: they lean heavily on sponsors. And sponsors care about reach, not box office, don't they? So what stops us from streaming at least an audio feed from the nearest smartphone in real time and attaching the recording to the talk page the moment it ends? The community is international, and travel costs and visa formalities keep plenty of professionals away.

Interactivity

An on-site attendee can ask a question after the talk — or in the hallway track, over coffee, at an afterparty jogging. Spontaneous voice conversation is familiar, convenient, and important. But there are also people who don't think that fast on their feet, aren't that strong in face-to-face conversation, don't

[...]

(Belatedly) Announcing Release 21 of the PostgreSQL Buildfarm Client
Posted by Andrew Dunstan in EDB on 2026-07-11 at 13:34
 This release was made 9 days ago, but I just realized that I neglected to make a blog post about it. So, for the record, here is the announcement that went out via email.

I have released version 21 of the PostgreSQL Buildfarm Client

New features

  • PatchStack module — a new module for non-standard buildfarms that want to
    test a stack of patches on top of a branch. Note: this module is not for use with the
    regular community Buildfarm server - its use for builds reported there will be detected and rejected.
  • ABI check module — a new module that runs abidw to detect ABI changes in
    installed headers (passes --headers-dir and --drop-private-types for
    compatibility across abidw versions). Original author: Mankirat Singh, with
    additions from Tom Lane.
  • branches_target config key — run_branches.pl can now use a dedicated
    target URL for fetching branches_of_interest.json instead of deriving it by
    regex-mangling the main target URL. Falls back to the old derivation when
    unset; the pgbuildfarm URL migration is applied to it as well.

Build system / meson

  • using_meson is now decided by the presence of meson.build rather than by
    branch name, so it works reliably with non-standard branch names.
  • Use the meson --buildtype option.

Non-standard / regex-matched branches

  • Skip the bf_ prefix when using regex-matched branches.
  • Fetch remote branches for regex checking in a saner way.
  • Handle cases where there is no usable symbolic HEAD (and suppress the
    resulting clone warnings).
  • Handle a missing remote HEAD when updating a mirror.

Cross-version upgrade

  • Compress pg_upgrade dump files
  • Stop testing upgrades from pre-v10 in v20 and higher.
  • Several pg_upgrade_output.d fixes, including relative-path logic and an
    output-collection bug.

Protocol

  • Adjust to ups
[...]

All Your GUCs in a Row: enable_seqscan
Posted by Christophe Pettus in pgExperts on 2026-07-11 at 01:00
enable_seqscan does not disable sequential scans. It cannot, and it was never meant to. The documentation says as much: sequential scans cannot be suppressed entirely, because sometimes reading the whole table is the only way to answer the query. What off actually does is tell the planner to avoi…

Ever Run Into A PostgreSQL Query That You Can Figure Out What It Does??
Posted by Dave Stokes on 2026-07-10 at 20:06

 Ever have a query 'tossed over the fence' that you find incomprehensible but still have to support it? A few years ago, you would have needed to triage the query. Obfuscated queries can be tough to decipher.  Sometimes, the query is due to someone or an ORM being clever. Many times the query is touch to read because the 

DBeaver recently added its AI Chat to the free, open-source DBeaver Community Edition. And you will find it very at determining what a query does. Let's start with a simple query.

Open AI Assistant


Where to find the AI Assistant









DBeaver 26.1.2's AI Assistant can be found on the main menu under 'AI'.

Input Prompt

Once you have the AI Assistant open, ask 'what does this do'?
Prompt with a query







Explanation

The AI will examine what you gave it and report back. I am using OpenAI with the gpt-4o engine. 
The Query Explained






































Hopefully, you were able to recognize this simple query, which reports the number of dead tuples. Okay, let us try something harder.

Seeing a query from a production server for the first time can be humbling. A CTE or two, a whole bunch of joins, and a Window Function combined can make quite a head scratcher. 

What does this query do?

with film_revenue as (
    select
        f.film_id,
        f.title,
        c.name as category_name,
        count(r.rental_id) as rental_count,
        sum(p.amount) as total_revenue
    from
        public.film f
   
[...]

Architecture behind pg_hardstorage: The replication protocol
Posted by Hans-Juergen Schoenig in Cybertec on 2026-07-10 at 05:00

If you've heard one thing about pg_hardstorage, it's probably that "it works against managed PostgreSQL". This post is about the one architectural choice that makes that true, and the consequences that fall out of it.

The choice: data plane = libpq + replication protocol

pg_hardstorage's agent connects to PostgreSQL the same way a streaming replica does. A normal libpq connection, with the replication attribute set. The agent reads WAL using START_REPLICATION SLOT on a persistent physical slot, and pulls base backup data using BASE_BACKUP.

That's it. No archive_command. No archive_library. No SSH-into-the-host. No shared filesystem. The connection string is the entire interface.

pg_hardstorage agent libpq client (no host access) PostgreSQL replication endpoint [ CONNECTION ] libpq connect (replication=true, user=hs_backup) streaming-replication privilege ok [ BASE BACKUP ] BASE_BACKUP data dir streaming · stop_lsn = 0/3CFFEE40 [ WAL STREAMING (continuous) ] START_REPLICATION SLOT 'hs_prod' 0/3CFFEE40 WAL records streaming… flush LSN ACK · 0/3D000028 (every ~10s) … more WAL records … (loop forever, with periodic ACKs draining the slot.

The wire conversation between the agent and PostgreSQL, three phases over a single libpq connection. BASE_BACKUP for the data directory, START_REPLICATION
SLOT
for WAL, and a periodic flush LSN ACK that drains the slot on the PG side.

Consequence 1: managed PostgreSQL works automatically

RDS, Aurora, Cloud SQL, Azure Database, Aiven, Supabase, Neon — they all expose a PostgreSQL replication endpoint. Most of them give you a SUPERUSER or rds_replication role on demand. The agent needs nothing else.

Compare to pgBackRest, which assumes:

  • archive_command can be set on the source PG - managed: nope, you don't own postgresql.conf
  • SSH access to the host - managed: nope
  • An archive_library can be loaded - managed: nope

None of those work against managed PG. The data plane decision excludes most of the modern PostgreSQL deployment

[...]

All Your GUCs in a Row: enable_self_join_elimination
Posted by Christophe Pettus in pgExperts on 2026-07-10 at 01:00
You are rarely the only thing writing your SQL. Your ORM writes some of it, your nested views write more, and sooner or later one of them joins a table to itself on its own primary key. That join returns exactly the rows it started with. enable_self_join_elimination is the PostgreSQL 18 optimizat…

The Version Number Is Not the Territory
Posted by Christophe Pettus in pgExperts on 2026-07-09 at 20:00
A PostgreSQL 14 database threw an error that PostgreSQL 14 cannot produce.

PostgreSQL, AI Governance, and the C.A.L.M. Platform Test
Posted by Vibhor Kumar on 2026-07-09 at 16:40
The C.A.L.M. Technical Framework for PostgreSQL AI Platforms Moving AI Governance from the Model Layer down to the Data Foundation When building AI applications, most organizations mistakenly attempt to enforce governance at the application or model layer. True, production-grade AI governance does not begin at the model layer—it begins where data becomes trusted enough for the model to matter. Below is the technical blueprint for the C.A.L.M. Framework, designed to resolve organizational friction and ground your AI strategy directly within your PostgreSQL data infrastructure. The Invisible Risk (The Friction Point) When data infrastructure is disconnected from AI orchestration, four organizational silos emerge, creating a fragile and unverified system: Data Engineering: Creates separate copies of data for speed, leading to unmanaged data sprawl. AI & Model Team: Assumes the underlying data is already pre-governed and secure. Platform Team: Focuses strictly on infrastructure uptime and database stability, ignoring logic shifts. Compliance Team: Builds governance policies without actual database-level verification. The Reality: Governance at the model layer without the data layer is just the appearance of governance. The Four Pillars of the C.A.L.M. Framework By centering your AI architecture around a Trusted Data Platform (PostgreSQL), you can resolve these friction points using four native technical pillars: 1. C — Changeability Focus: Evolving database schemas without generating unmanaged data sprawl. Core Mechanism: Logical Replication (CREATE PUBLICATION / SUBSCRIBE). Architectural Control: Isolates and decouples AI workloads cleanly without triggering application schema shifts or relying on fragile, manual data pipelines. 2. A — Assurance Focus: Row-level tracking and proving correct operations under strict audit conditions. Core Mechanism: Row Level Security (RLS) & pgAudit. Architectural Control: Explicitly isolates tenants via native database logic so application-side checks cannot be bypassed. This completely separates the Data Trace from the AI Trace. 3. L — Leverage Focus: Unifying operational relational data and vector context to minimize infrastructure sprawl. Core Mechanism: pgvector + Shared RLS Policies. Architectural Control: Vector embeddings automatically inherit existing structured table security policies, eliminating access divergence between disparate operational and vector systems. 4. M — Measurability Focus: Catching query drift or path bypasses before model failures manifest in production. Core Mechanism: pg_stat_statements & App-Level Logs. Architectural Control: Surfaces true SQL statements executing against tables to expose discrepancies and hidden behaviors within LLM orchestration frameworks.

A few months ago, I spent time with multiple teams inside the same large financial services organization.

I spoke with the data engineering team. The AI and model team. The platform team. The governance and compliance team.

Each conversation sounded right.

That was the problem.

Each team understood its domain. Each had a clear mandate. Each had a reasonable explanation for the choices it was making. Nothing sounded careless. Nothing sounded irresponsible.

But the real issue did not appear inside any one conversation. It became visible only when I looked across all four of them together.

The data engineering team had pulled customer data into a separate environment to support AI use cases. Faster to build. Safer to experiment. They did not want to touch core systems.

The AI team was building agents on top of that data — assuming it had already been governed, validated, and approved before it reached them.

The platform team was focused on infrastructure stability. AI-specific data governance was outside its current scope.

The compliance team was building a model governance framework. Access controls. Audit requirements. Approval workflows. Human review points.

Solid work. Built on one assumption nobody had verified: that the data underneath the models was already governed correctly.

Nobody had lied. Nobody had been careless. Each team was doing exactly what it believed it was supposed to do. But when I looked across all four conversations, the real risk became obvious.

The customer data grounding the AI agents existed in at least three separate copies across the organization. Each copy had been created independently, with slightly different field definitions, access controls, lineage, and freshness. None of them was the governed system of record.

The control said: “Only show this customer’s data to an authorized user.” The data layer replied: “Which copy? Governed by which access model? Created by which team? Refreshed when?”

That is where AI governanc

[...]

Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid.
Posted by Hubert 'depesz' Lubaczewski on 2026-07-09 at 12:41
On 1st of July 2026, Masahiko Sawada committed patch: Add min() and max() aggregate support for uuid.   The uuid type already has a full set of comparison operators and a btree operator class, so it is totally ordered. min() and max() were the only common aggregates missing for it. Add the uuid_larger() and uuid_smaller() … Continue reading "Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid."

EDB heads to PGConf.Brasil 2026, this is what we’ll be talking about!
Posted by Floor Drees in EDB on 2026-07-09 at 08:39
The Brazilian PostgreSQL community is gearing up for one of the most anticipated events of the year: PGConf.Brasil 2026. Taking place in the city of Blumenau from September 2 - 4, this year’s conference features no less than 13 sessions by EDB colleagues.

All Your GUCs in a Row: enable_presorted_aggregate
Posted by Christophe Pettus in pgExperts on 2026-07-09 at 01:00
enable_presorted_aggregate is on, it has been on since PostgreSQL 16 introduced it, and the single most useful thing you will ever do with it is turn it off for exactly one query. Default on, context user: settable per session, per role, per database, or inline in a single transaction. That last …

How to Achieve Pruning When Querying by Non-Partitioned Columns in PostgreSQL
Posted by Haki Benita on 2026-07-08 at 21:00

One of the most valuable things about partitioned tables is pruning - the database's ability to eliminate entire partitions based on a query predicate. Under conventional wisdom, pruning can only be achieved when querying by the partition key - this makes choosing the right key extremely difficult. However, if your data follows certain patterns, using some clever tricks you can achieve pruning even when filtering by non-partition key columns.

In this article, I demonstrate how to achieve partition pruning when filtering by non-partition key columns.

image by abstrakt design
image by abstrakt design
Table of Contents

Table Partition

Imagine you run a popular website with many users. Your product team wants to gain some insight into how the system is used, so you start logging events. To give events context, you group them into sessions and keep the time, the type, and some data in a database table:

db=# CREATE TABLE event (
  id         BIGINT GENERATED ALWAYS AS IDENTITY,
  timestamp  TIMESTAMPTZ NOT NULL,
  session_id BIGINT NOT NULL,
  type       TEXT NOT NULL,
  data       JSONB
) PARTITION BY RANGE (timestamp);

CREATE TABLE;

You have many users so you expect many events. Most queries use only a subset of the data, usually a specific date range, so you create a partition for each year based on the timestamp:

db=
[...]

All Your GUCs in a Row: enable_partitionwise_join
Posted by Christophe Pettus in pgExperts on 2026-07-08 at 01:00
Partitionwise join decomposes big joins into smaller per-partition pairs when both tables partition on the join key—but only if you enable it and meet strict…

Happy 30th Birthday, PostgreSQL
Posted by Ruohang Feng on 2026-07-08 at 00:00
On July 8, 1996, the PostgreSQL community picked up the flame from Postgres95. Thirty years later, it has grown from a Berkeley research project into a default foundation of the global database ecosystem.

PostgreSQL Disaster Recovery with pgBackRest TLS Transport
Posted by SHRIDHAR KHANAL in Stormatics on 2026-07-07 at 15:41

The backup node and DR server don’t need to share SSH keys. Here’s how pgBackRest’s native TLS transport provides certificate-authenticated restores and strict security isolation, making it the cleaner choice for isolated or large-scale recovery environments.

SSH Gets the Job Done Securely. TLS Can Help at Scale.

If you’ve read the pgBackRest DR guide on this blog, you already know the standard setup: two servers, passwordless SSH, pgBackRest pulling backups across the wire. It works reliably, and it’s what most teams run.

SSH works well for small deployments. The challenge emerges at scale: as the number of machines grows, managing individual key pairs, distributing them, rotating them, and auditing who has what becomes increasingly complex. SSH also supports host-based authentication, where host keys are used to authenticate connections in an Ident-like model, which simplifies certain setups. But, enforced key rotation across a large fleet remains genuinely difficult.

In essence, TLS works with the X.509 public key infrastructure to manage and verify public keys. Rather than pre-sharing them, the key owner can provide them embedded in a certificate that includes more information about who the key belongs to, the validity period, and so forth.  A certificate authority then signs the certificate. The receiver of the key only needs to know the certificate authority’s public key to verify it and then decide whether to trust it.

As a result, rather than pre-sharing keys to validate authentication, this allows fewer keys to be shared initially, thereby improving management at scale. That’s exactly the problem pgBackRest’s TLS server mode solves, although this now adds a new layer of systems to manage in the certificate authorities.

Security Isolation and Lateral Movement

Beyond scale, TLS mode also changes the access model more fundamentally. Unless explicitly restricted with a forced command

[...]

My Dishonest Benchmark
Posted by Mayur B. on 2026-07-07 at 07:21
How to Make PostgreSQL Look 100x Faster

The DeWitt Clause and the chilling of benchmark fights:
***************************************************

Database benchmarking used to be a full-contact sport.

In the early 1980s, researchers at the University of Wisconsin, including David DeWitt, worked on what became known as the Wisconsin Benchmark. Oracle’s numbers in the Wisconsin Benchmark were reportedly bad enough to anger Larry Ellison. According to DeWitt’s own telling, Ellison called the University of Wisconsin department chair and demanded that DeWitt be fired. DeWitt was not fired, but Oracle later added license language restricting publication of benchmark results without vendor approval. That style of restriction became known as the DeWitt clause.

Over time, similar benchmark-publication restrictions appeared across proprietary database licenses. The effect was predictable. Public, independent, comparative benchmarking became legally and socially more annoying. Researchers became more careful. Papers sometimes used anonymous labels like DBMS-X. Vendors got more control over when and how benchmark results appeared.

The tragedy is not that the old benchmark wars were pure. They were not. Vendors had every incentive to over-tune, cherry-pick hardware, choose workloads that loved their architecture, and compare a carefully tuned home system against a less carefully tuned rival.

But at least there was open combat. Bad claims could be challenged in public. Competitors, researchers, and practitioners could argue over the methodology instead of arguing first over whether the benchmark was even allowed to exist. Benchmarking was political, but it was not quiet.

The modern database benchmark ecosystem is often worse in a more boring way.

A vendor can publish a benchmark that is technically reproducible but strategically tilted:

  • tune i
[...]

Going Multi-Region: How to Set Up CloudNativePG(CNPG) Distributed Topology
Posted by Wellingtone Luvonga in Cybertec on 2026-07-07 at 05:00

High availability within a single Kubernetes cluster is great, but what happens if an entire region goes down? To achieve true disaster recovery and cross-region resilience for PostgreSQL, you need a distributed topology.

Recently, I tackled setting up CloudNativePG (CNPG) Distributed Topology in a local minikube playground using MinIO. In this post, I’ll break down exactly how it works, walk through the YAML configuration, and share some key lessons learned along the way.

Why CNPG Distributed Topology?

CloudNativePG allows you to create a Replica Cluster in a completely separate Kubernetes cluster (or region) that follows a Primary Cluster.

  • Disaster Recovery (DR): If your primary data center goes dark, you can promote the replica cluster with minimal data loss.
  • Reduced Blast Radius: Infrastructure failures in Cluster A won't bring down your database layer in Cluster B (A failure in one region doesn't destroy both clusters).
  • Smooth Migrations: It provides an elegant way to migrate databases across Kubernetes providers or regions.

The Architecture at a Glance

In a typical CNPG distributed setup, the primary cluster continuously streams write-ahead logs (WAL) to an object store (like AWS S3, Google Cloud Storage, or MinIO). The replica cluster in the secondary environment reads from this object store to bootstrap itself and keep up to date by continuously polling for new WAL segments.

The Configuration Breakdown

Here is the exact blueprint I used to get this running in my lab environment.

1. The Storage Gateways (ObjectStore CRDs)

Before deploying the databases, we must define the underlying storage destinations. CNPG uses the ObjectStore Custom Resource (via the barman-cloud plugin) to bridge our PostgreSQL clusters to our MinIO deployment. Both clusters target the same bucket but isolate their data using their respective serverName fields.

# minio-store-pg.yaml
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
  name: mini
[...]

All Your GUCs in a Row: enable_partitionwise_aggregate
Posted by Christophe Pettus in pgExperts on 2026-07-07 at 01:00
PostgreSQL's unusual enable_* parameter that defaults off: partitionwise aggregation trades memory for speed, and only you know if that deal is worth it for…

Top posters

Number of posts in the past two months

Top teams

Number of posts in the past two months

Feeds

Planet

  • Policy for being listed on Planet PostgreSQL.
  • Add your blog to Planet PostgreSQL.
  • List of all subscribed blogs.
  • Manage your registration.

Contact

Get in touch with the Planet PostgreSQL administrators at planet at postgresql.org.