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...