Adding PostgreSQL 15 support to Neon Storage using Rust
Neon's Rust storage engine parses Postgres WAL and data pages through bindgen-generated FFI bindings. To support PostgreSQL 14 and 15 side by side, build.rs runs bindgen once per version against that version's server headers, producing separate bindings files. A macro then wraps each set into versioned submodules (v14, v15). Public functions dispatch on a pg_version parameter, and version-independent types are re-exported, so the rest of the codebase changes very little and code isn't duplicated.
Related posts
- We're building Postgres in Rust. Using the LLVM of databases
Turso easyNoviceTurso, a Rust rewrite of SQLite, is adding a Postgres frontend by parsing Postgres SQL into a common AST and compiling it to Turso's VDBE bytecode, turning the engine into an "LLVM of databases" with pluggable frontends. The argument is that SQL databases differ mostly in on-disk layout, not in core operations, so Postgres semantics can be expressed in or added to the VDBE. A C-to-VDBE compiler running Doom illustrates that the bytecode works as a real VM. The work starts from the earlier pgmicro experiment and is early-stage but runnable from source. Planned pieces include the Postgres wire protocol, embedded and in-browser use, live materialized views, and WASM-sandboxed extensions, aiming for broad rather than 100% compatibility.
- Supabase is now on Postgres 13.3
Supabase easyNoviceNew Supabase projects now run Postgres 13.3 (up from 12.0), bringing native gen_random_uuid, parallel index vacuuming, incremental sorting and smaller B-tree indexes. Supabase Postgres versioning now tracks upstream major/minor versions, and Postgres is built from source so ARM Graviton 2 instances can use Large System Extensions (LSE) for faster atomics and locking, with pgbench comparisons on m6gd.8xlarge. The release also moves to Ubuntu 20.04, adds the pgRouting and wal2json extensions, configures fail2ban on ports 5432 and 6543 (10-minute ban after three failed attempts), and previews PgBouncer/PostgREST marketplace bundles.
- Postgres Foreign Data Wrappers with Wasm
Supabase mediumAdeptSupabase Wrappers, a Rust framework for building Postgres Foreign Data Wrappers, now supports WebAssembly FDWs that are downloaded from URLs like GitHub or S3, checksum-verified, cached and run in a sandboxed Wasm runtime inside the Postgres extension. The host extension provides the runtime, an HTTP interface and utilities, while each guest FDW fetches data from HTTP JSON APIs. TCP-based databases and local files are not yet supported. Snowflake and Paddle Wasm FDWs ship built in, a SQL walkthrough shows creating a Paddle server and foreign table, and wrappers from untrusted sources should never be installed.
- Postgres WASM by Snaplet and Supabase
Supabase mediumAdeptpostgres-wasm runs a full PostgreSQL 14 server in the browser by emulating an x86 machine with v86 rather than compiling Postgres to WASM directly. It boots a minimal Buildroot Linux image and lazily loads the rest over a 9P filesystem via HTTPS, and it uses the page_poison=on kernel parameter so freed memory compresses well, which brings the snapshot of a running Postgres down to about 12MB. Networking goes through a forked websockproxy that converts raw ethernet frames into TCP, with an nginx reverse proxy that maps private IPs to ports so external clients like psql, PgAdmin or a logical replication peer can connect. Other hurdles included a v86 JIT bug that caused PG14 segfaults, worked around by switching Postgres to sysv shared memory, and an inbox-folder listener for running scripts inside the VM.
- How we scale an open source, multi-tenant storage engine for Postgres written in Rust
Neon mediumAdept
Neon shards its Rust-based Pageserver storage layer by dividing each Postgres relation's 8KiB block numbers into stripes (default 256MiB) and hashing each stripe to a Pageserver. Large tenants then get I/O that scales with dataset size, and they stop competing with small tenants for resources. All shards subscribe to the Paxos-based Safekeepers and filter WAL down to their own pages, while Postgres routes GetPage@LSN reads directly to the right shard by hashing, with no proxy in between. Tables need to exceed stripe size × shard count (e.g. 2GiB with 8 shards) to use full throughput. Planned work includes shard-aware Safekeepers to cut WAL fan-out cost and shard splitting, since shard count is currently fixed at tenant creation.