PostgreSQLDev & Eng

Content type: Concept

5 min read

PostgreSQL's default five-minute checkpoint can inflate WAL by dozens of percentage points

Article · Dev & Eng
Reading
5 min
Tables
1
In short

A survey by consulting firm Stormatics found that, for a client running PostgreSQL on Supabase, 39% of the 1.8 TB of WAL generated daily came solely from the default five-minute checkpoint. The fix didn't require switching databases or providers.

Stormatics, a consulting firm specialized in PostgreSQL, published on November 25, 2026 an account of a support engagement with an AI-native SaaS team running the database on Supabase. The symptom was WAL (write-ahead log) growing too fast: 1.8 TB per day. The cause, according to Umair Shahid's post, wasn't in the application or the platform. It was in a parameter most teams never touch: checkpoint_timeout.

The checkpoint behind the recovery promise

PostgreSQL writes every change to the WAL before touching the data files. It's this sequential record that allows the database to recover after a crash: you just need to replay the WAL written since the last safe point. That safe point is the checkpoint, the moment when PostgreSQL forces all dirty pages from memory to disk.

A checkpoint fires when one of two thresholds is reached: the time set in checkpoint_timeout (five minutes by default) or the volume in max_wal_size. In databases with meaningful write traffic and a max_wal_size sized with headroom, the clock almost always wins. In practice, that means a checkpoint every five minutes, all day long.

Why the five-minute default is costly

With full_page_writes enabled, the recommended default, the first modification to each page after a checkpoint forces PostgreSQL to write the entire 8 kB page to the WAL, not just the difference. This behavior protects against corrupted pages ("torn pages") if the server crashes in the middle of a disk write.

Expert views

What people are saying about it.

Vercel has enabled, via Vercel MCP, permission for agents to create virtual models, adjust routing, and set spending budgets in the AI Gateway without having to open the dashboard.

Carina Ferreirain an iMasters article · Read the article: Vercel MCP now lets AI agents configure the AI Gateway in natural language

JetBrains has confirmed that CVE-2026-114938, nicknamed Java4Shell, affects the JBR embedded in all its IDEs as well as the JDK running in production. There's a patch and a workaround, but they are separate fixes.

Bisneto Bragain an iMasters article · Read the article: Java4Shell vulnerability exposes JVM in production: here's how to fix it now

Kubernetes 1.38, expected on December 16, 2026, drops environment variables used in scripts, retires a legacy cgroup mechanism, and changes swap behavior. Here's what to review before upgrading your cluster.

Rafael Oliveirain an iMasters article · Read the article: Kubernetes 1.38 comes with changes that can break CI/CD and legacy nodes

The problem is that every checkpoint resets this "first modification" counter for every page in the database. In hot tables and indexes, touched constantly, each checkpoint triggers a new wave of full-page images. A single-row UPDATE, changing just a few bytes, can cost a full 8 kB of WAL, repeated every five minutes, for every page it lands on.

Multiplied across several high-volume tables and their indexes, the aggregate effect is exactly what Stormatics measured: more than a third of the WAL stream spent just on page copies, not on actual data changes. More WAL means more disk I/O, more archiving and backup space, more replicated data, and slower recovery after a failure.

It ends up looking like "the database can't keep up.

Umair Shahid, Stormatics

The case: 1.8 TB per day, 39% in page images

In the client analyzed by Stormatics, the WAL breakdown showed that 39% of the daily volume were full-page images generated by the checkpoint cycle, not by the workload itself. It's a number from one specific case, not a universal ratio, but it illustrates a pattern that any database with hot tables and a factory-default checkpoint setting can reproduce.

Chart from Stormatics shows that about 39% of the 1.8 TB of daily WAL are full-page images generated right after each checkpoint
Chart from Stormatics shows that about 39% of the 1.8 TB of daily WAL are full-page images generated right after each checkpoint. Source: postgr.es.

How to diagnose this in your own database

No special tooling is needed for the initial diagnosis. Four sources, all native to PostgreSQL, already give a reasonable picture:

  • In PostgreSQL 14 or newer, the pg_stat_wal view exposes wal_records, wal_fpi (full-page images), and wal_bytes. Take two samples an hour apart and compare the fraction of wal_fpi over the total.
  • The pg_waldump --stats command applied to a WAL segment breaks down bytes by record type and shows how much is full-page image.
  • In pg_stat_bgwriter (or pg_stat_checkpointer from PostgreSQL 17 onward), compare checkpoints triggered by time (timed) against those triggered by volume (requested). A predominance of timed, every five minutes, in a write-heavy system is the pattern to look for.
  • Enabling log_checkpoints (if not already on) makes every checkpoint log how long it took and how many bytes it wrote.

What to tune, and what it costs you

The usual fix is to space out checkpoints: raise checkpoint_timeout to somewhere between 15 and 30 minutes on busy systems, and increase max_wal_size proportionally, so the volume threshold doesn't trigger the checkpoint early. Keeping checkpoint_completion_target at 0.9 spreads the writing across the interval instead of concentrating it in a spike.

In short: there's no generic number here. The right interval depends on your database's RTO (acceptable recovery time): longer intervals reduce WAL but increase the volume to replay during post-failure recovery. In the case described by Stormatics, the projected checkpoint change alone should cut about 25% more of the daily WAL, after other adjustments already applied.

Teams running on Supabase need an extra bit of care: some of these settings require an instance restart or support from the platform's team. Stormatics' recommendation is to plan the change together with the provider, not around it.

Checkpoint isn't the only WAL villain

Beyond the checkpoint, the report identifies two other points that were inflating the same client's WAL, tied to table design and the application's write pattern:

Applied changeMetricResult
fillfactor and autovacuum recalibrated on 4 high-churn tablesHOT update rateRose by up to 15.59 percentage points
Same change, most-improved tableDead row ratioDropped from 5.19% to 0.02% (a 99.6% decrease)
Writing only changed columns + batching instead of row-by-rowDaily WALDropped about 11%, from 1.8 TB to 1.6 TB, over two weeks

Leaving free space on each page via fillfactor allows PostgreSQL to perform HOT updates (Heap-Only Tuple), which avoid writing to indexes when the indexed column doesn't change. This reduces WAL at the source, even before any checkpoint tuning. The combination of both points, according to Stormatics, already brought down the daily volume before touching checkpoint_timeout.

When this conversation isn't worth having

Checkpoint tuning makes clear sense in write-heavy databases, with hot tables touched constantly and an RTO that tolerates a few extra minutes of replay in case of failure. In mostly read-oriented databases, with low churn on the main tables, the gain from spacing out checkpoints tends to be marginal, because the volume of page images is already low.

Caution is also warranted in environments with a strict RTO or physical replicas sensitive to lag: lengthening the checkpoint interval increases recovery time and the volume to transmit to replicas before any other gain shows up. The path Stormatics itself recommends is to measure before changing: run the pg_stat_wal and pg_stat_bgwriter/pg_stat_checkpointer diagnostics first, and only then decide whether this is really your database's problem.

Translated from the Brazilian Portuguese original · Read the original