Latest Blog Posts

PostgreSQL 19 REPACK (CONCURRENTLY): Does It Block Writes?
Posted by Roxana-Maria Haidiner on 2026-12-02 at 21:45
PostgreSQL 19 REPACK (CONCURRENTLY): Does It Block Writes?

A regular VACUUM removed the dead rows from my test table, but its total relation size was still 70 MB. I then used PostgreSQL 19's REPACK (CONCURRENTLY), which reduced it to 14 MB.

That result was part of my earlier PostgreSQL 19 feature tests. However, it left one question: what happens to reads and writes while the table is being repacked?

I repeated the test with a larger table so the operation would run long enough to watch. Reads continued, and writes also worked during the main rewrite. At the final table swap, however, REPACK had to wait for an open read transaction to release its lock.

This is the important part: REPACK (CONCURRENTLY) reduces blocking, but it does not mean that the operation is completely lock-free.

Below is the complete test, including the commands I ran and the lock that appeared at the end.

Run this test in a test database, not on a production table.

What REPACK does differently from VACUUM

When rows are deleted or updated, PostgreSQL leaves dead row versions behind. A regular VACUUM cleans them up and makes their space available for reuse inside the table.

However, VACUUM usually does not reduce the total space used by the table and its indexes on disk.

REPACK writes the live rows into a new table file and rebuilds the indexes. Once the rewrite is complete, PostgreSQL replaces the old table and index files with the new ones. This allows the unused space to be returned to the operating system.

Command Makes dead space reusable Returns space to the operating system Keeps the table available
VACUUM Yes Usually no Yes
REPACK Yes Yes No
REPACK (CONCURRENTLY) Yes Yes Yes,
[...]

Missed in PostgreSQL 19 : Add support for INSERT … ON CONFLICT DO SELECT.
Posted by Hubert 'depesz' Lubaczewski on 2026-12-02 at 19:03
On 12th of February 2026, Dean Rasheed committed patch: Add support for INSERT ... ON CONFLICT DO SELECT.   This adds a new ON CONFLICT action DO SELECT [FOR UPDATE/SHARE], which returns the pre-existing rows when conflicts are detected. The INSERT statement must have a RETURNING clause, when DO SELECT is specified.   The optional … Continue reading "Missed in PostgreSQL 19 : Add support for INSERT … ON CONFLICT DO SELECT."

A Routine OS Patch Quietly Broke Our Production Backups
Posted by semab tariq in Stormatics on 2026-12-02 at 15:53

Most teams treat OS patching as simple housekeeping. You apply the updates, reboot if needed, and move on. But on a PostgreSQL server, OS patching can also update database tools that were installed from the PostgreSQL package repository. When one of those tools has to talk to the same tool on another server, updating only one side can break things without any warning. That is exactly what happened to one of our customers recently. A normal patch night upgraded pgBackRest on the production database server but not on the backup server, and the next morning’s backup failed. The database never went down and no data was lost, but for several hours the newest backup they had was more than a day old.

I am writing this because the cause was small, easy to miss, and very common. If you run pgBackRest with a separate backup server, the same trap may already be sitting in your setup.

Key Takeaways

  • Routine OS patching can also update tools installed from the PostgreSQL package repository, such as pgBackRest, whenever dnf can see that repository.
  • pgBackRest checks that the database server and the backup server run the exact same version before it does anything, and stops if they do not.
  • Here, production was upgraded from 2.55.1 to 2.59.3 while the backup server stayed on 2.55.1, and the next morning’s backup failed within seconds. No data was lost, but for several hours the newest backup was more than a day old.
  • The “unable to find primary cluster” error that follows is a side effect. Read the version error first, before you check replication.
  • Prevent it with a version lock, a verification check after every patch cycle, and hiding the repository again as a standard step in the patching process.

One Small Step That Got Skipped

Last month the PostgreSQL minor version was upgraded on the production system. To install the new packages, dnf had to see the PGDG repository, so the

[...]

Missed in PostgreSQL 19 : Toggle logical decoding dynamically based on logical slot presence.
Posted by Hubert 'depesz' Lubaczewski on 2026-12-02 at 10:41
On 23rd of December 2025, Masahiko Sawada committed patch: Toggle logical decoding dynamically based on logical slot presence.   Previously logical decoding required wal_level to be set to 'logical' at server start. This meant that users had to incur the overhead of logical-level WAL logging even when no logical replication slots were in use.   … Continue reading "Missed in PostgreSQL 19 : Toggle logical decoding dynamically based on logical slot presence."

