Latest Blog Posts

All Your GUCs in a Row: max_files_per_process
Posted by Christophe Pettus in pgExperts on 2026-09-12 at 01:00
PostgreSQL's max_files_per_process isn't a hard limit—it's a descriptor pool that quietly recycles old files when full.

PG Phriday: The Folder That Ate the Publisher
Posted by Shaun Thomas in pgEdge on 2026-09-11 at 11:18

Logical replication has been part of Postgres since version 10, and the syntax page that governs it is almost comically brief.  wants a name, a connection string, a list of publications, and then it offers one innocuous line:That single line expands to more than a dozen options, and several of them change how logical replication uses storage resources. After all, subscriptions created with no  clause work perfectly fine. Most subscriptions in the wild don't need these tweaks, and nobody thinks about that line again, if they ever knew it existed at all.Imagine a production system boasting several downstream logical replicas. Consider disk monitors lighting up and flagging the  directory. It’s suddenly filling with thousands of anonymous artifacts, and nobody seems to know what is writing there or why. Well, it is Postgres writing in that directory, and the "why" is a longer story.So what lives in that directory? What makes it balloon to terrifying proportions seemingly at random? How is logical replication involved? Is there any way to control or even stop this behavior?The answers lie inside that very same innocuous and esoteric WITH clause. Let's see what's going on here.

No Man's Land

Let's start with the files themselves. The  directory maintains one subdirectory per replication slot. Inside each sits a small state file recording where the slot stands, plus whatever the decoding process couldn't hold in memory. Clusters with active logical replication will have files there, others won't. Nothing too ground-breaking.Any DBA worth their salt will perform a quick check on pg_replication_slots if logical replication is acting up. Let's start there:Every slot is active and  rather than , , or , so the slot itself is fine. The  column is blank because max_slot_wal_keep_size defaults to -1, so there's technically no limit to the amount of WAL the slot might retain. There's no obvious culprit here.The next step is to check  for one of the slots:Now we see several spill files beside the  file, 114MB in all. The [...]

The unbearable lightness of one more index
Posted by Radim Marek on 2026-09-11 at 08:15

Being "the database guy" comes with a lot of questions, and over the last eight months those questions changed. The repetitive ones disappeared, nobody asks how to avoid putting things in the database any more, and the code arriving for review got noticeably more polished. Then this summer a schema landed in front of me with twelve proposed index drops on a single table, which is when I started assuming coding agents over-index. The next schema I looked at had the same shape.

Passing this off as AI slop would be too easy, because most of those changes were competent. So I built a harness and measured it.

I loaded 30 model-generated schemas into PostgreSQL and audited 838 indexes across twelve of them. The competence caught me off guard. Only ten served no requirement I could find; the rest showed solid craft. All four models handled GIN and GiST indexes cleanly, built partial indexes with sensible predicates, and got multi-tenant composite keys in the right order. The baseline SQL quality is much better than what agents wrote a year ago.

The cost of an extra index

Indexes are great, until you pile them onto the single table taking all your writes. On quiet tables you will never notice the difference. On hot tables, every index is extra work on every write.

In one support-tool schema, a model created sixteen indexes on tickets alone. Six of them indexed last_activity_at, a column that updates every time an agent touches a ticket. Compared to my hand-written baseline with seven indexes, the generated schema wrote 1.8× the WAL, took 1.9× longer per update, and pushed up VACUUM time just as much.

Those sixteen indexes were not dumb mistakes. For read queries, they run fast. The problem is that coding agents write indexes query by query, without thinking about write traffic.

What actually happens on disk when you touch that row:

  • No more HOT updates. If any index touches the modified column, Heap-Only Tuples is out the window. Postgres can't keep the new row version confined to t
[...]

All Your GUCs in a Row: max_connections
Posted by Christophe Pettus in pgExperts on 2026-09-11 at 01:00
max_connections is a memory budget and a circuit breaker wearing a capacity costume. It does not decide how many queries your server can run at once; the core count and the storage decide that, and they were decided when you bought the hardware. What max_connections decides is how many client bac…

