pgrust — a clone of PostgreSQL in Rust, passing all regression tests

The pgrust project has been published, featuring a PostgreSQL database management system rewritten in Rust using the c2rust translator and AI assistance. It is stated that the project is not yet ready for production use, but it successfully passes all PostgreSQL regression tests, is compatible with the data storage format of PostgreSQL 18.3, and can utilize data catalogs from PostgreSQL 18.3. The project code is distributed under the AGPLv3 license, unlike the original PostgreSQL, which is provided under the permissive PostgreSQL license, akin to BSD and MIT licenses. An online demonstration based on a WebAssembly build is available, as well as a Docker image for quick deployment.

The development aims to achieve full compatibility with PostgreSQL 18.3, as well as to conduct experiments on altering the internal structure and creating a version of PostgreSQL free from architectural constraints that cannot be resolved due to historical reasons. The project successfully passes a set of over 46,000 PostgreSQL regression tests, but is currently incompatible with PostgreSQL extensions, does not provide the desired performance optimizations, and does not fully implement procedural languages PL/Python, PL/Perl, and PL/Tcl.

Future plans:

  • Translation to a multi-threaded internal architecture.
  • Implementation of connection pooling.
  • Optimization for workflows heavily utilizing JSON.
  • The ability to create copies and branches of database elements in Copy-on-Write mode without duplicating data.
  • Experiments with an architecture that does not require performing the VACUUM operation.
  • A SQL query constraint system that allows blocking excessive resource consumption during the execution of poor-quality queries.
  • Protection against the optimizer switching to less efficient query execution plans.

According to the project author, work is currently underway on the next version of pgrust, in which a multi-threaded connection processing model will replace the worker process pool, as well as additional optimizations such as batch row processing in tables and preloading data. In tests with the percona-tpcc tool, the new version of pgrust was found to be 50% faster than standard PostgreSQL for transaction processing, and 300 times faster for analytical queries.

A hybrid approach was used when converting to Rust, where the PostgreSQL code was initially processed with the c2rust translator, generating an unsafe Rust representation that closely resembles the original C code structure. After processing in c2rust, approximately 1000 crate packages were created, which were simultaneously translated into idiomatic Rust using the AI model Claude and the Conductor toolkit to distribute tasks among concurrently running subagents.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster