Every now and then, a PostgreSQL database needs changes: adding a column, creating an index, updating data, or modifying constraints. Changes like these are called migrations. They can finish in seconds and go unnoticed, or lead to blocking, replication lag, unexpected load, or even downtime.
Of course, no checklist can guarantee a trouble-free migration. However, asking the right questions beforehand can significantly reduce the risk.
In this article, we’ll go through a checklist that can help prepare for PostgreSQL migrations more confidently:
A statement can look simple, but its execution cost can vary significantly depending on the operation, table size, indexes and existing data.
A table rewrite means PostgreSQL creates a new physical copy of the table.
On large tables this can be expensive, because every row has to be rewritten, which in turn may generate a significant amount of WAL. Indexes are rebuilt as well, and the table is locked against both reads and writes while the rewrite runs.
For example, changing a column’s data type or adding a column with a volatile DEFAULT, may rewrite the table.
Some operations do not rewrite the table but still need to read all existing rows. For example, constraint validation.
A full table scan may consume significant system resources and take a long time on large tables. Whether it also blocks concurrent activity depends on the specific statement.
Large updates, deletes, table rewrites, and index creation can generate a significant amount of WAL. As a result, you may observe increased I/O, growing
[...]PostgreSQL 19 support is now available in pglayers, with 62 extension layers, ready-to-use Full and Azure profile images, and builds for both amd64 and arm64.
The images use the official postgres:19 GA image. If you want PostgreSQL 19 with pgvector, PostGIS, pg_cron, pg_textsearch, or pg_lake, you can get started without compiling extensions yourself.
The official PostgreSQL Docker images provide a familiar starting point, but installing additional extensions often means adding package repositories, build tools, and compilation steps to your Dockerfile.
pglayers publishes extensions as small, composable Docker image layers. You can copy individual layers onto an official PostgreSQL image, or use a preconfigured profile that already includes the extension paths, preload libraries, and startup settings.
The idea is simple: choose your extensions without maintaining their build environments.
The Full profile includes all 62 extensions currently available for PostgreSQL 19:
docker run -d --name pglayers-pg19 \
-e POSTGRES_PASSWORD=change-me \
-p 127.0.0.1:5432:5432 \
ghcr.io/pglayers/pglayers-full:19
Once PostgreSQL is ready, connect with:
docker exec -it pglayers-pg19 psql -U postgres
For example, enable pgvector and calculate a vector distance:
CREATE EXTENSION IF NOT EXISTS vector;
SELECT '[1,2,3]'::vector <-> '[4,5,6]'::vector AS distance;
The profile takes care of the server configuration. You still create the SQL extensions you want to use in each database.
The PG19 collection includes tools for several kinds of workloads:
Last month, PgBouncer participated in the Fall 2026 CNCF Security Slam. This is a report of what we did, what we learned, and what we plan for the future.
First, let’s introduce the participants. PgBouncer is a connection pooler for PostgreSQL. The CNCF is the Cloud Native Computing Foundation, the organization that supports Kubernetes and many other projects broadly related to that. There is also the OpenSSF, the Open Source Security Foundation, which publishes many tools and guides to help open-source projects improve and maintain their security practices. Both the CNCF and the OpenSSF are part of the Linux Foundation, so they are kind of sibling organizations.
The Security Slam is an event that the CNCF has run, in varying shapes, for some years. In its current shape, it is a one-month virtual event in which participating projects can earn “badges” for achieving specified tasks relating to improving (or establishing) their security posture. The tasks are generally organized around achieving certain milestones based on guides published by the OpenSSF, especially the Open Source Project Security Baseline. (The exact tasks vary from event to event; see below for details.) I had been following the OpenSSF work for some time, and I had been making some progress on applying some of their guides to my work, so I became interested in this event.
In the past, the Security Slam was only for CNCF-affiliated projects. I believe the original intent was to help those projects along on their graduation ladder. I had heard about the Security Slam via the CloudNativePG project, which participated (to some fanfare) in the Spring 2026 edition. But now the “Slam” is also open to non-CNCF projects. So I decided to give it a go with PgBouncer.
Why PgBouncer? I’m one of the maintainers of PgBouncer, and to participate in the Security Slam, you need to be a project maintainer (or at least one of the participants needs to be, I think). As we will see, most of the initial tasks are documenting things
[...]A second sitting of small measurements this week, mostly about what the planner believes and what indexes cost to keep. One result went the opposite way from what I expected.
PostgreSQL 18.6, built from source, default settings (work_mem 4MB, shared_buffers 128MB, maintenance_work_mem 64MB, 2 parallel workers per gather, 2 parallel maintenance workers). The database collation is C. MacBook Air M5, 10 cores, 24 GB RAM, internal SSD. Same machine as my previous posts.
Query times are EXPLAIN (ANALYZE, BUFFERS, TIMING OFF) execution time, median of 3 runs after one warm-up run. Buffers are from the top plan node. Index build times are wall clock from psql, median of 3, and include connecting. Sizes are decimal MB. Where I turned parallel workers off, I say so. The script and the raw results are linked at the bottom.
Two tables of 2,000,000 rows each, joined on an unindexed int column. Parallel workers off.
| work_mem | Batches | Hash memory | Temp blocks written | Time |
|---|---|---|---|---|
| 4MB | 16 | 6,938 kB | 11,917 | 419.7 ms |
| 64MB | 1 | 94,509 kB | 0 | 513.9 ms |
| 256MB | 1 | 94,509 kB | 0 | 515.0 ms |
I expected the single-batch join to win. It was about 90 ms slower, every run. The 4MB join spilled to temp files on an SSD and still came out ahead. My guess is that the smaller hash table fits the CPU caches better, but I didn't test that.
[...]
Another sitting of small measurements. Two of them changed how I write queries. The rest mostly confirmed things I had only read.
PostgreSQL 18.6, built from source, default settings (work_mem 4MB, shared_buffers 128MB, 2 parallel workers per gather). The database collation is C. MacBook Air M5, 10 cores, 24 GB RAM, internal SSD. Same machine as my previous post.
The main table has 2,000,000 rows. Query times are EXPLAIN (ANALYZE, BUFFERS, TIMING OFF) execution time, median of 5 runs after one warm-up run (3 runs for the slower ones). Buffers are from the top plan node. Sizes are decimal MB. Where I turned parallel workers off, I say so. The script and the raw results are linked at the bottom.
200,000 customers and 2,000,000 orders, with an index on orders.c_id. 150,000 customers have orders. Parallel workers off.
| Query | Time | Buffers |
|---|---|---|
WHERE EXISTS (SELECT 1 FROM o ...)
|
60.6 ms | 2,510 |
WHERE id IN (SELECT c_id FROM o)
|
60.2 ms | 2,510 |
SELECT DISTINCT c.id FROM c JOIN o ...
|
305.9 ms | 11,892 |
EXISTS and IN became the same semi-join. The JOIN version built all 2M joined rows and then removed the duplicates.
The other direction, the 50,000 customers with no orders:
| Query | Time | Plan |
|---|---|---|
NOT EXISTS (...)
|
61.5 ms | Merge Anti Join |
LEFT JOIN o ... WHERE o.id IS NULL
|
213.7 ms |
Huge pages (HugeTLB) are one of the most important PostgreSQL tuning steps, and they must be right before the server starts. They matter mainly for stability and reliability, more than for speed. Recently I also came across reports of up to 30% performance gain as an added benefit, but only for very specific workloads.
One challenge is that the huge pages available on the host should be a near perfect fit for what PostgreSQL is going to request:
On a plain Linux host this is easy to fix, as the next sections show. On Kubernetes it is harder: we need to prepare the nodes with enough huge pages before pods can request them. One option is to first set up the cluster without huge pages, read the requirement from the running instance, create nodes with enough huge pages, and then change the pod so that it gets rescheduled onto the new nodes. That is a lot of steps. These discussions made me think about whether the required huge pages can be calculated in advance.
This post covers how huge pages have traditionally been sized for PostgreSQL, and then gives a formula that computes the requirement directly from PostgreSQL parameter values. The formula was derived from the PostgreSQL source code and checked against real PostgreSQL 16, 17 and 18 binaries.
I am not claiming that it is perfect. But it helps if you are looking for a number that is very close.
If you already know what huge pages and Kubernetes operators are, skip this section.
Memory pages. Linux does not hand out memory byte by byte. It hands it out in fixed-size blocks called pages. The normal page size is 4 kB. For every process, the kernel keeps a page table: a map that says “th
[...]
Every PostgreSQL team eventually runs a massive DELETE to free up disk space, watches df -h stay completely flat, and wonders if the command even worked. Worse, queries against the smaller table often get slower instead of faster.
This is Part 2 of Postgres in Production (following Part 1 on PostgreSQL index types). Same rule applies here: measure first, then explain. All numbers below were measured on PostgreSQL 18.6 using pgstattuple and EXPLAIN (ANALYZE, BUFFERS) on a 1,000,000-row dataset.
In PostgreSQL’s Multi-Version Concurrency Control (MVCC), UPDATE and DELETE never overwrite or erase row bytes in place. DELETE stamps a transaction ID (xmax) onto the tuple header so older snapshots can still see it, and UPDATE marks the old version dead while writing a brand-new tuple version.
I ran a five-stage lifecycle test on a 1,000,000-row orders table (id, user_id, status, amount, payload, updated_at) with a primary key and a composite index on (status, user_id):
| Stage | Heap size | Index size |
Dead tuples (pgstattuple)
|
Free space (pgstattuple)
|
status = 'pending' query
|
|---|---|---|---|---|---|
| 1. Baseline (1,000,000 rows) | 142 MB | 29 MB | 0.00% | ~0% | 46.4 ms (18,284 buffers) |
2. After 1,000,000 UPDATEs
|
181 MB | 59 MB | 18.99% (250k) | 0.54% | — |
3. After 700,000 DELETEs
|
181 MB | 59 MB | ~75% | — |

© Laurenz Albe 2025
If you have to restart the PostgreSQL server, you often want to keep the down time as short as possible. Starting the server is usually fast, but shutdown can be slow. In this article I describe why there can be a slow shutdown and what you can do to speed it up.
We have to understand what happens during a PostgreSQL shutdown. This varies depending on the shutdown mode, which is determined by the signal sent to the postmaster process:
SIGTERM): don't allow any new connections, wait for the last client to disconnect, then shut down cleanly
SIGINT): terminate all existing connections and shut down cleanly
SIGQUIT): kill all processes and exit without a clean shutdown
“Smart” shutdown clearly is not an option for a fast restart. “Immediate” mode is also not a good idea: the server will terminate quickly, but PostgreSQL will have to perform crash recovery during the nest start, which can also take a long time. (This is a typical “false friend” for Oracle users: there, an IMMEDIATE shutdown is what a fast shutdown is in PostgreSQL.)
During a clean shutdown, PostgreSQL performs a checkpoint to flush all dirty (modified) pages from shared buffers to disk. That is what makes a checkpoint slow: the bigger shared buffers is and the more buffers are dirty, the slower the shutdown will be.
To speed up the shutdown checkpoint as much as possible, we have to make sure that there are as few dirty buffers as possible. There are never as few dirty buffers as right after a checkpoint. Consequently, a shutdown will be fast if we do it right after a checkpoint. Moreover, that checkpoint shouldn't be a (default) “spread” checkpoint, but a “fast” one. The SQL statement CHECKPOINT triggers such a checkpoint, so you could run the following for a fast restart:
# could take long, but the database is still up psql -c[...]
After talking about the reverts and then the remaining features of PostgreSQL 19, I want to talk about another important aspect: the statistics of the development cycle.
This blog post is also somewhat of an announcement: hackorum.dev now has a new, extensive statistics page.
Most of the data here comes from two of those pages: the PG19 page of the per-release statistics and the release-over-release view.
My goal isn’t to blindly repeat the information already available there – if it were, this blog post could end here. Instead, I want to focus on two topics visible in the data: mostly on how PG19 was different from the previous releases, but also on how, even without this outlier, PostgreSQL development is changing rapidly, and people will have to pay attention and adjust.
A few years ago, I wrote about an innocent-looking microservices pattern that could make PostgreSQL performance unexpectedly dramatic. Not because the SQL changed. Not because someone dropped an index. The data changed, the statistics told an outdated story, and the planner made a perfectly rational decision based on fiction.
Back then, pg_hint_plan was one possible escape hatch. PostgreSQL 19 introduces two supplied tools, pg_plan_advice and pg_stash_advice. Time to revisit our old friend: the transactional outbox.
Transactional outbox pattern :
The transactional outbox solves the “database committed, message publish failed” problem.
Prerequisites (restart the PostgreSQL service after applying).
ALTER SYSTEM SET shared_preload_libraries = pg_plan_advice, pg_stash_advice;
ALTER SYSTEM SET compute_query_id = on;
For simpler plans to read, disabled parallel query and jit is off (hurrah!) by default in pg19.
“LAB ONLY” autovacuum off so nothing refreshes the statistics behind our back.
-- Classic Outbox pattern: order and event are committed in one transaction.
BEGIN;
INSERT INTO demo_orders (order_id, customer_id, order_total) VALUES (1, 42, 129.00);
INSERT INTO demo_outbox (aggregate_id, event_type, event_payload, created_at, delivery_status)
VALUES (1, 'OrderPlaced', '{"orderId":1,"total":129.00}', clock_timestamp(), 'READY');
COMMIT;
Lets generate dummy data mimicking a production outbox.
We check plan of classical polling query when stats are accurate.
Generated Plan Advice is the advice string that would reproduce the plan you got. In the healt
In October, I was in the audience at PGConf.EU for “The Monday We Learned Who Maintains Our Backups”, by David Steele and Jan Wieremjewicz. I was happy to hear how pgBackRest was born, straight from the person who wrote it.
One slide listed the project’s founding major contributors: David, Cynthia Shang, Stephen Frost, and Reid Thompson. The next slide added “Next:” above my own name.
Everything that pg_memtable stores lives in shared memory, and a restart of the server destroys it, but the handle is left in the catalog. Since nothing special is done to inform Postgres that tables that use the memtable table access method (MemTables) do not survive a restart, it will treat the table as permanent, with “interesting” consequences. In this post you’ll learn about table persistence, how unlogged tables deal with a server restart, how to make every MemTable unlogged so that Postgres handles MemTables correctly, and how to recreate the arena of a table after a restart.
In Part 8 you could see how a backend lets go of an arena that another backend has dropped or truncated. All of that assumed that the server keeps running, but servers can crash or restart while tables are being updated. When that happens, Postgres might run recovery when the server starts again, and it has to deal with tables that were only partly written to disk.
Recovery is not needed when the server does a controlled restart, but a MemTable loses its arena in both cases, so the table record in pg_class, which survives a restart, points to an arena that no longer exists. This post looks at what recovery does, how it is handled for table access methods, and what is necessary to make a MemTable behave in a reasonable manner after a restart.
Before discussing recovery, you need to look at how storage is managed for table access methods, including heap tables, and at what the persistence of a table means.
Relations that have storage in Postgres, such as tables and indexes, have multiple forks that contain information about the data in the table. There are up to four forks for each table, which are all used by the heap table to store information:
main fork contains the data of the relation, which typically are the pages with the rows of a table (or the pages of an index).
fsm fork contains the free space map, which keeps track of how much space there Prairie Postgres turned two in October, but since I was overseas then, we moved our celebration (and a cake!) to November.
We are very thankful to Sami Imseih for presenting his Become a PG_STAT_* talk (which I missed at PG DATA 2026); it was exceptionally informative and now includes the most recent additions coming in PG 19. A great final accord to 2026~
Thank you everyone who participated and expecially thoe who volunteered in 2026! See you in 2027!
Configure PostgreSQL connection pooling on Vercel with Next.js. Size pg pools, release clients, handle transactions, and reproduce queued requests locally.
Your Next.js endpoint works locally, then starts timing out after a deployment or traffic spike. PostgreSQL reports too many connections, or requests wait even though the database has little CPU activity. Adding more function instances can make the problem worse because each instance can open another group of connections.
PostgreSQL connection pooling on Vercel needs decisions at two layers. Your Node.js process manages clients through a driver pool. Your database provider may also run a pooler that assigns those client connections to PostgreSQL backends. Diagnose the layer that is waiting before changing a limit.
This guide builds a shared node-postgres pool for a Next.js App Router application, handles transactions without leaking a client, and provides a local lab that reproduces a request waiting for an unreleased client. The examples use Node.js 24 and the Node.js runtime for the database route.
Follow the connection path from a request to the query. A request first waits for an available client in its local pg pool. With a provider pooler, that client connects to the pooler, which may then wait for a PostgreSQL backend. A query that reaches PostgreSQL can still wait for a lock or spend time executing.
Next.js request
-> local pg pool in one function instance
-> optional provider pooler
-> PostgreSQL backend
-> query execution and lock waits
If a client is checked out and never released, requests can queue inside the application while PostgreSQL sees an idle connection. If many instances each create several clients, the provider's connection budget can fill up. If a query holds a lock, increasing the local pool can send more queries into the same wait.
Use the error code, acquisition time, pool counters, provider metrics, and database activity t
[...]
Picture an internal assistant that answers employee questions from a shared document store. Someone asks a reasonable question about bonus timelines. The vector search does exactly what it was built to do and finds the most semantically similar chunks. One of those chunks comes from a compensation review meant only for HR.
No model hallucinated, no index was corrupted, and no query timed out. Every component worked as designed, and that’s why no alert fired. The system answered the question it was asked, which was “what is most relevant?” Nobody had asked it “what is this person allowed to see?”
I argued in a recent Forbes Technology Council article that relevance is not permission [add link to your Forbes article]. In this post I want to show what that means in PostgreSQL itself, in the SQL. It comes down to four patterns. First, put authority in the table. Second, don’t let the filter quietly starve your results. Third, make hard boundaries physical. Fourth, prove what the agent could see.
An embedding captures what a chunk means. It doesn’t capture who owns the chunk, which tenant it belongs to, or which regulation covers it. Two paragraphs from a public FAQ and a confidential board memo can sit right next to each other in vector space. That’s because they talk about the same thing.
Most RAG pipelines I review handle permissions in one of two ways. Both are fragile.
WHERE clause written by whoever writes the query. That’s better, until an LLM-generated query, a notebook, or a new microservice forgets it.
In both cases, permission is a habit of the caller and not a property of the data. When an agent can query on its own, the caller is no longer a de
[...]Yesterday, Thursday, November 19th, was a cold night in Edinburgh, but the wonderful Law School in the University of Edinburgh's Old College was warm and cosy for our November meetup.
We were a speaker short, though. Alastair Turner of Percona was on his way to Edinburgh when his train turned back, because an incident on the line had cancelled all northbound trains for several hours, and there was no other way for him to get here in time. Alastair spoke at our February meetup, and we were very sorry not to see him again, or to discuss his topic with him in person.
So I stepped in with an expanded version of the talk I gave at PGConf.EU last month, Radar + Radar Analyst: Agentless Diagnostic Snapshots for PostgreSQL, and a live demo. In the demo, radar collected a diagnostic snapshot from my personal server (which, slightly embarrassingly, is sub-optimally configured in some places), and radar-analyst turned it into an expert-level analysis as we watched.
If you haven't come across them yet, radar is a single Go binary that you run when something is wrong. In a few seconds, it gathers the configuration, statistics and host details that a support engineer would otherwise ask for one email at a time, writes them into a zipfile and exits. radar-analyst then checks that zipfile against a set of deterministic rules, and each finding comes with the fix for it. It can also ask an LLM to write a brief on top, but whatever the model says, a verdict can never be milder than the worst finding behind it. Both tools are released under the PostgreSQL Licence, and contributions of new rules are welcome.
📊 Slides: Radar + Radar Analyst: Agentless Diagnostic Snapshots for PostgreSQL (PDF)
After a short break, and with Alastair's permission, we sat down to watch a recording of an earlier version of his talk, Gravity Wells and Guidebooks: AI Application Architecture by Analogy, from BuildDevCon's Building AI Apps with PostgreSQL ev
[...]
If PostgreSQL 18 was the storage-speed release that brought Asynchronous I/O (io_uring and worker threads) to Postgres, PostgreSQL 19 is the operational release DBAs and backend teams have been asking for since 2018.
Instead of forcing teams to bolt on external extensions for basic online maintenance or pray that a major upgrade won’t flip a critical join plan, PostgreSQL 19 ships native REPACK (CONCURRENTLY), pg_plan_advice, INSERT ... ON CONFLICT DO SELECT, parallel index autovacuum, and auto-scaling Async I/O straight in core — alongside a handful of default changes and pg_upgrade blockers that will break a blind config copy from v18.
The short verdict: should you upgrade from 18 to 19? Yes for high-churn OLTP clusters suffering from table/index bloat (
REPACK (CONCURRENTLY)+ parallel index autovacuum) and write-heavy APIs (ON CONFLICT DO SELECT). Just auditpostgresql.conffirst — leaving v18’sio_workersparameter in place triggers aFATALstartup failure,jitis nowoffby default, and SQL/PGQ graph queries did NOT make the final cut.
Most upgrade decisions come down to whether the delta justifies a pg_upgrade maintenance window. Compared directly against PostgreSQL 18, version 19 shifts the needle across operations, developer SQL, and defaults:
| Area | PostgreSQL 18 | PostgreSQL 19 | Production Impact |
|---|---|---|---|
| Async I/O (AIO) |
Fixed io_workers (io_uring / workers, ~3× cold scan boost)
|
Auto-scaling io_min_workers / io_max_workers + EXPLAIN (ANALYZE |
Yesterday, PostgreSQL 19 was finally released after multiple delays. Everyone already knows about the many reverts that happened, but what actually remains? Is it still an interesting release?
This blog post doesn’t aim to be a complete list: the release notes are there for that.
It is only a short highlight of some of the more interesting additions.
While I do not want to go into the details about the “lost features” again, the list is long.
PostgreSQL 19 was released today. pgEdge packages for it are available the same day across all of our supported deployments - including Spock, where PG 19 support is already available. I have been testing the release candidates for a few weeks, so here is what I think matters most to DBAs and teams. replaces and , and with the option it rebuilds a bloated table without blocking reads and writes. In my own test, inserts kept running at about 2,000 a second with no failed transactions while a bloated table was rebuilt in under a second. It needs a primary key or replica identity index, and it is not MVCC safe for transactions that started before the swap. Shaun Thomas wrote a blog on the topic - give it a read for more detail. gets the biggest changes for anyone running replicated clusters. Sequences can now be published with and synced with , which removes the manual step from migrations and upgrades. Logical replication can also be turned on without a restart when is replica. Subscriptions get for better conflict detection, and publications can leave tables out with ., autovacuum can now use parallel workers on indexes and ranks tables with a scoring system, so the ones that need it most go first. The and extensions let you steer the planner and keep a plan you trust. The new command gives read-your-writes consistency on standbys. are worth knowing. is faster on text and CSV input, can now write JSON, and lets a load continue past bad values. For monitoring, is now on by default, there is a new view, and the wraparound warning now starts at 100 million transactions instead of 40 million.
dbvr lets you define PostgreSQL connections and run SQL from the command line, with no graphical interface. That makes it a fit for servers, containers, and pipelines where a desktop database tool cannot run.
DBeaver Corporation announced dbvr on March 26, 2026 as a standalone CLI built on the same multi-database engine as the DBeaver desktop products. It can:
The announcement lists the commercial edition as an annual per-machine subscription with a 14-day trial. DBeaver's 26.1 release post also introduced dbvr Community, a free edition under the Apache License 2.0.
This post covers three steps: creating a PostgreSQL datasource, running queries, and using dbvr for production queries.
You will want to scan the documentation, and the code is available in all the popular package formats.
In dbvr, a datasource is a saved, named connection, so later commands can refer to it by name instead of repeating host and credentials. You create one with the datasource create command, using the postgres-jdbc driver.
Below I am using the gold ol' DVD Rental database on a local server
$dbvr datasource create --driver=postgres-jdbc --name=dvdrental --host=localhost --port=5432 --user=stoker --password=Secr3t --database=dvdrental
postgres-jdbc-1a1f47126cc-2a49d7ea462459bf
$dbvr datasource list
ID NAME DRIVER postgres-jdbc-1a1f47126cc-2a49d7ea462459bf dvdrental postgres-jdbc
The sql command runs a query or a whole script against a datasource and
Don't let the minor version increment fool you: pg_clickhouse v0.11.1, released last week, delivers a slew of improvements and bug fixes, including UPDATE, DELETE, TRUNCATE, and pgvector search pushdown.
Let's start with the latter: pgvector type mapping. Given this ClickHouse table:
CALL clickhouse_perform('ch_server', $$ CREATE TABLE items ( id Int32, category String, v Array(Float32) ) ENGINE = MergeTree ORDER BY (id); $$);
This one started with RegreSQL. Since The tests passed. The plan didn't. I've been loading production statistics into empty databases to see how much the plans alone can tell about a real workload. One paginated endpoint in a multi-tenant app wouldn't line up. Its plan was cheap, a cost of a few hundred and an estimate of one row, while pg_stat_statements in production had the same query reading thousands of buffers per call to return about eight rows.
RegreSQL compares plans by cost, and so do I. The first thing my eyes go to in a plan is the cost on the top line: small number, cheap query, move on. This query's cost couldn't see its own problem, so before deciding what RegreSQL should do about it I rebuilt the case on a synthetic schema where every row can be accounted for. Two ordinary things cause it, one tenant much bigger than the others and a query sent as a prepared statement, and between them PostgreSQL ends up planning the big tenant's query from the small tenants' runs and keeping that plan for as long as the connection lives.
Everything was captured on PostgreSQL 18.7 (the postgres:18 image) with pageinspect. The scripts are setup.sql, query.sql, late.sql and experiments.sql, which replays every plan here. setup.sql doesn't seed random(), so your week of site 1 won't be exactly 1,983 readings, but every count below is arithmetic you can redo on your own number (each reading costs the generic plan ten lookup accesses plus its scan), and the plans the planner picks come out the same. Timings are medians of EXPLAIN (ANALYZE, TIMING OFF) on my laptop, warm cache unless I say otherwise; anything closer than a tenth of a millisecond is noise.
The lab is sensor readings with the usual lookup tables hanging off them. A site is the tenant, and readings stands in for whichever tenant-scoped table grows fastest in your schema:
CREATE TABLE vendors (id int PRIMARY KEY, name text NOT NULL);
CREATE TABLE models (id int PRIMARY KEY, vendor_id int NOT NULL REFE[...]
The following speakers delivered sessions about PostgreSQL at PASS Data Community Summit, which happened from 9-11 November 2026:
On 10 November, the San Francisco Bay Area PostgreSQL Meetup Group met. Korede Aderele delivered a session.
Organizers:
On 11 November, the PostgreSQL User Group Vienna met, organized by Cornelia Biacsics & Ranjeet Meghwar. Panagiotis Stathopoulos delivered a talk.
On 12 November, the PostgreSQL Istanbul Meetup met.
Organizers:
Speakers:
On 12 November, the Postgres Meetup for All happened, organized by Elizabeth Christensen. Huseyin Demir delivered a talk.
On 12 November, Gabor Szabo hosted a meetup. David Christensen and Elizabeth Christensen delivered a session.
On 12 November, the London PostgreSQL Meetup Group met, organized by
Speakers:
On 13 November, pgDay México 2026 happened.
Organizers:
Speakers:
Volunteers:
Working with the Postgres development community is such a rewarding experience.
In January 2024, Pavel Stehule asked in the hackers mailing list: why is there no VACUUM FULL CONCURRENTLY?
I happen to know that Pavel works as a consultant with some very large, very high velocity databases. He knows many interesting stories, and he doesn’t ask questions just because. If he asks why don’t we have VACUUM FULL CONCURRENTLY, you can bet that there is an interesting production-server story behind that.
VACUUM FULL wasn't enough
Now you, gentle reader, might be wondering what the deal is with this VA

© Laurenz Albe 2026
One of the more important new v19 features is the option to force the planner's hand with the help of pg_plan_advice and pg_stash_advice. You may have heard that “PostgreSQL v19 finally has query hints”, which is not entirely wrong. But if you are used to Oracle style query hints, you may be surprised and confused, because the PostgreSQL feature works in a different way. So I'd like to explain the feature with the aid of a fairly realistic example.
I is true that PostgreSQL had refused to add query hints for a long time. As I am writing this, the PostgreSQL Wiki still has the following under Features We Do Not Want:
"Oracle-style" optimizer hints
Optimizer hints, as implemented in Oracle and other RDBMSes, are used to work around problems in the optimizer and introduce upgrade and maintenance issues. We would rather have such problems reported and fixed. We have discussed a more sophisticated system of per-class cost adjustment instead, but a specification remains to be developed. See Optimizer Hints Discussion for further information.
pg_stash_advice
However, PostgreSQL is not controlled by a single person or entity, and that decision has never been unanimous. Also, reality being the way it is, there have always been cases where the best statistics and the smartest query planner together made the wrong decision. Consequently, people have felt the need to force the planner's hand. Out of that need, a couple of “hint-like” approaches to the problem have developed:
enable_*. These allow you to disable certSince June 2026, PostgreSQL security fixes have had a home of their own: a private git repository holding every pending fix as a stack of patches, and a private buildfarm that builds and tests that stack across every supported branch, continuously, before anything goes public.
Security fixes are the one kind of PostgreSQL change that can’t use the normal development process. They can’t be posted to pgsql-hackers, they can’t go into a public commitfest, and they can’t be pushed to postgresql.git and left for the public buildfarm to shake out. They have to stay under embargo until release day.
That left a gap. A fix might be reviewed carefully, but until wrap day it was a patch file passed around among a small group, or stashed in our bug tracker, often with a separate version for each of six or seven branches. Nobody was running it on the range of platforms, compilers and configurations that the buildfarm covers for ordinary commits. Then on wrap day, patches were pushed and the first broad test those fixes got is the public buildfarm, a few hours before tarballs are made.
That’s a lot of risk concentrated in one day, moreover the day when a broken build is most expensive.
The core of the new setup is pgsql-security, a private git repository that the security team and committers working on security issues can access. It’s organised as a git quilt: one directory per supported branch, each holding a series file and the patches it lists, in the order they will be applied.
The patches are ordinary git format-patch output, so each carries the author, the commit message and the backpatch information that will end up in postgresql.git. A patch that applies unchanged to several branches can be listed in each branch’s series as a relative path (../master/foo.patch) instead of being copied.
Alongside the quilt, individual fixes in progress can get their own branches, which is where work happens before a fix is ready to join the stack. Work that shouldn’t
[...]Number of posts in the past two months
Number of posts in the past two months
Get in touch with the Planet PostgreSQL administrators at planet at postgresql.org.