Your Agent Can Turn Off Its Own Kill Switch
Posted by Mikhail Shytsko on 2026-09-11 at 00:00

A new agent needs a database login, so the role it logs in as gets the treatment every runbook recommends. Two ALTER ROLE lines go in, one capping how long a single statement may run and one making transactions read-only by default. From the operator's side, the Postgres role for AI agent sessions now looks contained.

alter role agent set statement_timeout = '2s';
ALTER ROLE
alter role agent set default_transaction_read_only = on;
ALTER ROLE
select rolname, rolconfig from pg_roles where rolname='agent';
 rolname |                        rolconfig                        
---------+---------------------------------------------------------
 agent   | {default_transaction_read_only=on,statement_timeout=2s}
(1 row)

Both settings bite at the baseline, with SELECT pg_sleep(4) cancelled at 2.060 seconds on the role above and a bare CREATE TABLE refused on a second role carrying only the read-only default. Then the agent's own session answers, in one statement.

SET default_transaction_read_only = off;
SET
SHOW default_transaction_read_only;
 default_transaction_read_only 
-------------------------------
 off
(1 row)

SELECT source FROM pg_settings WHERE name = 'default_transaction_read_only';
 source  
---------
 session
(1 row)

CREATE TABLE app.via_set (i int);
CREATE TABLE
INSERT INTO app.via_set VALUES (1);
INSERT 0 1

The pg_settings source column for a Postgres role for an AI agent, showing the value ALTER ROLE SET writes as source user and the two ways a session replaces it, with SET arriving as source session and a connection string arriving as source client

One column moved, from user to session, and that column is the whole story. What ALTER ROLE ... SET writes is the value a session starts with; whether the session stays there is up to the session, because every parameter in that opening pair carries a context of user. The quieter route skips SET entirely and needs no SQL at all.

Key Takeaways

  • statement_timeout, transaction_timeout, lock_timeout, the two idle timeouts, default_transaction_read_only and application_name all have context = user, so the session the value was meant to restrain is the session allowed to change it.
  • A connection string carrying options=-c statement_timeout=0 arrives with source = client, which
[...]

Optimising PostgreSQL Aggregates: What Can an Extension Do?
Posted by Andrei Lepikhov in pgEdge on 2026-09-10 at 17:33

Aggregates in PostgreSQL aren't particularly efficient, computationally speaking. It shows most in a scenario where partial aggregation doesn't help: when aggregation only prepares data for the query, processing a large stream of rows and producing, at the output, a not-much-smaller set of groups and the aggregates computed over them. Variable-length types have it worst of all. And the typical example here is SUM(numeric). Built-in aggregates are obliged to handle values in their most general form, whereas in practice the data is often constrained; in the databases of ERP systems such as Microsoft Dynamics or NetSuite, monetary columns of type numeric are usually declared with a fixed scale.Hence the idea of optimising aggregates by tuning them to the specific conditions under which they operate. Previously, this was possible only in a PostgreSQL fork. However, David Rowley recently added a new extension hook in core: SupportRequestSimplifyAggref (commit 42473b3b31, PostgreSQL 19, currently in beta), which lets you pass the planner custom aggregate-transformation logic via planner support functions (prosupport). The mechanism itself has existed since PostgreSQL 12, but it has only now been extended to aggregates. In core, the new request is applied modestly: it replaces COUNT(1) and COUNT(col) over a NOT NULL column with COUNT(*). For an extension, though, it allows almost anything to be done with an aggregate at planning time. That leaves room for interesting technical solutions.So let's put it to work on a live example: a simple extension with a fairly primitive transformation.

The Redundant Sort

In real deployments, where queries are generated dynamically by an application, you occasionally meet redundant constructions like this one:Indeed, the order of the values has no effect on the sum. So why perform a pointless sort?To begin, let's check whether PostgreSQL really performs the unnecessary sort operation and estimate what removing it might give us. Below are two summation queries, with the sort and w[...]

All Your GUCs in a Row: max_active_replication_origins
Posted by Christophe Pettus in pgExperts on 2026-09-10 at 01:00
max_active_replication_origins is a ten-year-old XXX comment that finally got paid off. It arrived in PostgreSQL 18, and it exists because the thing it controls had been borrowing another parameter’s number since 9.5. On 14 through 17, the number of replication origins a subscriber can track is s…

Chinese PostgreSQL Docs Are Live: All 11 Major Versions
Posted by Ruohang Feng on 2026-09-10 at 00:00
pgsql.cc is live, with Chinese documentation for all 11 PostgreSQL major versions from 10 through 20, a redesigned mirror of the official website, and better full-text search. Kept in sync with upstream, with no ads.

Structured Query Language 101 at Texas Linuxfest
Posted by Dave Stokes on 2026-09-09 at 19:27

 Structured Query Language 101 -15:00–16:20

Nov. 6, 2026 · 15:00 - 6:20

I will be teaching the basics of SQL at the 2026 Texas Linuxfest. The session is listed for only 100 minutes, but I wrote the materials for a 3-hour course. We will cover as much of those three hours as the audience can stand (sit?), or they send us off to Sixth Street.

Tickets are available, and this event is great for networking.  Ping me if you have questions about this session. 

Description:

SQL is a powerful language for working with relational databases such as MySQL, PostgreSQL, SQL Server, and Oracle. This is an 80-minute introduction to writing SQL database queries. Please load a copy of DBeaver Community Edition (free, open-source) from https://dbeaver.io/download/ on your Mac, Windows, or Linux laptop to work along with the presentation. We will use the sample database that is included with DBeaver. We will start with simple SELECT statements to retrieve data, INSERT to add data, use UPDATE to modify it, and DELETE to remove it. We will then move on to using WHERE to narrow your database searches, grouping & ordering for readability, and using built-in functions. This is a great way to learn how to use a relational database.

30 Years of Postgres Architecture: Tom Lane Interview
Posted by Elizabeth Garrett Christensen in Snowflake on 2026-09-09 at 17:40

 

Elizabeth: I know a little bit of your history prior to joining the Postgres project. I think you did work on JPEG — the image specification. The internet thinks that you did some work on libjpeg, which was part of the Mars Perseverance camera work. Tell me a little bit about that and how that stuff affects your work in Postgres.

Tom: So I had nothing to do with the writing of the JPEG specification. But it came out and there were maybe about a dozen of us who were interested in this and said, let's sit down and write an open source implementation of it, which we did, and that became libjpeg. And I was — there was this flurry of activity at the very beginning with maybe about a dozen people involved. Then after that, it kind of went into maintenance mode. I was principal maintainer of it for five years or so, which is why my name is on it more than other people's.

When I got involved in Postgres, that became something that just sucked up all my time. And so I stopped working on libjpeg. I'm happy that some other people picked it up and ran with it, which they did eventually after I ignored it for long enough.

I know for a fact that the engineering cameras on Perseverance use libjpeg, because Joe Conway found an academic paper that said so. They've never been in any direct contact with me.

Elizabeth: Is there crossover between open image specifications and databases?

Tom: Not directly, but it definitely informs my thinking about things like software licenses. I think the fact that JPEG is absolutely everywhere today is 25% the fact that it was a really great standard that lets you make image files about 10 times smaller for the same quality as you could have before and 75% the fact that there was a free implementation that anybody could use. Without that, it would not have been put into the early web browsers and you would not be seeing it all over the net.

We made the right decision on that. And then when I came to Postgres again, the fact that it had a very liberal license was a

[...]

100,000 Lines of C Later: pgSafe at PGDay UK 2026
Posted by Jimmy Angelakos on 2026-09-09 at 16:46

PGDay UK 2026 session card for "100,000 Lines of C Later: Re-architecting Enterprise Postgres Backups in Go", next to a photo of Jimmy Angelakos on stage in front of the title slide

Yesterday I had the pleasure of speaking at PGDay UK 2026 in London, at the Cavendish Conference Centre. The talk was called 100,000 Lines of C Later: Re-architecting Enterprise Postgres Backups in Go. It was about the design of a Postgres backup tool: the rules such a tool has to obey, and what those rules look like when you rebuild the tool from scratch in Go, which is what pgSafe is. The slides are available here.

It was very well received, the feedback afterwards was positive, and people were intrigued by the possibilities. For those who weren't there, here is what I talked about.

What happened in April 2026

pgBackRest is one of the two de facto enterprise backup tools for Postgres, with its first stable release dating back to 2016. It started life as Perl and is now written in C, and it has a decade of production lessons incorporated into its code. In April 2026 it lost its corporate backing, and the maintainer archived the repository. A few weeks later, it turned out the project could survive, and it is being maintained again.

Nobody did anything wrong here: funding stopped, and somebody made a reasonable call. But for those few weeks, the question was: what do we back up with?

Why was that a problem?

pgBackRest is about 96,000 lines of dense C, and another 80,000 lines of test harness: manual memory management, custom networking, its own protocols. It is excellent code, maintained by very few people: not many can understand it well enough to work on it.

Critical infrastructure needs alternatives that more people can maintain.

So I started writing one.

Introducing pgSafe

pgSafe is written from scratch in Go. It shares pgBackRest's concepts and operational rules, and none of its code. The goal is functionality parity for the common deployments: full and incremental backups, point-in-time recovery, five storage backends (POSIX, S3, Azure Blob, GCS, SFTP), and PostgreSQL 13-18 support. I am happy to announce that the development team (just me for no

[...]

Percona Operator for PostgreSQL 3.1.0: Transparent Data Encryption, Logical Replicas, and Persistent Logging
Posted by Viacheslav Sarzhan in Percona on 2026-09-09 at 16:08

Percona Operator for PostgreSQL 3.1.0 takes on three things that decide whether a PostgreSQL platform passes review: is the data encrypted at rest, can it serve reads without straining the primary, and are the logs there when you need them. This release answers all three inside the custom resource, so none of them is a bolt-on you maintain yourself.

The three headline features are transparent data encryption with pg_tde, logical replicas, and persistent logging. pg_tde encrypts your data on disk, including the write-ahead log. Logical replicas add a read-only copy inside the cluster for reporting and analytics. Persistent logging keeps PostgreSQL and pgBackRest logs across Pod restarts.

The operator is open source and runs on any CNCF-certified Kubernetes distribution. This release also widens where it runs, adding official Rancher Kubernetes Engine (RKE2) support and full ARM64 images. Much of what shipped here comes from requests on forums.percona.com and the public issue tracker.

In this post, you’ll learn about:

  • Transparent data encryption with pg_tde
  • Logical replicas for read-only workloads
  • Persistent logging for PostgreSQL and pgBackRest
  • Other improvements worth knowing about

 

Transparent data encryption with pg_tde

Encryption at rest is usually the line item that blocks a database from going into a regulated environment. Storage-level encryption from the cloud provider covers the disk, but it does not protect a copied volume, a leaked backup, or a stray WAL segment, and auditors increasingly want encryption the database itself controls. This release adds transparent data encryption through pg_tde, Percona’s open source TDE extension for PostgreSQL.

 

Why it matters

With pg_tde, the data in tables, indexes, temporary tables, and the write-ahead log stays encrypted on disk, and PostgreSQL decrypts it only in memory for a session that holds the key. That closes the gaps storage encryption leaves open: a snapshot of the volu

[...]

All Your GUCs in a Row: maintenance_work_mem
Posted by Christophe Pettus in pgExperts on 2026-09-09 at 01:00
Unlock faster index builds and vacuum operations by understanding maintenance_work_mem: PostgreSQL's one-allocation memory budget that actually behaves like…

From the Department of It’s About Time: Inter-documentation and image links now work on PGXN
Posted by David E. Wheeler on 2026-09-08 at 22:11

Way back in 2015, I opened a PGXN API issue to allow links between documents rendered by PGXN to work. In 2024 I followed up with another issue to enable relative links to images to work. I mean, everyone wants this, right? It’s how your favorite source code sit works.

Now so does PGXN. As of today, links between documents and to images work. Check it out in the newly-released chdb extension docs, which both link to the chdb and chdb_hook docs and to some nice benchmark graphs.

Or see the Apache Age docs, which includes not only documentation images but also decorative SVGs for the headers.

I’m gradually reindexing all of the extensions so that any other documentation with such links work work; it should be done by tomorrow. Then, at along last, your extensions can look their very best.

The SCaLE 24x CfP is open – get your Postgres talks in!
Posted by gabrielle roth on 2026-09-08 at 19:14
Hi folks! This year’s PostgreSQL@SCaLE committee (Mark Wong, Robert Treat, Darren Douglas, Sarah Conway, and Yours Truly) are gearing up for another excellent conference. We’re setting up the very popular full day beginner track again, and are looking for talks to fill in the rest of our two-day, two-track schedule. SCaLE will take place April […]

Two features just left PostgreSQL 19.
Posted by Joshua Drake in CommandPrompt on 2026-09-08 at 18:41
Both reverts landed after Robert Haas asked the pgsql-hackers list on August 25 whether any of six heavily patched features should come out before 19 ships. One of the two was on his list. One was not.

Introducing chdb Postgres extension: High-performance imports from cloud storage
Posted by David Wheeler in ClickHouse on 2026-09-08 at 15:42

We're happy to announce a new Postgres extension: chdb. This extension expands Postgres import and export features via the chDB library, an in-process ClickHouse engine, providing efficient, flexible conversion to and from a wide array of data formats living on your favorite cloud storage systems.

