PostgreSQL 18 FILE_COPY clones fail with sessions

boringsql.com15 min read

The author examines how PostgreSQL 18's FILE_COPY strategy enables fast database cloning via filesystem reflinks, but explains that it requires zero active database sessions to prevent data corruption and heap-index skew caused by shared pg_xact transaction logs. To achieve safe, concurrent database branching without stopping production, the author demonstrates alternative techniques using ZFS copy-on-write snapshots or paused streaming replicas combined with crash recovery. Open article →