Latest Blog Posts

Exploring PostgreSQL 19: A Developer’s Guide to New Features – Part 3: IGNORE NULLS in Window Functions
Posted by Deepak Mahto on 2026-12-04 at 13:03

Read time: ~7 minutes

“Give me the last known value” is one line of English. Until PostgreSQL 19, it was two levels of window functions.

This is Part 3 of my series on what’s new in PostgreSQL 19 for application developers. Part 1 covered INSERT … ON CONFLICT DO SELECT, and Part 2 the faster SELECT expression INTO variable in PL/pgSQL.

This one is a small clause with a long history: IGNORE NULLS for window functions.

The Last Known Value Problem

Data with gaps is everywhere:

  • A price feed that only sends a value when it changes
  • A sensor that drops readings
  • A status history where most rows don’t touch the status column

The report always asks the same thing. For every row, show the last value we actually knew.

Let’s create a small price feed with gaps:

CREATE TABLE price_ticks (
  symbol  text,
  tick_at timestamptz,
  price   numeric
);

INSERT INTO price_ticks VALUES
 ('DCG', '2026-11-20 09:15', 101.50),
 ('DCG', '2026-11-20 09:16', NULL),
 ('DCG', '2026-11-20 09:17', NULL),
 ('DCG', '2026-11-20 09:18', 102.25),
 ('DCG', '2026-11-20 09:19', NULL),
 ('DCG', '2026-11-20 09:20', 101.75);

Before PostgreSQL 19: The Running-Count Trick

The obvious attempt, lag() and last_value(), just hands the gaps back:

postgres=# SELECT to_char(tick_at,'HH24:MI') AS tick, price,
                  lag(price) OVER w        AS prev_price,
                  last_value(price) OVER w AS last_value
           FROM price_ticks
           WINDOW w AS (PARTITION BY symbol ORDER BY tick_at)
           ORDER BY tick_at;
 tick  | price  | prev_price | last_value
-------+--------+------------+------------
 09:15 | 101.50 |            |     101.50
 09:16 |        |     101.50 |
 09:17 |        |            |
 09:18 | 102.25 |            |     102.25
 09:19 |        |     102.25 |
 09:20 | 101.75 |            |     101.75
(6 rows)

Looks close, right? It isn’t. lag() looks exactly one row back even if that row is NULL. last_value() returns the current row’s value, NULL

[...]

Hacking Workshop for January 2027
Posted by Robert Haas in Databricks on 2026-12-04 at 12:15

I’m so pleased to announce that Bruce Momjian will be joining us in January to discuss his talk, What’s Missing in Postgres?, given at 2026.pgconf.dev. If you’re interested in joining us, please sign up using this form and I will send you an invite to one of the sessions. Sign up now: invites will be sent December 22nd.

Read more »

Contributions for week 47
Posted by Cornelia Biacsics in postgres-contrib.org on 2026-12-04 at 07:54

On 24 November, PGConf Poland 2026 took place.

Organizing Committee:

  • Alicja Kucharczyk
  • Andreas Scherbaum
  • Jan Wieremjewicz
  • Oleksii Kliukin
  • Taras Klioba
  • Pavlo Golub

Program Committee:

  • Adam Wołk
  • Andreas Scherbaum (non voting)
  • Hubert "depesz" Lubaczewski
  • Svitlana Lytvynenko

Speakers:

  • Bruce Momjian
  • Gülçin Yıldırım Jelinek
  • Alicja Kucharczyk
  • Alexander Kukushkin
  • Polina Bungina
  • Aditya Surishetti
  • Avinash Vallarapu
  • Piotr Kolodziej

