Latest Blog Posts

A "TPC-C"-like "extension-pack" for pgbench
Posted by Kaarel Moppel on 2025-09-05 at 21:00
TPC-C is supposedly the most objective performance measurement of OLTP database systems… and I’ve used it quite a fair bit over the years as well…yet, running it on Postgres is sadly not exactly as smooth as things typically are with Postgres 😔 If to compare at least with the wonderful...

Postgres Ibiza 2025: October 15-17th
Posted by Álvaro Hernández in Fundación PostgreSQL on 2025-09-05 at 14:01

Postgres Ibiza 2025: October 15-17th

Postgres Ibiza 2025 is back in October. A three-day event split into:

  • Conference: 2 days, October 15th and 16th.
  • Unconference: 1 day, October 17th, following the spirit of the best open spaces.

The event will be held in the same conference venue as the last editions, the spectacular Palacio de Congresos de Ibiza which happens to be a few steps away from many hotels… and the beach!

Postgres Ibiza 2025 builds on the success of the last editions (2024, 2023 and 2019, before the pandemic) and brings a refreshing, open and diverse Postgres conference. Where all ideas can be shared, the future of Postgres discussed and stronger connections can be made in a truly unique environment.

Call For Papers

Call For Papers is still open, until September 10th. The topic selection is quite open, but here are a few suggested themes to consider:

  • Core Innovations: Cutting-edge advancements in Postgres core development and key technologies.
  • Creative Extensions: New and innovative extensions that enhance Postgres.
  • Containers & Kubernetes: Best practices for running Postgres in containerized environments.
  • Compatible Forks: Insights into fully Postgres-compatible variants and forks.
  • Cloud Databases: Exploring the benefits of cloud databases that support Postgres.
  • Protocol Compatibility: Databases that utilize Postgres-compatible protocols.
  • Innovative Projects: Any unique and novel projects related to Postgres.
  • Database Comparisons: Demonstrate what other databases do better and how they compare to Postgres.

If you have any questions about the CFP or simply want to get in touch with the Committee, please contact us. If you are unsure about submitting a talk, it’s your first time, or just need some help, we will be happy to assist and provide guidance.

Call for Sponsors

Postgres Ibiza is organized by the non-profit Fundación PostgreSQL, and is a PostgreSQL Community Event. Every sponsorship or donation is key for th

[...]

Best Practices for Achieving High Availability in PostgreSQL with Patroni and Pgpool
Posted by semab tariq in Stormatics on 2025-09-04 at 17:09

I recently completed a training session for one of our customer on best practices for achieving HA clusters with Patroni and Pgpool in PostgreSQL. During the sessions, different points were discussed, but I’d like to highlight a few that should be carefully considered when designing HA clusters.

1. Use HTTPS for Patroni and ETCD Communication

It’s important to secure communication between data nodes and ETCD nodes to prevent man-in-the-middle attacks. Using HTTPS is recommended for this purpose. You can generate certificates and configure them on all nodes to enable secure HTTPS communication.

2. Use ETCD3 in Patroni.yml File

ETCD is a distributed and reliable key-value store that holds critical data for a distributed system, including the current state of the cluster and details about the primary node. In the patroni.yml file, we must specify the location of the ETCD node. Since ETCD version 2 is no longer supported, we recommend using ETCD version 3, which is more stable, production-ready, and improves overall reliability.

3. Use scram-sha-256 Authentication method for pg_hba.conf file

Using the SCRAM-SHA-256 authentication method in the pg_hba.conf file is highly recommended, as it provides stronger security compared to MD5. SCRAM-SHA-256 protects against brute-force and replay attacks by using salted and iterated password hashing, making stored credentials much harder to crack.

4. Run the Latest – 1 Version of PostgreSQL

Running the latest minus one version of PostgreSQL is generally recommended for production environments. This ensures that you benefit from recent performance improvements, security patches, and stability enhancements while avoiding the risks that may come with very new major releases.

5. Should We Install All Software on Data Nodes or Separate Nodes?

There are pros and cons to both approaches, and the choice depends on

[...]

PGConf.EU 2025 - PostgreSQL Conference Europe 2025 Schedule Published
Posted by Karen Jex in PostgreSQL Europe on 2025-09-04 at 15:33

The programme for PGConf.EU 2025, taking place on 21–24 October in Riga, is now live!

Discover the exciting lineup of world-class PostgreSQL speakers and exciting topics that await you on the schedule for this year.

This year’s conference also features a Community Events Day on Tuesday, with limited spaces available.

We look forward to seeing you in Riga in October!

New Presentation
Posted by Bruce Momjian in EDB on 2025-09-04 at 15:15

I just gave a new presentation at PGConf.Brazil titled Three Key Attributes of Postgres. It is similar to my existing The Postgres Trajectory talk, but with more of a business and global focus. It also a psql output slide full of puns at the beginning, and hints to the puns at the end. I will be presenting my Databases in the AI Trenches talk tomorrow.

FOSSY 2025 and RAGtime with Postgres
Posted by Jimmy Angelakos on 2025-09-04 at 13:57

Obligatory photo from FOSSY 2025

I've just returned from the rapidly growing Free and Open Source Yearly conference, or FOSSY 2025, which took place from July 31st - August 3rd, 2025, in Portland, Oregon. Organized by the incredible team at the Software Freedom Conservancy, the event was an awesome gathering of minds dedicated to the principles of free and open-source software.

I gladly took the opportunity to connect with the community again, and remind myself of the passion and dedication that fuels FOSS. The work that the Software Freedom Conservancy does is important for the health and sustainability of the ecosystem, and it was inspiring to be surrounded by people who share that vision.

PostgreSQL @ FOSSY 2025

PostgreSQL was also present with a dedicated booth (thanks to PgUS, and of course Postgres-related talks. I was thrilled to contribute my own talk, about using Postgres for AI work:

Exploration: CNPG Kubectl Plugin
Posted by Umut TEKIN in Cybertec on 2025-09-04 at 04:30

Introduction

We have explored how to create cluster, take backups, connect to the cluster and run psql commands in our CNPG series. However, one might feel overwhelmed because of those day - to - day operations. That is why CNPG provides a kubectl plugin. CloudNativePG' s plugin enriches kubectl with a set of PostgreSQL - focused commands, making easier to inspect clusters, trigger backups, promote a new instance, run pgbench and run psql commands without leaving existing terminal. Even though it is a pretty simple and straightforward topic, but it is important for completeness of our CNPG series.

Pugin Installation

There are different ways to install the plugin, but I found installing using the script easiest for me:

curl -sSfL \
  https://github.com/cloudnative-pg/cloudnative-pg/raw/main/hack/install-cnpg-plugin.sh | \
  sudo sh -s -- -b /usr/local/bin
cloudnative-pg/cloudnative-pg info checking GitHub for latest tag
cloudnative-pg/cloudnative-pg info found version: 1.27.0 for v1.27.0/linux/x86_64
cloudnative-pg/cloudnative-pg info installed /usr/local/bin/kubectl-cnpg

Commands

The pluging provides a variety of commands. "--help" is useful to get help for exploring available commands. For example;

kubectl cnpg --help

If a help is needed for a specific command then;

kubectl cnpg promote --help

Install

This command is used to generate a yaml manifest that is used for the installation of the operator. In this way, we can modify the default settings of the operator such as # replica and installation namespace.

kubectl cnpg install generate -n cnpg-system --replicas 3 --watch-namespace "$my_namespace_2_watch" > install_operator.yaml

Status

Status command show us the current status of respective cluster:

kubectl cnpg status cluster-example-backup
Cluster Summary
Name                 cnpg-system/cluster-example-backup
System ID:           7545128324982542354
PostgreSQL Image:    ghcr.io/cloudnative-pg/postgresql:17.5
Primary instance:    cluster-example-backup-1
Primary s
[...]

From DBA to DB Agents
Posted by Gülçin Yıldırım Jelínek in Xata on 2025-09-03 at 15:30
Discover how a PostgreSQL DBA’s decade of expertise evolved into designing Xata’s AI-powered Postgres agent, automating monitoring and observability.

Partitioned table statistics
Posted by Laurenz Albe in Cybertec on 2025-09-02 at 05:39

A misunderstanding about partitioned table statistics: when asked about them, a man answers that they have 5 partitioned tables with 80 partitions each, but wonders why that is important for the optimizer
© Laurenz Albe 2025

I recently helped a customer with a slow query. Eventually, an ANALYZE on a partitioned table was enough to fix the problem. This came as a surprise for the customer, since autovacuum was enabled. So I decided to write an article on how PostgreSQL collects partitioned table statistics and how they affect PostgreSQL's estimates.

What do I mean by “partitioned table statistics”?

I am talking about optimizer statistics as defined in my article about preserving statistics during an upgrade. These are the data that the query optimizer uses to estimate the cost of execution plans. You can view the optimizer statistics for table columns in the system view pg_stats.

In PostgreSQL, a partitioned table is a logical construct, somewhat similar to a view. A partitioned table does not hold any data itself. The data reside in the partitions of the partitioned table. Inserting a row into a partitioned table actually inserts the row into the appropriate partition. In PostgreSQL, partitions are ordinary tables that just have a “side job” as a partition of a partitioned table.

When I talk about partitioned table statistics, I mean the optimizer statistics for the partitioned table itself, as opposed to the optimizer statistics of its partitions.

An example for statistics on a partitioned table

To demonstrate statistics on a partitioned table, I am going to use a simple example:

CREATE TABLE tab (
   pk integer NOT NULL
) PARTITION BY LIST ((pk % 2));

CREATE UNLOGGED TABLE tab_even
PARTITION OF tab FOR VALUES IN (0);

CREATE UNLOGGED TABLE tab_odd
PARTITION OF tab FOR VALUES IN (1);

I used unlogged tables for better performance, because we don't need crash recovery. Each of the partitions will receive half of the rows I INSERT into the table:

INSERT INTO tab
SELECT * FROM generate_series(1, 1000000);

Partitioned table statistics and autovacuum

With the default configuration, the autovacuum launcher will sleep for up to a minute before becoming active. Then it will p

[...]

PostGIS 3.6.0
Posted by Regina Obe in PostGIS on 2025-09-02 at 00:00

The PostGIS Team is pleased to release PostGIS 3.6.0! Best Served with PostgreSQL 18 Beta3 and recently released GEOS 3.14.0.

This version requires PostgreSQL 12 - 18beta3, GEOS 3.8 or higher, and Proj 6.1+. To take advantage of all features, GEOS 3.14+ is needed. To take advantage of all SFCGAL features, SFCGAL 2.2.0+ is needed.

3.6.0

This release includes bug fixes since PostGIS 3.5.3 and new features.

Run Jepsen against CloudNativePG to see sync replication prevent data loss
Posted by Jeremy Schneider on 2025-09-01 at 21:28

Are you in the Pacific Northwest?

Want to learn more about topics related to this blog? At 3:15p on Thu Nov 13 in KubeCon Atlanta, I’ll be speaking with Leonardo Cecchi about distributed systems theory applied to standard open source postgres cluster reconfigurations.


Jepsen is a testing framework for distributed systems that verifies safety guarantees by subjecting clusters to faults (e.g., network partitions, crashes, and failovers) and checking for consistency violations. In this lab exercise, we will use Jepsen to illustrate data loss when synchronous replication is disabled and cluster reconfigurations occur involving postgres failover.

Postgres synchronous replication ensures that transactions are only committed once changes are written to both the primary and a synchronous standby, which is crucial for preventing data loss during automated failovers by guaranteeing no acknowledged transaction is lost if the primary crashes.

In addition to crashes, synchronous replication is (and always has been) the only protection against data loss during network partitions or split brains with Postgres – across all Postgres HA frameworks. There was a little confusion recently around Patroni’s “failsafe” feature. Failsafe is a useful feature but it does not prevent data loss during network partitions – Patroni relies on postgres sync replication to prevent data loss during network partitions, sim

[...]

The Hidden Bottleneck in PostgreSQL Restores and its Solution
Posted by warda bibi in Stormatics on 2025-09-01 at 15:45

In July 2025, during the PG19-1 CommitFest, I reviewed a patch targeting the lack of parallelism when adding foreign keys in pg_restore. Around the same time, I was helping a client with a large production migration where pg_restore dragged on for more than 24 hours and crashed multiple times.

In this blog, I will talk about the technical limitations in PostgreSQL, the proposed fix, and a practical workaround for surviving large restores.

Background 

There are two main types of backups in PostgreSQL:

  • Physical backups (e.g., pg_basebackup, file-level copies): these copy the database files as they exist on disk. Restoring is fast, but the backup can only be used on the same PostgreSQL version and often requires identical hardware or configuration.

     

  • Logical backups (pg_dump and pg_restore): instead of copying raw files, PostgreSQL exports the database into SQL statements. These statements describe how to rebuild everything: the schema (CREATE TABLE, CREATE INDEX), the data (using COPY), and the constraints (ALTER TABLE … ADD FOREIGN KEY).

The trade-off is that logical restore is not just a copy , it’s a rebuild. PostgreSQL has to re-run all those CREATE, COPY, and ALTER statements as if the database were being created for the first time.

The Core Problem

On small databases, logical backup and restore are very quick, but on multi-terabyte systems with thousands of partitions, this process can stretch for days. Data can often be restored quickly, but steps like validating foreign keys or building indexes can take exponentially longer. This is because when you run:

ALTER TABLE the_master_partitioned_table

ADD CONSTRAINT ...

FOREIGN KEY (columnX) REFERENCES another_table(columnX);

Under the hood, PostgreSQL has to scan all rows in the child table (table_partition) and check that each value exists in the parent table (another_table). And this is done with an anti-join query like

[...]

pg_tde can now encrypt your WAL on PROD!
Posted by Jan Wieremjewicz in Percona on 2025-09-01 at 11:00

Just recently, we announced the production-ready release of pg_tde, bringing open source Transparent Data Encryption (TDE) to PostgreSQL. Now, I may have spoiled the fun a little with the title, but take a look at the word puzzle below—can you guess the announcement? Bear with me… and my sense of humor, which might be a bit too dry for some :)

 
Yes, it’s an elephant carrying logs to a safe. Because Write Ahead Log (WAL) deserves secure storage!

At the time of the TDE GA release, one of the most common questions was:

Maza and Baza: A Tale of GSoC'25 ABI Compliance Checker project
Posted by Mankirat Singh on 2025-08-30 at 00:00
A deep dive into the evolution of my GSoC'25 project: the PostgreSQL ABI Compliance Checker. I share my journey of developing the ABICompCheck module using the PostgreSQL BuildFarm, learning Perl, setting up a CGI Server, and launching a public BuildFarm animal to run checks every 24 hours.

GSoC'25 at PostgreSQL: Work and Results
Posted by ahmed gouda in Cybertec on 2025-08-29 at 21:44

In the previous post, I discussed GSoC, my road to acceptance at PostgreSQL, and my project deliverables.

Today, I will share my experience with the PostgreSQL community, and the work I did.

Postgres Community Bonding

The first phase of GSoC is community bonding, where the mentee gets to know the community of his organization.

For Postgres, I started searching for the communication channels used by contributors, I found out about Postgres mailing lists which unfortunately I hadn’t been involved into it that much till now, but I also discovered the PostgreSQL Hacking Discord channel and the Hacking Workshops they host every month to study and discuss PostgreSQL topics, which have been a great learning resource for me since then.

PGConf.EU Community Events Day: CfPs closing soon
Posted by Gülçin Yıldırım Jelínek in Xata on 2025-08-29 at 17:15
PGConf.EU’s first Community Events Day organized by community members: summits, showcases and trainings. Last few days to submit talks!

Contributions for the weeks 32 - 35 (2025-08-04 - 2025-08-28)
Posted by Floor Drees in postgres-contrib.org on 2025-08-29 at 08:52

Clearly it's summer time in the Northern Hemisphere and we haven't been as punctual with our recognition posts! We'll resume to a more regular schedule, promised!

On Aug, 28 Peter Zaitsev and Emma Saroyan organised PG Armenia x Percona University.

Speakers: * Peter Zaitsev * Andrey Borodin * Emma Saroyan * Konstantin Trushin * Dmitrii Kochetov * Alexey Palazhchenko * Alex Demidoff * Eugene Klimov * Kim Saroyan * Alexander Zaitsev * Aya Guseinova * Piotr Kalmukhyan

Hyderabad Postgres Days 2025 took place on August 21-22.

Organisers: * Ameen Abbas * Hari Kiran P * Rajesh Madiwale

CfP Committee: * Deepak Maht * Gayathri Varadarajan * HariKrishna B * Jobin Augustine * Pavlo Golub

Workshops: *Jobin Augustine * Bikash Chandra * Sashikanth Pattanaik * Neeta Goel * Ramanathan Natarajan * Ameen Abbas * Rajesh Madiwale * Padma MP * Pranay Shree

Speakers: *Akshat Jaimini * Shreya Aithal * Aswini Kumar Tummak * Sai Krishna Namburu * Sivasankar Prasad * Kattamuri Kowshiq * Ragesh Hajela * Chiranmoy Bhattacharya * InduTeja Aligeti * Bhavani Akundi * Kshetrapaldesi Tutika * Yogesh Jain * Nikhil Hegde * Vikas Gupta * Rajesh Madiwale * Aryan Sharma * Lahari Giddi * Keerthi Seetha * Amit Jain * Shameer Bhupathy * Jobin Augustine

On Aug, 21th, Emma Saroyan organised the Armenian PostgreSQL User Group.

Speakers: * Andrey Borodin * Maksim Dubakin

On Aug, 14th, Emma Saroyan and Vladimir Poghosyan organised and spoke at the Armenia PostgreSQL User Group Meetup

Postgres Woman India Virtual Summit happened on August 6th, 2025.

Organised by: * Hari Kiran * Aarti Nadekar * Kalyani Madipadga * Praveena Sivasankar

Speakers: * Emma Saroyan * Tarunikaa Kumar * Taticherla Begum * Lahiri Giddi * Keerthi Seetha

Who logged to system from multiple countries in 2 hours?
Posted by Hubert 'depesz' Lubaczewski on 2025-08-29 at 08:15
Yesterday someone posted a set of queries for interviews, all centered on answering business-like questions from database. Today this post is hidden behind some “subscribe to read more" thing, so I will not even link it, but one question there caught my eye. Since I can't copy paste the text, I'll try to write what … Continue reading "Who logged to system from multiple countries in 2 hours?"

Highlights of PostgreSQL 18
Posted by Ahsan Hadi in pgEdge on 2025-08-28 at 06:27

The PostgreSQL development group released the second Beta version of PostgreSQL 18 in July; the GA version is expected later in 2025 (around the September/October timeframe). The PostgreSQL development group and its community is very dedicated and ensures several minor releases during the year and major releases every year.

Why You Should Perform a Major Version Upgrade

Every major PostgreSQL release comes with significant new features that improve the stability, performance, and usability of PostgreSQL as well as the user experience. Each new release brings critical security patches, performance improvements, and new SQL features that can simplify development and reduce technical debt.Upgrading ensures continued community and vendor support, compatibility with evolving infrastructure and libraries, and access to enhancements in scalability, monitoring, and disaster recovery. Staying current also reduces the risk and cost of future migrations, as skipping multiple versions makes upgrades more complex and disruptive. In short, regular major upgrades keep PostgreSQL stable, fast, secure, and ready for future growth.The global and vibrant PostgreSQL community is contributing to PostgreSQL success, diligently ensuring that all changes are carefully scrutinized and reviewed before they are added to the project source code. It is also very encouraging to see big technology names like Microsoft, Google, Apple, and others investing in Postgres by developing in-house expertise and giving back to the open source community.Upgrading to PostgreSQL 18 delivers significant benefits in performance, security, and ease of management, making it a smart move for both technical and business reasons. The new asynchronous I/O engine and smarter indexing features speed up queries and maintenance tasks, while improved pg_upgrade with preserved planner statistics ensures faster, low‑risk version upgrades. Developers gain productivity with virtual generated columns, enhanced RETURNING support, and built‑in uuidv7() for better index[...]