Stop Fighting Synchronous Replication: Meet WAIT FOR LSN – Part 2 – walkthrough for DBAs
Posted by Jobin Augustine in Percona on 2026-12-02 at 06:03

WAIT FOR LSN in PostgreSQL 19, a 3-part series

In Part 1, I explained why I consider WAIT FOR LSN the most impactful feature of PostgreSQL 19, and how an application can use it instead of synchronous replication to address most of the common problems of synchronous replication. The idea is commit on the primary, take pg_current_wal_insert_lsn() on the same connection, and run WAIT FOR LSN on the standby before telling the user “done”.

Theory is fine and architects can take full advantage of this feature. However generally DBAs won’t recommend something unless they could try it themself and see things with their own eyes. The good news is that you don’t need any application to understand this feature. Two psql sessions are enough. In this part, I will show:

  • read-your-writes on a replica breaking, and getting fixed with WAIT FOR,
  • timeouts, and how to watch waiting sessions,
  • a stuck standby, with synchronous replication and with WAIT FOR, side by side,
  • all the errors and restrictions, and why they exist.

At the end, I will tell the long story of how this feature reached its current shape, and thank the people behind it.

Setup. All the outputs below are actual outputs captured from PostgreSQL 19.0, with a primary and one asynchronous streaming standby. In my setup the primary is on port 5433 and the standby on port 5434. If you want the same setup, the waitforlsn directory has a docker-compose.yml which creates both (PG_IMAGE=postgres:19 docker compose up -d –wait, password postgres).

1. Check the standby

$ psql -h localhost -p 5434 -U postgres -c "SELECT pg_is_in_recovery(), pg_last_wal_replay_lsn();"
 pg_is_in_recovery | 
[...]

PostgreSQL 19 GIN VACUUM: When the Index Outgrows the Cache
Posted by Richard Yen on 2026-12-02 at 06:00

Also posted in Microsoft Blog for PostgreSQL

Trying Out GIN VACUUM in PostgreSQL 19

PostgreSQL 19 improves how VACUUM reads GIN indexes during cleanup, allowing that path to use streaming reads. I was curious how much of a difference that would make in practice, so I tried it out.

If an index is already in PostgreSQL’s buffer cache, there may not be much time to save by changing how pages are read. But what happens when the index is larger than the cache?

I compared PostgreSQL 18.6 and PostgreSQL 19 with GIN indexes ranging from 0.50 GiB to 26.62 GiB. The servers had 16 GiB of shared_buffers, giving me a chance to test both situations.

The small indexes finished cleanup in fractions of a second. The larger indexes were where the comparison became interesting: 1.27x median speedup at 21.30 GiB, and 2.20x at 26.62 GiB.

The size of the benefit will depend on the workload and environment.

Why GIN Can Have So Much to Read

GIN indexes are useful when one row contains many searchable items: words in a document, elements in an array, or keys and values in a jsonb value.

Unlike a simple index entry for a single scalar key, one row can contribute many GIN entries. An application can have a fairly ordinary-looking row count and still accumulate a substantial GIN index.

During cleanup, VACUUM may need to walk a large part of that index. The amount of heap cleanup and the amount of index-reading work aren’t necessarily proportional.

PostgreSQL 19’s streaming-read change makes that walk an interesting upgrade candidate. The expected benefit is easier to observe when PostgreSQL has to read index pages into its buffers, rather than finding everything there already.

That gave the experiment a specific question: does the PG18-to-PG19 difference change when the GIN index outgrows shared_buffers?

Environment Setup

I used three independent PG18/PG19 pairs on matched Azure Database for PostgreSQL Flexible Server deployments. Each database had a dedicated runner, and the six ca

[...]

All Your GUCs in a Row: session_preload_libraries
Posted by Christophe Pettus in pgExperts on 2026-12-02 at 02:00
The local_preload_libraries post ended by telling you to use session_preload_libraries instead. That advice stands. This post is the fine print, and there is more of it than you would expect for a parameter whose entire job is to call dlopen() on somebody’s behalf. The default is empty. The conte… (I consult on PostgreSQL through PGX Inc..)

How a 40 TB PostgreSQL Cutover Took One Night
Posted by Umair Shahid in Stormatics on 2026-12-01 at 16:06

A regulated payments company just moved more than 40 TB of production data onto a new EDB Postgres cluster. The cutover started at 2 AM local time. By morning, the application was back online, and the client’s team confirmed in writing that every post-cutover validation check had passed.

That night was quiet because of everything that happened in the months before it. In September I wrote about pushing this go-live date back on purpose, and about the playbook we use to de-risk a mission-critical migration. This post is the follow-up. It covers what we learned once the data got big, what actually set the timeline, and what the week after cutover looks like.

Timeline of a 40 TB PostgreSQL migration: weeks of replication sync with four date moves, a one-night cutover starting at 2 AM, and a week of hypercare, plus the two largest tables at 8.6 TB and 4.5 TB
Timeline of a 40 TB PostgreSQL migration: weeks of replication sync with four date moves, a one-night cutover starting at 2 AM, and a week of hypercare, plus the two largest tables at 8.6 TB and 4.5 TB

The biggest table sets the date

Here’s an important lesson for the project plan. On a large migration, your cutover date is set by your biggest tables.

This database had two giants: one table at 8.6 TB and another at 4.5 TB. Everything else was small by comparison. The bulk of the database could sync in days. Those two took weeks, and the cutover couldn’t happen until they were fully caught up. Because of nuances in the specific environment, a dump/restore wasn’t an option.

So the date moved. Four times in total. Each move was caused by something new we learned in a rehearsal. We weren’t willing to cut over on a guess.

If I could give one piece of advice to anyone planning a migration at this size, it’s this. Size your timeline from your largest table, not from the total. A 40 TB database made of a thousand 40 GB tables is a very different project from one where two tables hold a third of the data. Find your giants on day one, and plan around them.

Why waiting was cheap

Moving the date four times sounds expensive. In this case it cost almost nothing, and the reason is worth understanding.

The data moved through replication while the old system kept serving production. The clien

[...]

What Changes for SQL in PostgreSQL 19
Posted by Dimitri Fontaine on 2026-12-01 at 14:23

Postgres 19.0 was released on November 19. Two articles covered the beta here in September, Getting Ready for PostgreSQL 19 and Plan Advice in PostgreSQL 19. Before updating The Art of PostgreSQL for 19, we ran the queries it teaches on 19.0 and on 18.6, and read the final release notes against them. This article is what we found, limited to what Postgres 19 changes: 7 headline features withdrawn before the release, 11 changes that reach SQL you already wrote, about 20 new features, and an 8-step checklist for the upgrade.

The release-day posts mostly lead with REPACK, plan advice and ON CONFLICT DO SELECT. For SQL that already exists, the change with the most consequences is quieter: the planner now reads your NOT NULL constraints and rewrites queries with them.

Stop Fighting Synchronous Replication: Meet WAIT FOR LSN – Part 1
Posted by Jobin Augustine in Percona on 2026-12-01 at 08:02

WAIT FOR LSN in PostgreSQL 19, a 3-part series

  • Part 1: Stop Fighting Synchronous Replication: Meet WAIT FOR LSN (you are here)
  • Part 2: Hands-on with WAIT FOR LSN: a walkthrough for DBAs
  • Part 3: WAIT FOR LSN under load: numbers, tuning and two bugs I found in PostgreSQL 19.

If someone asks me what would be the biggest impactful feature in PostgreSQL 19, I don’t have any doubt in saying that it is WAIT FOR LSN from standby. PostgreSQL generates a new LSN (Log Sequence Number) wherever something is written to WAL. A facility to wait for LSN to reach standby is impactful because it can change the way applications are designed. It is the only feature in which I personally spend time and effort in testing and participating in hackers mailing lists with minor problems before the release of PostgreSQL 19.

A word of caution: You may start designing and developing your application around this feature. But I suggest waiting for PostgreSQL 19.1 before going for production, because a critical fix is not included in 19.0. The details, and a workaround for 19.0, are explained in Part 3 of this series.

For many years, whenever a customer wanted “the data should not be lost” or “the user must see what he just saved, even if the read goes to a replica”, the answer was mostly one: synchronous replication. And many of those customers came back to us later with a different problem: “the whole database froze”, “all commits are hanging”, “we had an outage because the standby went down”. With PostgreSQL 19, we finally have one more option. The application itself can decide when and where it wants to wait.

The content became too big for a single post, so I split it into three. In this first part, I will explain the problem, the feature, and how it can be used as a replacement for synchronous replication. Part 2 shows how DBAs can play with it using just psql, and the long history behind it. Part 3 has the numbers from my tests on the PostgreSQL 19.0 release, and the bugs I found on the w

[...]

All Your GUCs in a Row: server_version and server_version_num
Posted by Christophe Pettus in pgExperts on 2026-12-01 at 02:00
`server_version` and `server_version_num` look simple until you upgrade packages without restarting the server, or put a pooler in front of it. (I consult on PostgreSQL through PGX Inc..)

Exploring PostgreSQL 19: A Developer’s Guide to New Features – Part 1: INSERT ON CONFLICT DO SELECT
Posted by Deepak Mahto on 2026-11-30 at 18:54

Read time: ~8 minutes

PostgreSQL 19 finally lets INSERT hand back the row that already exists, no dummy update, no exception block, no second round trip.

PostgreSQL 19 was released on November 19, 2026. With it, I’m starting a new series: what’s new in PostgreSQL 19 primarily for application developers, the people writing SQL and PL/pgSQL every day, or supporting migrations to PostgreSQL.

Part 1 starts with the feature that removes a workaround almost every code base carries: INSERT … ON CONFLICT DO SELECT.

The Pattern Every Application Writes

Every application has a get-or-create:

  • Register a user by email
  • Find or create a tag
  • Resolve a customer reference arriving from an upstream feed

The ask is always the same. Give me the row — whether it was already there or not.

Until PostgreSQL 19, INSERT … ON CONFLICT couldn’t say that. DO NOTHING skips the row and returns nothing. DO UPDATE returns the row, but only by writing it again.

Before PostgreSQL 19: Three Workarounds, Three Compromises

Let’s create a sample table:


  
CREATE TABLE app_users (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
email text NOT NULL UNIQUE,
full_name text,
created_at timestamptz NOT NULL DEFAULT now()
);
INSERT INTO app_users (email, full_name)
VALUES ('deepak@dcg.com', 'Deepak Mahto');


Workaround 1: DO NOTHING, then SELECT


postgres=# INSERT INTO app_users (email, full_name)
VALUES ('deepak@dcg.com', 'Deepak M')
ON CONFLICT (email) DO NOTHING
RETURNING id, email, full_name;
id | email | full_name
----+-------+-----------
(0 rows)
INSERT 0 0

The row exists. RETURNING gives you nothing. So the application fires a second SELECT as two round trips, and a window between them where the row can change or disappear.

The one-statement version wraps it in a CTE:


  
WITH ins AS (
[...]

PostgreSQL’s Best Kept Secret: COPY
Posted by Chris Travers in Stormatics on 2026-11-30 at 13:09

A customer asked me recently how to optimize performance writing to PostgreSQL from a Flink pipeline. Without hesitation, I recommended using PostgreSQL’s COPY interface. The result was approximately twice the throughput. This post explores what makes COPY different, and when you should consider using it.

To be fair, my recommendation hadn’t come out of nowhere. I had previously had experience building high performance PostgreSQL applications on large datasets using COPY and have significant experience in this corner of PostgreSQL usage.

Key Takeaways

  • Moving a customer’s Flink pipeline from INSERT to COPY roughly doubled its write throughput.
  • COPY sets up a single stream: the statement is parsed once, rows are sent one line at a time into one running insert, and round trips happen only when the stream starts and finishes.
  • The gain grows with network latency, so COPY suits large loads in a single run. For small record sets, or where simple code matters more, INSERT is still the better fit, and COPY has no equivalent of UPDATE.
  • COPY TO streams query results back one line at a time, with no limit on rows and no need to hold the whole result in client memory, but errors arrive inside the stream.
  • Reading or writing server-side files, and COPY FROM PROGRAM, need superuser access and are not offered on major managed services, so most applications should use STDIN and STDOUT.

COPY: A pre-SQL Legacy

In 1994, the Postgres project adopted the SQL query language with a full replacement released in 1995. The codebase was already a decade old at the time, and previously used a query language called PostQUEL (hence the client library being named libpq).

Like all query languages, PostQUEL had its own quirks and ways of working and its own annoyances and failure modes. As SQL emerged as the industry standard, PostQUEL support was dropped in favor of the former. E

[...]

Introducing CNPG Extensions Catalog
Posted by Jeremy Schneider on 2026-11-30 at 13:05

Postgres is an extensible platform, not just a database. I’ve been cooking this year on a side project with Postgres extensions and Kubernetes – finally ready to share what I’ve built.

The CNPG Extensions Catalog is over a hundred extension images for CloudNativePG with inspectable SBOMs, rapid updates (driven by renovate with automerge when tests pass), a framework for building extensions from source when it makes sense, and a website to browse the catalog.

https://cnpg-extensions.github.io

Before we get into the controversial bits, here’s a 5-minute intro. Some history of extensions on kubernetes, licensing reasons for an independent project, a demo of catalog install and automated upgrades.

Background Reading

The best general collection of links I’ve seen is [the PGXN_v2 page on the Postgres wiki] – especially the blog posts, presentations and ecosystem summit.

Abigale Kim’s VLDB publication deserves a special callout: [Anarchy in the Database: A Survey and Evaluation of Database Management System Extensibility]

A few recent blogs give additional perspective:

Controversial Bits

First, it’s important to understand how the versioning works. You choose the Postgres Major Version (18 or 19) and the Debian Base Image (trixie or bookworm). You receive updates only within your Postgres and Debian version. Remember to check for locale/collation changes when switching to a different Debian base image. (And set your database default to Postgres builtin collation!)

Topic 1: Are unattended upgrades safe? Or are they too risky?

People generally agree on the importance of staying up-to-date. The offi

[...]

November 19 - GTA VI and PostgreSQL 19, same day yet different freedom
Posted by Jan Wieremjewicz in Percona on 2026-11-30 at 11:00

November 19, 2026, was a pretty unusual day for software releases.

Two highly anticipated products finally reached general availability. Both had been delayed, both had people eagerly awaiting their arrival, and both have passionate communities that have followed their development.

One was Grand Theft Auto VI. The other was PostgreSQL 19.

Now, I realize that the overlap between people eagerly waiting for a new PostgreSQL release and those taking a day off to play GTA might not be huge. But I happen to be in that intersection.

All Your GUCs in a Row: server_encoding
Posted by Christophe Pettus in pgExperts on 2026-11-30 at 02:00
`server_encoding` doesn't control the server—it reports each database's encoding, and a cluster can hold multiple different ones. (I consult on PostgreSQL through PGX Inc..)

PGConf.eu 2026 - Valencia, Frédéric's feedback
Posted by Frederic Delacourt in Data Bene on 2026-11-30 at 00:00

Arriving at PGConf.eu

Well, the trip to Valencia was rather chaotic: a cancelled flight and so on…

So, I arrived on Wednesday (October 21st) around 1 PM. Obviously I missed some talks. I almost missed lunch too; at that hour the troughs were rather empty and the desserts had long since deserted the tables.

Talks and talks

Wednesday

Almost all of the talks I intended to attend were tagged “internals”, except for Zooming in on OOM: a deep dive into Postgres and Linux memory.
This talk, by Oleksii Kliukin and Dimitris Sideris of Tiger Data, was interesting and brought out a new way to limit Out Of Memory (OOM) occurrences, which is particularly good for PostgreSQL over Kubernetes. While the slides have not been published yet, you can see a previous version from Swiss PGDay 2026 here. The solution caps allocations through an LD_PRELOAD library, with the limit computed from the cgroup ceiling, shared memory footprint and kernel overhead, and pushed at runtime by Patroni hooks and a Postgres extension — no restart. As far as I remember, a new memory allocator controller was built, which does not appear in the Swiss presentation.

I attended The anatomy of PostgreSQL row lock.
Laurenz is known as the author of oracle_fdw, which allows fetching data directly from an Oracle database into PostgreSQL. The talk was nice but too short. It covered the row-level lock modes, how PostgreSQL uses KeyShareLock to maintain foreign key consistency, how the locks are stored in the tuple header, and how MultiXacts aggregate several lockers on the same tuple.
Later, Laurenz, Jean-Paul Argudo and I talked about how to help the PostgreSQL community by responding to people’s problems.

I attended Silver Sponsor Lightning Talks to support Ayoub Kazar, my colleague at Data Bene.
He presented a talk on SQL/PGQ. PGQ stands for Property Graph Queries. He was the actor, I was the camera operator. Special congrats to him for his first talk at PGConf. He faced technical issues (video signal disruptions due to t

[...]

Peer authentication failed for user "postgres": fixes
Posted by Chris van Eijk on 2026-11-29 at 22:30
PostgreSQL's Peer authentication failed, measured on the Debian and Ubuntu packages: why sudo -u postgres works, -h localhost, pg_ident.conf and psycopg2.

All Your GUCs in a Row: serializable_buffers
Posted by Christophe Pettus in pgExperts on 2026-11-29 at 02:00
PostgreSQL's `serializable_buffers` controls the cache for serializable transaction metadata. (I consult on PostgreSQL through PGX Inc..)

Upserts, partitions, triggers and string matching on PostgreSQL 18
Posted by Hollis Varden on 2026-11-29 at 00:00

Twenty-one small measurements this week, mostly about writing rows and matching text. Two of them went the other way from what I expected.

Setup

PostgreSQL 18.6, built from source, default settings (work_mem 4MB, shared_buffers 128MB). The database collation is C. MacBook Air M5, 24 GB RAM. Same machine as my previous posts.

Query times are EXPLAIN (ANALYZE, BUFFERS, TIMING OFF) execution time, run several times in one session, first run thrown away, median of the rest (3 unless I say otherwise). Inserts, upserts and MERGE ran inside a transaction that I rolled back, so each run starts from the same table. Where I give seconds, that is wall clock from psql, and it includes connecting, which took 0.005 s for SELECT 1. Buffers are from the top plan node. Sizes are decimal MB. Parallel workers were off unless I say otherwise.

Upserts

A 1,000,000-row table with an int primary key. 100,000 incoming rows, of which 50,000 already exist.

Statement Time
INSERT ... ON CONFLICT DO NOTHING 71.3 ms
INSERT ... WHERE NOT EXISTS (...) 82.6 ms
INSERT ... ON CONFLICT DO UPDATE 153.8 ms
MERGE (update matched, insert the rest) 165.45 ms

The NOT EXISTS form is not the same thing under concurrent inserts: two sessions can both see "not there" and one of them fails on the key. I only ran one session.

An upsert that changes nothing

Next I sent 50,000 rows that all exist and carry the same value already. These runs were committed, with a CHECKPOINT before each.

Statement WAL Time
ON CONFLICT
[...]

Postgres 19 Upgrade from Postgres 15
Posted by Ryan Lambert on 2026-11-28 at 05:01

Postgres 19 was released in November 2026 and once again I am planning production upgrades. This post has a few notes about my own upgrade process and highlights a few exciting new features to explore. This post does not explain how to perform the actual upgrade.

My own process is a bit unusual because I typically go through major version upgrades either annually or every other year at most. I upgraded to Postgres 15 shortly after it was released in 2022 and intentionally skipped Postgres 16 because I knew I would be occupied preparing for a full-day pre-conference session on PostGIS for PASS 2023. I ultimately skipped upgrades to 17 and 18 because... well, I was busy! However, this leaves me with less than a year to upgrade since Postgres 15 will become End of Life in November 2027.

All Your GUCs in a Row: send_abort_for_crash and send_abort_for_kill
Posted by Christophe Pettus in pgExperts on 2026-11-28 at 02:00
PostgreSQL 16 added two parameters that intentionally make crashes worse—by writing core files from every dying process instead of just one. (I consult on PostgreSQL through PGX Inc..)

A morning well spent nurturing the Talk Solicitation Program
Posted by Ashutosh Bapat on 2026-11-27 at 05:38

 

A morning well spent nurturing the Talk Solicitation Program

A morning well spent nurturing the Talk Solicitation Program

At PGConf.dev, we have started the Talk Solicitation Program (TSP) with a simple idea. As conference attendees, we all have talks we wish someone would give. Why not make those wishes visible, so that potential speakers can see what the audience is interested in, while the program committee gets another signal about what attendees would value?

The Talk Solicitation Program is an experiment in doing just that. Audience members can request topics they would like to hear about, support requests from others, and discuss how an idea might develop into a useful conference talk.

This morning, I checked the TSP topic requests to see how things were taking shape. Beyond the example topic we had seeded, there are now real topic requests from Nazır Bilal Yavuz, Floor Drees, and Cornelia Biacsics. Thank you for being among the first to participate and help us get this going! Even better, people have already started upvoting those requests.

That made me curious: who has upvoted them? GitHub Discussions shows the number of upvotes, but I couldn't find a way to see who cast them. So I asked GitHub Copilot whether I was missing something.

A few prompts later, Copilot led me to an existing GitHub Community discussion asking for exactly this capability. The discussion was opened back in 2021, and the capability still isn't there. I added my perspective on why it would be useful for upvotes to be visible more broadly, then upvoted the original request and some of the comments that resonated with me.

There was a nice bit of symmetry in that. I had started the morning looking at how people were participating in one community discussion, and ended up participating in another in much the same way: find something you care about, upvote it, discuss it, and add your perspective.

And that is exactly what we hope you will do with TSP. If you're thinking about attending PGConf.dev

[...]

All Your GUCs in a Row: segment_size
Posted by Christophe Pettus in pgExperts on 2026-11-27 at 02:00
PostgreSQL divides large tables into 1GB segment files, but the server has no authoritative record of how many segments exist. (I consult on PostgreSQL through PGX Inc..)

Galène, part 2: tests passed, old data repaired
Posted by Dan Langille on 2026-11-27 at 00:02
In Galène: fixing double-encoded port files I described how FreshPorts had been storing UTF-8 port files double-encoded, so that www/galene's Makefile showed Galène instead of Galène. That post covered the fix, how I planned to test it, and how I plan to repair the text that is already wrong. This post is how the tests […]

One tree, two major versions: adapting pg_orca to PostgreSQL 19
Posted by Jianghua yang on 2026-11-27 at 00:00
How pg_orca added PostgreSQL 19.0 support in 13 #if guards across 6 files — without forking a branch — plus native SQL:2003 IGNORE NULLS support and the real optimizer bugs uncovered by PG 19's regression suite.

ANALYZE on a mostly-NULL column
Posted by Radim Marek on 2026-11-26 at 21:00

One of the production databases I snapshot with dryrun has a 172 GB table that autovacuum analyzes about three times a day. dryrun keeps the planner statistics from every snapshot, so I could line up what pg_stats said about one of its columns over six days in November:

736, 899, 948, 520, 659, 461, 1087, 299

That's n_distinct, the planner's guess at how many different values the column holds. The table grows by a few percent a week, and the guess moved by more than a factor of three. Over sixty days it also went negative 14 times. The column is NULL in 99.8% of the rows.

The cause is one if in analyze.c and the birthday problem, and both show up on a lab table where every row can be counted.

Two tickets in a thousand

The lab is a support desk. Tickets get escalated to an agent now and then, and for the other 99.8% of them escalated_to stays NULL:

CREATE TABLE agents (
    id      int PRIMARY KEY,
    team_id int NOT NULL,                       -- 20 teams of 100
    name    text NOT NULL
);

CREATE TABLE tickets (
    id           bigint PRIMARY KEY,
    customer_id  int NOT NULL,
    status       text NOT NULL,
    created_at   timestamptz NOT NULL,
    escalated_to int                            -- agents.id, set on 0.2% of tickets
);

CREATE INDEX tickets_escalated_to ON tickets (escalated_to);
 tickets  | escalated | agents_used | tickets_per_agent |  heap
----------+-----------+-------------+-------------------+--------
 10000000 |     20032 |        2000 |              10.0 | 575 MB

agents_used is the number n_distinct should come out as. tickets.customer_id points at a customers table of 200,000 rows and is here as the control, a column in the same table with no NULLs.

Everything was captured on PostgreSQL 18.7 (the postgres:18 image) with autovacuum off, so only my own ANALYZE touches the statistics. setup.sql seeds random(), so the data comes out the same every time, but the seed doesn't reach ANALYZE (three sessions that each ran SELECT setseed(0.1); ANALYZE tickets; got -0.0

[...]

Contributions for week 46
Posted by Cornelia Biacsics in postgres-contrib.org on 2026-11-26 at 12:12

PGConf.Asia 2026 happened from 17-18 November 2026, organized by

  • Grant Zhou
  • Joanne Huang
  • Bruce Momjian
  • Hari Kiran
  • Julyanto Sutandang
  • Gavin Lyu
  • Tatsuro Yamada
  • Ioseph Kim
  • Mark Wong
  • Ashish Mehra
  • Guohua Bai
  • Henry Law

Speakers:

  • Agnafan Fortin
  • Ajit Gadge
  • Amelia Khoirurrahma
  • Atsushi MITANI
  • Avinash Vallarapu
  • Bruce Momjian
  • Charly Batista
  • Chris Travers
  • Darafei Praliaskouski
  • Gabriele Quaresima
  • Hari Kiran
  • Hari Prasad
  • Haritabh Gupta
  • Ilia Evdokimov
  • Ioseph Kim
  • Jaesol Shin
  • Jian He
  • John Naylor
  • Josef Machytka
  • Julyanto Sutandang
  • Kangil Lee
  • Koichi Suzuki
  • Koji Annoura
  • Lucky Haryadi
  • Mahadevan Ramachandran
  • Manash Kalita
  • Matteo Durighetto
  • Max Yang
  • Mayuresh
  • Michael Paquier
  • Nawaz Ahmed
  • Neeta Goel
  • Nikhil Chawla
  • Nishchay Kothari
  • Prafulla Prakash Ranadive
  • Qun Lily Li
  • Roneel Kumar
  • Ruohang Feng
  • Sagar Shedge
  • Salma Elsayed
  • Shashikant Shakya
  • Shinya Kato
  • Shreya Radhakrishna Aithal
  • Shuntian Jiao
  • Suhailie
  • Surya Sree Bathini
  • Takahiro Kobayashi
  • Vinay Kumar Dumpa
  • Vishal Sawale
  • Xuneng Zhou
  • YoungXie

Lightning Talk Speakers:

  • Abhas Mittal
  • Albert Chen
  • Andrei Salnikov
  • Gabriele Quaresima
  • Hari Kiran
  • Ioseph Kim
  • Julyanto Sutandang
  • Koala Yeung
  • Mahadevan Ramachandran
  • Mark Wong
  • Mayuresh

Program Committee:

  • Bruce Momjian
  • Gavin Lyu
  • Hari Kiran
  • Tatsuro Yamada
  • Mark Wong
  • Julyanto Sutandang

Code of Conduct Committee:

  • Mark Wong
  • Ashish Mehra
  • Julyanto Sutandang
  • Grant Zhou
  • Joanne Huang
  • Stacey Haysler
  • Amelia Khoirurrahma

Social Media Team:

  • Julyanto Sutandang
  • Joanne Huang
  • Fawei Zhao
  • Guohua Bai

Volunteers:

  • Joanne Huang
  • Cary Huang
  • Koala Yeung

Conference (IT) System:

  • Cary
[...]

All Your GUCs in a Row: search_path
Posted by Christophe Pettus in pgExperts on 2026-11-26 at 02:00
PL/pgSQL functions inherit their caller's search_path, but autovacuum, pg_restore, and logical replication see an empty one—a silent recipe for index… (I consult on PostgreSQL through PGX Inc..)

Barriers, Volatile, and Atomics: How PostgreSQL Orders Memory Accesses
Posted by Jan Kristof Nidzwetzki on 2026-11-26 at 00:00

In the PostgreSQL source code, you will find memory and compiler barriers in various places like pg_memory_barrier(), pg_write_barrier(), pg_read_barrier(), or pg_compiler_barrier(). These macros are needed to ensure that the compiler and CPU do not reorder memory accesses in a way that would break the correctness of the code. Closely related are volatile variables and atomic operations, which you will find in the source code as well.

PostgreSQL uses a process-based architecture, where a separate process handles each database connection. These processes use shared memory to communicate, allowing multiple processes to read and write values simultaneously. On multi-processor systems, these processes can run on different CPU cores, each with its own caches.

Intuitively, you would expect that if one process writes two values to shared memory, another process reading them would see the same order. But that’s not always the case, and it can cause tricky bugs that are hard to track down. To make matters worse, code that has run fine on x86 for years might suddenly break on ARM, a common platform for PostgreSQL, like AWS Graviton servers or Apple Silicon machines.

First, we’ll look at why compilers and CPUs reorder memory accesses (things like instruction scheduling, CPU pipelines, caches, store buffers, invalidate queues, and the memory models of x86 and ARM) and what barriers can prevent this. Then, we’ll go over PostgreSQL’s barrier macros with examples and explain how locks, atomic operations, and volatile fit in.

Running Example

Imagine the following code, which is executed by two different processes. These processes communicate through shared memory initialized to zeros. So, initially, shared->tuples is 0 and shared->done is false. The writer runs on CPU 1, and the reader runs on CPU 2.

typedef struct SharedState
{
    int  tuples; /* Initialized to 0 */
    bool done;   /* Initialized to false */
} SharedState;

/* Executed by CPU 1 */
void writer(SharedState *shared, int pages, int tupl
[...]

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.