Benchmark {#benchmark}

And boy howdy do we mean efficient! We compared chdb's performance importing the NYC Taxi dataset (1m rows, wide table) in a number of data formats to three other Postgres extensions, all reading from a regionally-colocated AWS S3 bucket. To the chart!

In order to minimize differences and to optimize for measurement of extension performance rather than infrastructure, the chdb, pg_lake, and pg_duckdb benchmarks ran on r8id.xlarge ClickHouse Managed Postgres services with 4 vCPUs and 32 GB RAM; the aws_s3 benchmark ran on a db.r8g.xlarge AWS RDS host, also with 4 vCPUs and 32 GB RAM. Results average three runs for each import. See the benchmark source code for details.

The Default Deny Dilemma: A Practical Guide to Kubernetes Network Policies
Posted by Wellingtone Luvonga in Cybertec on 2026-09-08 at 03:00

Implementing a zero-trust network model in Kubernetes requires shifting from the default-allow behavior to explicit, label-driven microsegmentation. This hands-on lab walks through securing a standard three-tier architecture (Frontend ⭢ Backend ⭢ Database) using Kubernetes NetworkPolicies, validating both ingress and egress restrictions.

Because standard Kubernetes requires a network plugin to actually enforce these rules, this lab environment uses Calico as the Container Network Interface (CNI). While the YAML manifests are standard Kubernetes API objects, it is the Calico CNI operating under the hood that intercepts the traffic and enforces both our ingress and egress restrictions.

Kubernetes network policy diagram

The Lab Environment

We begin by establishing a baseline three-tier architecture in a dedicated namespace, leveraging specific labels to identify our workloads.

kubectl create namespace production-app
# CREATE FRONTEND POD
kubectl run frontend --image=nginx --labels=tier=frontend -n  production-app
# CREATE BACKEND POD
kubectl run backend --image=nginx --labels=tier=backend -n  production-app
# CREATE DATABASE POD
kubectl run database --image=postgres:18 --labels=tier=database -n  production-app \
  --env="POSTGRES_DB=myapp" --env="POSTGRES_USER=appuser" --env="POSTGRES_PASSWORD=securepass123"

Verify the pods and labels:

kubectl get pods -n production-app --show-labels

NAME       READY   STATUS    RESTARTS   AGE     LABELS
backend    1/1     Running   0          3h6m    tier=backend
database   1/1     Running   0          3h12m   tier=database
frontend   1/1     Running   0          3h6m    tier=frontend

Expose the pods so they can communicate via ClusterIP:

kubectl expose pod frontend --port=80 --target-port=80 -n production-app
kubectl expose pod backend --port=80 --target-port=80 -n production-app
kubectl expose pod database --port=5432 --target-port=5432 -n production-app

Establishing the Baseline

The foundation of Kubernetes network security is a namespace-wide d

[...]

All Your GUCs in a Row: maintenance_io_concurrency
Posted by Christophe Pettus in pgExperts on 2026-09-08 at 01:00
Discover which PostgreSQL maintenance tasks actually use `maintenance_io_concurrency`—the answer is wider and more surprising than the name suggests, and…

PostGIS 3.7.0rc2
Posted by Regina Obe in PostGIS on 2026-09-08 at 00:00

The PostGIS Team is pleased to release PostGIS 3.7.0rc2! Best Served with PostgreSQL 19 Beta 3 , GEOS 3.15.0 , postgis_tiger_geocoder 2025.2 , and address_standardizer.

This version requires PostgreSQL 14 - 19beta3, GEOS 3.10 or higher, Proj 6.1+, and libgmp. To take advantage of all features, GEOS 3.15+ is needed. To take advantage of all SFCGAL features SFCGAL 2.3.0+ is needed. To use postgis_raster extension GDAL 3+ is required.

This release contains fixes since 3.7.0rc1 release.

3.7.0rc2

This release is a release candidate of a major release, it includes bug fixes since PostGIS 3.6.4 and new features.

Birds of a Feather: How About Being a Speaker?
Posted by Xavier Fischer in EDB on 2026-09-07 at 15:54

Context

At Swiss PG Day 2026, I had the privilege of moderating a Birds of a Feather (BoF) session. A BoF session is a community-driven event designed for focused, interactive discussion among participants with shared interests.

I gave a brief introduction to the topic "How about being a speaker", taking from my brief experience of giving talks at Postgres community conferences. This was as much about me learning from others as it was to encourage aspiring speakers to submit to the next Call for Papers.

The room filled up with around 20 participants, an ideal group size to keep the dialogue

Contributions for week 34 & 35
Posted by Cornelia Biacsics in postgres-contrib.org on 2026-09-07 at 10:52

On 26 August 2026, the Adelaide PostgreSQL User Group met, organized by Robins Tharakan. Shadab Mohammad and Robins Tharakan delivered a talk.

On 26 August, the Sydney PostgreSQL User Group met, organized by Shadab Mohammad. Rajesh Kandasamy and Shadab Mohammad delivered a talk.

On 3 September, the PostgreSQL Istanbul Meetup group met, organized by Devrim Gündüz, Gülçin Yıldırım Jelínek & Bilge Korkmaz Erdim. Volkan Çetin and Önder Kalacı delivered a talk.

PGConf Brazil happened from 2-4 September 2026.

Organized by:

Talk Selection Committee:

  • Barbara Leidens,
  • Cammila Martins,
  • Francisco Omar,
  • Francisco Porfírio,
  • Jean Pierre

Speakers:

  • Alfredo Rodriguez,
  • Andreas Scherbaum,
  • Barbara Soares Lara,
  • Breno de Araújo Baima,
  • Bruce Momjian,
  • Carlos Correa Silva Alves,
  • Charly Batista,
  • Dani Monteiro,
  • Daniel Moya,
  • Davy Alvarenga Machado,
  • Dickson S. Guedes,
  • Emanuel Carneiro,
  • Emerson dos Santos Queiroz,
  • Fabrízio de Royes Mello,
  • Fernando Franquini,
  • Fernando Laudares Camargos,
  • Francisco Porfírio Ribeiro Neto,
  • Fábio Telles Rodriguez,
  • Gabriel Batista Menezes,
  • Gabriele Fedi,
  • Guilherme Barreto,
  • Gustavo Lemos,
  • Gustavo Oliveira,
  • Iago Passos,
  • Israel Barth Rubio,
  • Joao Cosme,
  • Joelcio Rizelo,
  • Josiel Lemos Santos,
  • João Marcelo Detomini,
  • Jônatas Davi Paganini,
  • Karin Keller,
  • Marcelo Fernandes,
  • Martín Marqués,
  • Matheus Alcantara,
  • Maurilio Pereira,
  • Nathan Aguiar,
  • Ozano Neto,
  • Patrick de Alvarenga Siqueira,
  • Pedro Luís Teixeira,
  • Rafael de Alencar Segura,
  • Raphael Max Brettas Vieira,
  • Raul Oliveira,
  • Robert Treat,
  • Roberto Mello,
  • Rodrigo Ibraim Teixeira, Shane Borden,
  • William Ivanski,
  • William Lino Oliveira,
[...]

All Your GUCs in a Row: logical_decoding_work_mem
Posted by Christophe Pettus in pgExperts on 2026-09-07 at 01:00
Logical decoding holds uncommitted transactions in memory until commit—and when they get too big, PostgreSQL spills them to disk.

All Your GUCs in a Row: log_parser_stats, log_planner_stats, log_executor_stats, and log_statement_stats
Posted by Christophe Pettus in pgExperts on 2026-09-06 at 01:00
PostgreSQL's oldest logging parameters measure CPU time, page faults, and context switches per statement—crude but irreplaceable when you need to know why a…

All Your GUCs in a Row: log_startup_progress_interval and log_recovery_conflict_waits
Posted by Christophe Pettus in pgExperts on 2026-09-05 at 01:00
Track WAL replay progress on a primary, or diagnose why a standby stalled—two GUCs for the same startup question, answered only in the server log.

Batteries Included: Powering AI DBA Workbench Locally with llama.cpp
Posted by Shaun Thomas in pgEdge on 2026-09-04 at 13:48

We at pgEdge are incredibly proud of our work producing the AI DBA Workbench. It's a monitoring and alerting dashboard with optional AI-driven DBA functionality. But that's the rub, isn't it? The optional AI features are the reason anyone would use it in the first place. It's in the name!It's not simply that AI subscriptions are necessarily expensive, though they can be. There's an additional component of chain-of-custody. Some compliance rules will never allow interacting with an external AI service, or require air-gapped deployments that make such a thing impossible. What then?Great question! The answer can come in a lot of forms, but this time around, let's use llama.cpp. It's a very popular server for running local models. While these are usually not as advanced as a frontier model from OpenAI, Anthropic, or Google, they still offer plenty of value.

Bucket'o'Parts

One thing to understand about the AI DBA Workbench is that it consists of several components, most of which are services. Each one of them requires proper installation, configuration, and automation. The easiest way to handle all of these is, of course, by using Docker. The ai-dba-workbench GitHub repository happens to have a few sample compose files for most of this. And here's the minimum list of services the default file launches:
  • A Postgres database. The workbench uses this for its own data, but it's also the source of the database we'll be interacting with in the example workflow.
  • A collector. This actually gathers data and metadata from the systems the workbench monitors.
  • A server. The workbench server handles API calls from the client, interacts with the configured model, and generally acts as the primary focal point of the collection.
  • An Alerter. An independent service that regularly examines the collected forensics and acts on configured warning and critical thresholds.
  • A client. This is the web service an admin would actually interact with.
That's a lot, isn't it? To make this more fun, it would als[...]

All Your GUCs in a Row: log_lock_waits and log_lock_failures
Posted by Christophe Pettus in pgExperts on 2026-09-04 at 01:00
log_lock_waits is the cheapest lock-contention detector PostgreSQL ships, and through version 18 it is off by default. Turn it on. PostgreSQL 19 will do it for you. The mechanism is borrowed rather than built. When a backend has to sleep on a heavyweight lock (a row, a relation, a transaction ID,…

What Replica Mode Does Not Switch Off
Posted by Mikhail Shytsko on 2026-09-04 at 00:00

An overnight load runs under session_replication_role = replica, the setting most of the popular answers describe as switching enforcement off for the session. It writes an order for customer 999, who does not exist, and then rejects the next row for having a negative amount.

SET session_replication_role = replica;
SET
INSERT INTO orders (customer_id, amount, tenant_id) VALUES (999, 10, 1);
INSERT 0 1
INSERT INTO orders (customer_id, amount, tenant_id) VALUES (1, -5, 1);
ERROR:  new row for relation "orders" violates check constraint "orders_amount_check"

Both statements ran one line apart in the same session, against the same table. The parameter governs which triggers and rules fire, and a foreign key is enforced by a pair of internal triggers that pg_trigger names RI_ConstraintTrigger_c_*, so the foreign key falls silent along with them. No trigger implements a CHECK constraint, which is why that one carries on rejecting rows.

Two columns comparing what session_replication_role = replica switches off, including foreign key checks and ON DELETE actions, against what it leaves enforced, including CHECK, NOT NULL, UNIQUE and row-level security

Two more levers get recommended for the same job. ALTER TABLE ... DISABLE TRIGGER USER (or ALL) works on the table instead of the session, and PostgreSQL 18 added ALTER TABLE ... ALTER CONSTRAINT ... NOT ENFORCED, which works on a single constraint. All three went through one identical probe set below, on a schema built to carry every kind of rule at once.

Key Takeaways

  • Under session_replication_role = replica a load still meets CHECK, NOT NULL, UNIQUE, identity columns and row-level security. Foreign keys, ON DELETE CASCADE, rules and event triggers go quiet, and a trigger marked ENABLE REPLICA fires for the first time in its life.
  • Neither RESET nor ENABLE TRIGGER ALL reads a row on the way back, and VALIDATE CONSTRAINT against a foreign key the catalog already believes is valid answers ALTER TABLE while orphans sit in the table.
  • NOT ENFORCED, added for foreign keys in PostgreSQL 18 and extended to CHECK constraints in 19, is the only lever that scans the table when you switch it back on, and a forced row-level security policy can hide rows from t
[...]

Database Availability Is a Stack: Rolling OS Patching
Posted by Umair Shahid in Stormatics on 2026-09-03 at 16:13

Key takeaways
A routine OS patch can take Postgres offline even when Postgres itself was never touched. Here’s what rolling OS patching on a proper HA cluster changes:

  • OS-level patches (kernel, glibc, container runtime, storage driver) can take Postgres down even though Postgres was never touched.
  • The usual fix, a maintenance window, breaks down once the business runs 24/7 or compliance wants patches applied fast.
  • In a properly built Patroni HA cluster, OS patching is rolling and one node at a time. Postgres binaries, config, and data never change.
  • Process: patch and rejoin each replica first, switch over to an already-patched node, then patch the old primary last.
  • Safety depends on connection routing that follows the leader, replication caught up before switchover, honest health checks and quorum, reproducible node images, and a switchover you’ve already tested.
  • A switchover causes a brief pause, not an outage, but you need at least one replica. A single-node database still needs a maintenance window.

A database went offline for a security patch, and Postgres was never the thing being patched.

The team needed an OS update across the cluster. Kernel level, the kind that only takes effect after a reboot. So they did what most teams do the first time this comes up: booked a maintenance window, took the database down, patched, rebooted, and brought it back. A clean, planned database outage for something that had nothing to do with the database.

I understand why it happens. But it points to a gap in how many teams think about uptime, and it is worth walking through because the fix costs you nothing on patch night once the cluster is built for it.

The Database Doesn’t Stand on Its Own

Your database runs on an operating system. That OS runs on a kernel.In most modern setups, that means a container runtime, a storage layer, a network layer, and underneath it

[...]

PostgreSQL RPM repo comes to Amazon Linux 2023!
Posted by Devrim GÜNDÜZ in EDB on 2026-09-03 at 14:50

If you run PostgreSQL on EC2, you've had two real choices until now: build from source, or fall back to whatever version Amazon Linux itself carries in its base repos. Neither matches what the rest of the PostgreSQL community gets from yum.postgresql.org — the full extension ecosystem, day-one minor releases, and a consistent layout across distributions.



That gap is closed. Amazon Linux 2023 is now a first-class target of the PGDG YUM repository, with its own build root and its own package tree, right next to Enterprise Linux, Fedora, and SUSE.



Summary first:



 





 



 



 



 



 


Continue reading "PostgreSQL RPM repo comes to Amazon Linux 2023!"

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.