Re:Instant database clones with PostgreSQL 18
by radarroark on Tuesday December 23, 2025 @07:49AM
(#46364926)
In theory, a database that uses immutable data structures (the hash array mapped trie popularized by Clojure) could allow instant clones on any filesystem, not just ZFS/XFS, and allow instant clones of any subset of the data, not just the entire db. I say "in theory" but I actually built this already so it's not just a theory. I never understood why there aren't more HAMT based databases.
[ Parent
| on HN ]
Re:Instant database clones with PostgreSQL 18
by zX41ZdbW on Tuesday December 23, 2025 @08:33AM
(#46365197)
This is typical for analytical databases, e.g., ClickHouse (which I'm the author of) uses immutable data parts, allowing table cloning: https://clickhouse.com/docs/sql-reference/statements/create/...
Re:Instant database clones with PostgreSQL 18
by ozgrakkurt on Tuesday December 23, 2025 @11:05AM
(#46366415)
`ClickHouse (which I'm the author of)` just casually dropped that in the middle
Re:Instant database clones with PostgreSQL 18
by orthecreedence on Tuesday December 23, 2025 @02:00PM
(#46368179)
It was so casual I didn't even notice it until you pointed it out XD
Re:Instant database clones with PostgreSQL 18
by nine_k on Tuesday December 23, 2025 @02:09PM
(#46368287)
This is typical HN: everyone is here. I've seen a number of threads that unflod like this: "Lately I hacked up a satellite link to..." → "As an engineer who built the comm equipment of that satellite,.." → "As the astronaut who launched the satellite from ICS,..", etc.
Re:Instant database clones with PostgreSQL 18
by chamomeal on Tuesday December 23, 2025 @10:18AM
(#46365975)
Does datomic have built in cloning functionality? I’ve been wanting to try datomic out but haven’t felt like putting in the work to make a real app lol
Re:Instant database clones with PostgreSQL 18
by radarroark on Tuesday December 23, 2025 @10:38AM
(#46366164)
Surprisingly, no it does not. Datomic has a more limited feature that lets you make an in-memory clone of the latest copy of the db for speculative writes, which might be useful for tests, but you can't take an arbitrary version of the db with as-of and use it as the basis for a new version on disk. See: https://blog.danieljanus.pl/2025/04/22/datomic-forking-the-p...
There's nothing technically that should prevent this if they are using HAMTs underneath, so I'm guessing they just didn't care about the feature. With HAMT, cloning any part of the data structure, no matter how nested, is just a pointer copy. This is more useful than you'd think but hardly any database makes it possible.