Comment

Comment by spellboots

Many people are unaware of a relatively recent method that allows almost instant copies of postgres databases that I use very heavily:

  CREATE DATABASE new_db TEMPLATE templatedb STRATEGY FILE_COPY
Combined with

  set file_copy_method = 'clone'
This copies arbitrarily sized DBs sub-second - I use it on dbs larger than 1TB regularly - and has the advantage of being copy-on-write - the new db doesn't take up any extra disk space until you start writing to it in which case only the differences are used.

Only supported on linux and macos AFAIK

https://www.postgresql.org/docs/18/runtime-config-resource.h...

parent spellboots 3 months ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton