Home DevOps Article

PostgreSQL 18 Enables Near-Instant Database Cloning With Reflinks

TL;DR

PostgreSQL 18's file_copy_method parameter leverages filesystem reflinks for zero-copy database cloning in milliseconds, eliminating checkpoint storms.

Key Points

  • PostgreSQL 15+ introduced CREATE DATABASE STRATEGY parameter; version 18 adds file_copy_method = clone for reflink support
  • 6GB database clones in ~100ms on XFS/ZFS vs. minutes with WAL_LOG strategy, with zero additional disk space consumed
  • Works with modern filesystems: Linux XFS, ZFS, APFS (macOS), FreeBSD ZFS; unavailable in managed cloud environments (AWS RDS, Google Cloud SQL)
  • Copy-on-write triggers on first write; source database must have zero active connections during clone operation

Why It Matters

For developers and DevOps engineers managing large databases, instant cloning enables faster test suite execution, reproducible snapshots for learning environments, and safer migration testing without the I/O storms that plagued earlier PostgreSQL versions. This is particularly valuable for teams running on self-managed infrastructure with modern filesystems.
Full technical deep-dive with benchmarks

Source: boringsql.com