Using JWT to establish a trusted context for RLS
Posted by Tomas Vondra on 2025-08-27 at 10:00

Row-level security (RLS) is a great feature. It allows restricting access to rows by applying filters defined by a policy. It’s a tool useful for cases when the data set can’t be split into separate databases.

Sadly, using RLS may be quite cumbersome. RLS requires some sort of “trusted context” for the RLS policies. The policies need to filter using data the user can’t change. If the filter uses some sort of “tenant ID”, and the user can change it to an arbitrary value, that would break the RLS concept.

This is why solutions like using GUCs are flawed, because the access control for GUC is very limited. The traditional solution is to use roles, which derives the trust from authentication.

It occurred to me it should be possible to build a trusted context on cryptography, independently of authentication. I’ll explain the basic idea, and discuss a couple interesting variations. I’ve also published an experimental extension jwt_context, implementing this using JWT.

I’m interested in all kinds of feedback. Is it a good idea to use JWT this way, as a basis for RLS context? Did I miss some fundamental issue? Are there interesting improvements?

PgPedia Week, 2025-08-24
Posted by Ian Barwick on 2025-08-25 at 10:24
PostgreSQL 19 changes this week ALTER DOMAIN ALTER DOMAIN ... VALIDATE CONSTRAINT executes at lock level ShareUpdateExclusivelock instead of ShareLock PL/Python event trigger support added sync_replication_slots if enabled, now requires wal_level to be set to logical

more...

PostGIS 3.6.0rc2
Posted by Regina Obe in PostGIS on 2025-08-25 at 00:00

The PostGIS Team is pleased to release PostGIS 3.6.0rc2! Best Served with PostgreSQL 18 Beta3 and recently released GEOS 3.14.0.

This version requires PostgreSQL 12 - 18beta3, GEOS 3.8 or higher, and Proj 6.1+. To take advantage of all features, GEOS 3.14+ is needed. To take advantage of all SFCGAL features, SFCGAL 2.2.0+ is needed.

3.6.0rc2

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

PgPedia Week, 2025-08-17
Posted by Ian Barwick on 2025-08-23 at 00:31

The middle of August tends to be a quieter time in the PostgreSQL development cycle, so there's not much in the way of new developmentst to report.

This week's main item of interest is the quarterly release of PostgreSQL minor version updates.

PostgreSQL 19 changes this week

PostgreSQL 19 beta3 was released this week.

more...

Cold, Warm, and Hot Standby in PostgreSQL: Key Differences
Posted by semab tariq in Stormatics on 2025-08-22 at 11:54

When working with customers, a common question we get is: “Which standby type is best for our HA needs?” Before answering, we ensure they fully understand the concepts behind each standby type and provide the necessary guidance

A standby server is essentially a copy of your primary database that can take over if the primary fails.

There are different types of standby setups, each with its own use cases, pros, and cons. In this blog, we will discuss the three types: Cold Standby, Warm Standby, and Hot Standby.

1. Standby Types

1.1. Cold Standby 

A cold standby is simply a backup server that is powered off or not running PostgreSQL until the primary server fails. It usually relies on periodic backups or filesystem snapshots.

When the primary fails, you manually bring up the standby by restoring backups or activating the server.

1.2. Warm Standby

A warm standby is a standby server that continuously receives WAL (Write-Ahead Log) files from the primary database, but it does not serve application queries. It remains in recovery mode, applying the incoming WAL files to stay updated.

If the primary server fails, the warm standby can be promoted to the new primary through manual failover.

1.3. Hot Standby

