Making Postgres distributed with FoundationDB
Turning the revered Postgres into a distributed database is a tall order but not a new idea. It has been done in many different ways with different characteristics. Citus requires a fair bit of manual configuration and client setup, but is open-source and distributed as an extension. CockroachDB is simpler to integrate but is not actually Postgres and not open-source. Neon is perhaps the most interesting being a true Postgres extension and having some compelling features, but isn’t fully distributed in the multi-master sense.
None of these quite scratched my itch for what a distributed Postgres could look like, so I couldn’t help but try to scratch it myself. The result of that is pgfdb, an experimental, open-source extension for Postgres that turns it into a stateless layer on top of FoundationDB. This means full compatibility with Postgres (it is Postgres) with the scalability, resiliency and transactional guarantees of FoundationDB.
Being able to build such a project is a testament to just how extensible Postgres is. pgfdb uses a number of Postgres extension points, like custom table and index access methods, to fully replace the standard storage and transaction engines. This means table and index data is stored and read in a way that suits FoundationDB, and full use is made of FoundationDB’s distributed transaction processing.
pgfdb is still very experimental and it remains to be seen if acceptable performance can even be achieved for a typical Postgres workload, but I wanted to put it out there early. If you are interested to chat more about it, please reach out!