How it works
When a branching operation is started, the first step is to create a Copy-on-Write snapshot of the underlying logical volume. This is done at the storage level. A new PostgreSQL instance is started on a logical volume that is initialized from this Copy-on-Write snapshot. Because the mechanism lives entirely below PostgreSQL, Xata doesn’t require any modifications to the PostgreSQL source code. Therefore, we run vanilla Postgres and can support any extension.Copy-on-Write
In generic terms, Copy-on-Write is a mechanism used to share data efficiently between processes. Instead of copying data right away when multiple programs use it, the same data is shared between programs until one tries to modify it. When stored on disk, the database volume is split into blocks. In the illustration below, the blocks are numbered from 1 to 8. Because we’re using a distributed storage system, the blocks can be on different disks and nodes. A metadata index is used to keep track where the data blocks are stored.