A hot standby is an active standby server that streams WAL data from the primary in near real time. While applying changes, it also supports read-only queries, making it useful for offloading reporting or analytics workloads. 

In the event of a failure, the standby can be quickly promoted to the primary through automated failover.

2. Pros, Cons, and Use Cases of Each Standby Type

Standby Type Pros Cons When to Use
Cold Standby Simple to set up
[...]

PgPedia Week, 2025-08-10
Posted by Ian Barwick on 2025-08-22 at 10:39
PostgreSQL 19 changes this week pg_stat_progress_basebackup column backup_type added PostgreSQL 18 articles "enable" parameters will work differently in Postgres 18 (2025-08-07) - Michael Christofides / pgMustard

more...

Learning PostgreSQL from AI and JSON exploration: Part 2
Posted by Regina Obe in PostGIS on 2025-08-21 at 06:05

This is the second part of the series I started on Learning PostgreSQL from AI and JSON exploration: Part 1. For this 2nd part, I decided to try gpt-oss the 14GB model which was just released in the past week. My first impression, "When will this ai shut up about its thinking process?". Phi4 on the other hand gave a bit of a narrative about how it came up with answers but it did not write a novel about it and it also seemed more personable, using "My and I" instead of a distanced "User wants to". However gpt-os did become less chatty with a bit of coaxing. So anyway personality wise I prefer phi4. That is not to say that Gpt-oss doesn't have some wow factor. It created perfect SQL each time. I did not need to correct it. One of the other neat features of this model which I haven't had time to explore is ability to have it do brower searches and other agentic like stuff.

Again for this size model, speed of answering with my crappy graphics card and processor was not bad, but it was noticeably slower than Phi4. Given the impressive accuracy, I didn't mind too much and I suspect can be improved by tweaking some of its settings.

Continue reading "Learning PostgreSQL from AI and JSON exploration: Part 2"

Exploration: Migration to CNPG
Posted by Umut TEKIN in Cybertec on 2025-08-21 at 06:00

Introduction

In our CNPG series, we have explained how to create a PostgreSQL cluster and how to customize it. However, most of the time, we don't have the luxury to start to use a database from scratch. We might have already started a project without high availability and we might be looking for an easy-to-manage environment on cloud native environment. In this case, CNPG is the answer, but how do we migrate our existing cluster to CNPG? In today's article, we will explain that.

There are a couple ways to migrate an existing cluster to CNPG; pg_basebackup, import, and logical replication. We will examine pg_basebackup and import methods today. Depending on the use case or the requirement, we might need to use a different method.

Requirements and Limitations for pg_basebackup Method

pg_basebackup, as usual, does let us create a physical copy from a source cluster. Because we are creating a physical copy of the existing cluster, the limitations are a bit more strict than for the import method. The requirements for pg_basebackup are as follows;

  • Source and target hardware architecture must be the same.
  • Source and target major PostgreSQL version must be the same.
  • On the source, we need an appropriate user with REPLICATION privilege.
  • The source must accept connections from the target cluster using replication user.
  • On the source, we need enough max_wal_sender for pg_basebackup and for streaming WAL segments.

As of now, CNPG version v1.27 has only one limitation for pg_basebackup, snapshot copy. In order to start creating the physical copy pg_basebackup takes a snapshot of the source cluster. Concurrently, it also streams WAL segments to the target cluster from the beginning of the process until the end of the backup. Once this process is completed, the cluster diverges and starts on a new timeline from the source. That is why all write operations on the source must be stopped before starting the migration process.

Note: this limitation only applies when the ta

[...]

PostgreSQL Database SLAs: Why Hidden Issues Often Break Customer Commitments
Posted by Umair Shahid in Stormatics on 2025-08-20 at 12:18

SLAs feel reassuring when signed—but their substance lies in what happens behind the scenes. Often, the most damaging breaches don’t stem from cloud outages or server failures, but from invisible issues hidden in how PostgreSQL was initially set up and configured. Increasingly sluggish queries, split-brain scenarios, silent backup failures, any of these can suddenly explode into customer-facing crises.