On 24 November the [Meetup PostgreSQL Lille]](https://www.meetup.com/meetup-postgresql-lille/events/317087145/) met, organized by Yoann La Cancellera.

Speakers:

  • Nathalie Reslou
  • Nathan Leclercq

On 26 November the PostgreSQL User Group NRW met, organized by Dirk Krautschick and Alexander Wirt.

Speakers:

  • Michael Banck
  • Mathis Rudolf
  • Jan Karremanns

From 26-27 November, WAWTECH took place. Devrim Gündüz and Pavlo Golub delivered a PostgreSQL talk.

Postgres Booth staffed by:

  • Alicja Kucharczyk
  • Denys Holub
  • Devrim Gündüz
  • Pavlo Golub
  • Sergey Chehuta
  • Taras Kloba

On 27 November, PostgreSQL Conference Japan 2026 happened.

Speakers:

  • Akane Maruoka
  • Risa Tanaka
  • Atsushi Takimoto
  • Kohei Overseas
  • Yumi Oshima
  • Tomoaki Otsuka
  • Haruto Okamoto
  • Yasuhiro Horimoto
  • Atsushi Mitani

Tutorials by:

  • Ayumi Ishii
  • Noriyoshi Shinoda
  • Shinya Kato
  • Kanata Iguchi

All Your GUCs in a Row: shared_buffers, Part 1
Posted by Christophe Pettus in pgExperts on 2026-12-04 at 02:00
PostgreSQL's clock sweep algorithm decides what pages to evict from shared buffers, but the machinery matters more than the number. (I consult on PostgreSQL through PGX Inc..)

AWS RDS Proxy Session Pinning: How SET, Prepared Statements, and Advisory Locks Reduce Connection Reuse
Posted by Kiran Sabne on 2026-12-04 at 00:00

If database connections jump after a deploy while query execution times stay flat, check whether RDS Proxy can still reuse its backends. A client normally borrows a backend for a transaction. When the proxy detects session state that must persist, it reserves that backend for the client until the client disconnects. An idle application connection can then occupy a database connection, even after COMMIT.

Measure pinned connections and borrow pressure

In CloudWatch, open Metrics → RDS → Per-Proxy Metrics. Choose the same ProxyName dimension for every series in the table and use a 60-second period. Use Sum for the counts in each minute because AWS publishes values from the underlying proxy instances. Use Average for borrow latency, which AWS reports in microseconds. Plot matching windows before and after the deployment, with comparable client traffic. AWS metric definitions and dimensions.

Metric Statistic What it tells you
DatabaseConnectionsCurrentlySessionPinned Sum Backends reserved because a client changed session state. This is a gauge, so a sustained value of 40 means roughly 40 occupied backends per sample, rather than 40 new pin events per minute.
DatabaseConnections Sum Backend connections held by the proxy, including connections being set up. Use it as the denominator for the pinned share.
DatabaseConnectionsCurrentlyBorrowed Sum Backends assigned to clients. Compare it with pinned and in-transaction counts on the same timeline.
DatabaseConnectionsCurrentlyInTransaction Sum Backends in open transactions. A sus
[...]

Capitole du Libre 2026: how to enjoy an event while caring for a booth?
Posted by Anne-Laure Michel in Data Bene on 2026-12-04 at 00:00

Capitole du Libre 2026: how to enjoy an event while caring for a booth?

The Capitole du Libre is an institution within the French Free Software community. It’s one of the biggest events for free software enthusiasts, by free software enthusiasts, along with JDLL (Journée du Logiciel Libre/Day of free software) in Lyon. These are the typical places where Data Bene likes to contribute: being there, interacting with people, challenging and diffusing ideas. We were a “gold sponsor” at Capitole du Libre this year.

This status entitled us to a standing table and space for our banners. Three of us were there: Cédric, our CEO, and Catherine, our Operations and Administration Manager, who travelled halfway across France to join us, and I, the event and training manager!

Catherine folding boxes in our booth

How to follow the program with all this?

I think the answer is: by not getting absorbed in all the super interesting conversations with the people who come to talk to you. I had carefully prepared my schedule with all my conferences I’m interested in, but in the end I only attended two of them. That’s also what makes this type of event for enthusiasts so appealing.

The first conference I attended was very interesting in terms of format. It was the Design Clinic, presented by Natouille and Emilie Nguyen Van Yen for Silex, a software used to easily and freely interface CSS/HTML with a CMS. The two designers shared their feedback on the homepage and the usability of the tool. They suggested improvements to readability (simplified content, a more fluid layout, etc.). They also shared design techniques that, in my opinion, should be applied everywhere:

  • Card sorting, which consists of asking several groups of users with different profiles to collectively agree on the categorization of cards representing the site’s functionalities, and to explain their choices.
  • Tree testing, which consists of giving tasks to people carrying out the test of a tree structure to determine the ergonomics of the content and the ease of na
[...]

ColdFront in London: PostgreSQL Meetup & Iceberg Europe Community Meetup
Posted by Jimmy Angelakos on 2026-12-03 at 16:22

Jimmy Angelakos smiling and holding a handheld microphone, with one hand on a laptop, in front of a Fresha backdrop at the Iceberg Europe Community Meetup in London

As we're gearing up for the inaugural 1.0.0 release of pgEdge ColdFront, this is a good moment to show what it does. ColdFront transparently tiers PostgreSQL data to Apache Iceberg: your recent rows stay in Postgres, older rows move automatically to low-cost object storage in an open format, and your application keeps querying and updating all of it through the same tables, with the same SQL. It can also keep a table entirely in Iceberg from the first row, with PostgreSQL as the way in for all your reads and writes.

I presented it at two meetups in London in October, so this post has the recording of the talk, the slides, and a live demo that you can run yourself.

What ColdFront does

Keeping years of history in your primary database is expensive. The usual alternative is to move the older data out to a separate system, but then your application can no longer reach it without a pipeline in between. ColdFront gives you a better option. As data ages past a threshold you set, it moves to object storage and remains part of the database, so there is no export pipeline to build or maintain, and no application code to change.

It has two modes behind one SQL interface. Tiered mode is the one described above, with recent rows in Postgres and older rows in Iceberg. In decoupled mode, a table lives in Iceberg from the first row: every write goes straight to object storage, Postgres holds only a thin view over it, and you scale out by adding PostgreSQL nodes.

The main features:

  • A cold table is partitioned the same way as its hot counterpart, so a query with a time filter skips the partitions outside it without reading any of their data, and you get fast analytical queries courtesy of DuckDB.
  • The cold tier accepts INSERT, UPDATE and DELETE, as well as COPY and MERGE (on PostgreSQL 17 and later).
  • Iceberg tables created by other engines, such as Apache Spark or Trino, can be adopted and read through Postgres, and those engines can read ColdFront's cold tier in turn, because it is standar
[...]

New Blog, New Contribution Statistics
Posted by Robert Haas in Databricks on 2026-12-03 at 12:51

As many of you know, I’ve been doing mostly-annual blog posts about code contribution statistics for many years now, which has quite frankly been an awful lot of work. It got a lot easier a few years ago because PostgreSQL commit messages began crediting people via trailers rather than free-form text, which meant that a lot of the counting up of who did what could be automated. However, it was still pretty time-consuming.

Read more »

Back Up a PostgreSQL Cluster: pg_dump, pg_dumpall and Restore
Posted by Frank Glück on 2026-12-03 at 11:10
Back up a PostgreSQL cluster: pg_dump per database, pg_dumpall for roles, a script for all databases, single-database restore and the limits of dumps.

Stop Fighting Synchronous Replication: Meet WAIT FOR LSN – Part 3 – numbers, tuning and bugs
Posted by Jobin Augustine in Percona on 2026-12-03 at 09:19

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

In Part 1, I explained how WAIT FOR LSN lets the application decide when to wait for a standby, instead of making every commit wait as synchronous replication does. In Part 2, we played with it using psql.

A few psql commands can show that a feature works. They can’t show what happens with thousands of transactions per second. So I wrote a small load generator and ran several hundred thousand waits against PostgreSQL 19.0. In this final part, I will share:

  • how the demo application works,
  • the throughput, latency and read-your-writes numbers against synchronous replication,
  • two rare stall bugs which came up during this testing, their status in 19.0, and a workaround for the one which is not fixed yet.

That last point is also why I suggested in Part 1 to wait for PostgreSQL 19.1 before going to production.

The demo application

All the numbers below come from a small Rust program I wrote for this evaluation (waitforlsn). It is a closed-loop load generator that runs one of two modes:

  • –mode sync is the baseline: commit on the primary, done. Optionally it fetches the LSN and reads the row back from the standby (–verify) to show what happens without a wait.
  • –mode waitfor is the new pattern: async commit on the primary, then WAIT FOR LSN on the standby.

How it works:

  • It is built on tokio and deadpool-postgres, and uses two separate connection pools: one to the primary, one to the standby, sized separately (–primary-pool, –standby-pool).
  • Each worker task does: get a primary connection →
[...]

How to investigate a slow PostgreSQL database: six checks, tested on PostgreSQL 18
Posted by fahri cap on 2026-12-03 at 09:00

“The database is slow” is a symptom with about six common causes, and they need different fixes. Adding memory does nothing for a missing index. An index does nothing for a query stuck behind a lock. This article gives an order of checks for a slow PostgreSQL database, and for each one shows what the diagnostic looks like when that cause is present.

Every output below comes from a lab we ran on 3 December 2026: PostgreSQL 18.7 in Docker, a small shop database with 100,000 customers and 3 million orders, and one deliberate fault per step. The lab is one laptop with small tables, so read the numbers as direction, not as timings to expect on your system. You can download the lab and run it yourself in about ten minutes.

99.8%of database time spent in one statement
47,696buffers read per call before the index, 23 after
12 severy query on a table waited behind one ALTER TABLE
6xtable size after five updates without vacuum

The short answer

  • Start with what is running now (pg_stat_activity): a lock queue looks like a slow database and no amount of tuning fixes it.
  • Then ask where the time went (pg_stat_statements). In our lab one statement took 99.8% of it.
  • Read the plan of that statement with EXPLAIN (ANALYZE, BUFFERS) and look at buffers and rows removed, not only at the time.
  • Only then look at settings: sorts spilling to disk, dead rows,
[...]

Exploring PostgreSQL 19: A Developer’s Guide to New Features – Part 2: SELECT expression INTO in PL/pgSQL
Posted by Deepak Mahto on 2026-12-03 at 05:17

Read time: ~7 minutes

In PL/pgSQL, SELECT expr INTO v and v := expr do the same thing. Until PostgreSQL 19, one of them was about 5x slower.

This is Part 2 of my series on what’s new in PostgreSQL 19 for application developers. Part 1 covered INSERT … ON CONFLICT DO SELECT. [part1]

This one has no new syntax at all. Your code doesn’t change. It just gets faster, if you write PL/pgSQL the way most migrated code is written.

The Line Every Converted Procedure Has

Open any PL/pgSQL code base that came from Oracle or SQL Server. You’ll find lines like these:


  
SELECT clock_timestamp() INTO v_now;
SELECT v_total + v_line_amount INTO v_total;
SELECT upper(trim(p_code)) INTO v_code;

They come from habits that make sense in the source database. Oracle developers write SELECT … INTO … FROM DUAL, and once FROM DUAL goes, SELECT … INTO stays. As the PostgreSQL 19 commit puts it, users coming from SQL Server and T-SQL “are used to writing SELECT … INTO” too.

In PL/pgSQL, every one of those lines could have been written as an assignment:


  
v_now := clock_timestamp();
v_total := v_total + v_line_amount;
v_code := upper(trim(p_code));

Same result. Very different cost.

Before PostgreSQL 19: Same Logic, 8x the Time

Let’s create two functions that do exactly the same work, One with assignment, one with SELECT … INTO:


  
CREATE OR REPLACE FUNCTION bench_assign(n int)
RETURNS numeric LANGUAGE plpgsql AS $$
DECLARE
v numeric := 0;
i int;
BEGIN
FOR i IN 1..n LOOP
v := v + i * 2;
END LOOP;
RETURN v;
END $$;
CREATE OR REPLACE FUNCTION bench_select_into(n int)
RETURNS numeric LANGUAGE plpgsql AS $$
DECLARE
v numeric := 0;
i int;
BEGIN
FOR i IN 1..n LOOP
SELECT v + i * 2 INTO v;
END LOOP;
RETURN v;
END
[...]

All Your GUCs in a Row: session_replication_role
Posted by Christophe Pettus in pgExperts on 2026-12-03 at 02:00
session_replication_role = replica disables foreign keys and triggers—useful for replication, dangerous for bulk loads if you forget to validate constraints… (I consult on PostgreSQL through PGX Inc..)

The day PostgreSQL stood still
Posted by Zsolt Parragi in Percona on 2026-12-03 at 00:00

I love statistics, and I didn’t stop at the 19 release numbers: I continued looking, and this time, I’d like to talk about feature development. Or more precisely, the lack of it.

Committer messages per month by thread type, Jul 2023 to Nov 2026: feature threads shrink and fix threads take over after Jul 2026

The 20 release has disturbingly few features so far. We could say that’s normal, what do I expect, it’s only 2 weeks after the 19 GA.

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

[...]

Can numeric be made faster in a PostgreSQL minor release?
Posted by Andrei Lepikhov on 2026-12-01 at 14:36

In the previous article, I looked at the strengths and weaknesses of the numeric type. A significant part of the extra CPU and RAM usage you see comes from numeric values being stored in variable-length fields and requiring extra memory allocation. When this happens often, for example, with many input numbers, sorting, or lots of groups in GROUP BY, the difference becomes clear, can cause disk spilling and hurt performance.

However, real systems usually bound the size and the required precision of their operations, right? So it makes sense to implement a «fast path» for a common limited case like numeric(18,4). Here I describe several improvements that may interest the PostgreSQL community and could, perhaps, be extended to other data types.

All the optimisations below follow the same scheme. First, using the value's header and without touching the digits, we decide whether the value qualifies for the fast path. If it does, we compute the answer the short way — without allocations or full unpacking. If not, we pass the value to the existing code, which stays as it was.

Two properties follow from this. The result matches the old code bit for bit — down to the hashes used by hash indexes and partitioning machinery. The storage format does not change, and there are no new GUCs, so nothing needs to be enabled. The only price is the check at the entrance, and that check is the main source of potential regressions.

Contents

Necessary details on the numeric format

PostgreSQL operates on the Numeric structure, which has a 4-byte header and data aligned in memory. However, because its storage format is based on the varlena structure, numeric values are usually stored on disk in a co

[...]

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

[...]

PostgreSQL Monitoring Is Not the Same as Understanding an Incident
Posted by Kiran Kambale in Cybertec on 2026-12-01 at 04:00

Why should every database engineer be asking one question after the alert fires: what actually happened?

Most of the production incident ends the same way. The graphs turn green, the alert resolves, the chat channel goes quiet. Then someone asks the question that matters most:

"What actually happened?"

Most teams are very good at detecting problems. Far fewer are good at answering that question. This post is about the gap between the two, why it exists, and how we can start closing it.

Monitoring tells you that. Investigation tells you why.

Modern PostgreSQL environments generate enormous amounts of operational data: metrics, logs, statistics views, wait events, alerts. Monitoring systems are excellent at one job: telling you something needs attention.

But an alert is a starting point, not an explanation. Consider a production application that suddenly slows down. The dashboard shows higher query times, some sessions waiting, a few transactions open longer than expected. The engineer now has to reconstruct a story:

  • What happened before the slowdown started?
  • Which sessions and queries were involved?
  • Was one transaction blocking others?
  • What changed between normal behaviour and the incident?
  • What evidence supports the suspected cause, and what is only an assumption?

No single metric answers these. They need context, correlation and evidence.

The core problem: evidence is perishable

Here is the uncomfortable part. Most of what PostgreSQL shows you about right now is gone a few minutes later.

A view like pg_stat_activity is a live picture. By the time an engineer connects, the blocking transaction may have committed, the idle session may have disconnected, and the lock wait may have cleared. The database is healthy again, and the best clues have left the building.

-- A live view. It tells you about this moment only.
SELECT pid, usename, state, wait_event_type, wait_event,
       now() - xact_start AS xact_age,
       left(query, 80)    AS quer
[...]

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

[...]

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.