1. Slow Queries: The Sneaky SLA Saboteur

The Hidden Cost of Delayed Queries

A seemingly minor tuning oversight, like a missing index or outdated statistics, can turn a 200 ms query into a 10-second slog. It might not seem urgent initially, but as concurrency increases, cascading delays build up.

A Slow Query Accelerated 1000×

In one case study, an engineer faced a painfully slow query that scanned 50 million rows through a sequential scan—even though it was a simple query filtering on two columns (col_1, col_2) and selecting by id. After creating an index using those columns plus an INCLUDE (id) clause, the query performance improved dramatically: what had taken seconds dropped to just milliseconds, representing up to a 1,000× improvement in the worst-case runtime. [Ref: Learnings from a slow query analysis in PostgreSQL] 

This shows how even a simple query, if not indexed properly, can pose an SLA risk as data volume increases.

PostgreSQL Mechanics: How This Happens

  • Inefficient query plans: Without proper indexing, the query planner is forced into slow sequential scans on large tables. 
  • Index-only scans: Leveraging PostgreSQL’s INCLUDE clause to add ‘id’ to the index enables index-only scans—eliminating the need to fetch table rows altogether. 
  • pg_stat_statements and EXPLAIN (ANALYZE): Essential tools for identifying slow queries and understanding how the database executes them in real time. 
  • Auto-va
[...]

Fun and weirdness with SSDs
Posted by Tomas Vondra on 2025-08-20 at 10:00

When I started working with Postgres (or databases in general) 25 years ago, storage systems looked very different. All storage was “spinning rust” - rotational disks with various interfaces (SATA/SAS/…) and speeds (7.2K/10k/15k/…). The spindle speed was the main performance determining feature, and everyone knew what IOPS and bandwidth to expect from a disk. The general behavior was pretty much the same.

With SSDs it’s more complicated. The interface may be the same, but the hardware “inside” the device can be very different. There’s nothing like the “spindle speed”, a single feature determining fundamental behavior. The flash memory is subject to various limits, but manufacturers may (and do) make different tradeoffs (much more cache, more spare space, etc.). And the hardware changes a lot over time too.

While working on the index prefetching patch, I ran into a couple weird differences between “very similar” queries. And we speculated it might be due to how SSDs handle the different I/O patterns. I did testing on my SSD devices, and there definitely are some very surprising differences in behavior, contradicting (reasonable) expectations. Let’s look at the results, and how it can result in strange query timings.

Postgres Logging for Performance Optimization
Posted by Elizabeth Garrett Christensen in Crunchy Data on 2025-08-19 at 12:00

A modern-day Postgres instance creates robust and comprehensive logs for nearly every facet of database and query behavior. While Postgres logs are the go-to place for finding and debugging critical errors, they are also a key tool in application performance monitoring.

Today let’s get set up with logging for Postgres - starting with the basics of what to log, how to log what you want, and as reward for your hard work - how to use these to monitor and improve performance. The Postgres docs on logs are excellent, so please consult those for the most up to date and comprehensive configurations. This blog reads between the lines a bit beyond the docs to offer some practical advice and settings. As always, your mileage may vary.

Let’s get into it and talk about:

WAL note: This post is limited to the server’s message and error logging - not the transaction Write Ahead Log (WAL). While that is a log, the purpose of WAL is to log all data and schema changes for backups, disaster recovery, and replication streaming.

Initiating logging for Postgres

First thing, out of the box Postgres just sends logs to the terminal. To turn on sending things to log files, turn on the logging collector.

logging_collector = on

What file format do you want for logs?

The log message formatting is determined by log_destination parameter, which can be set to one or more of: stderr, csvlog, jsonloglog, and syslog. stderr is the default. Use commas to separate values when using more than one logging destination:

-- setting multiple log destinations
log_destination = 'stderr,json'

If logging_collector = 'on', then stderr, csvlog, and jsonlog logging will go to files in the directory specified by log_directory, with csv and json requiring that the logging collector be enabled.

There are many reasons why logs may be written in multiple file fo

[...]

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.