4 ms·
Answered here https://news.ycombinator.com/item?id=41224295 https://news.ycombinator.com/item?id=41224295 > You might remember an earlier WASM build[1] that wa
by AlexErrant 2y ago
Answered here https://news.ycombinator.com/item?id=41224295 https://news.ycombinator.com/item?id=41224295
> You might remember an earlier WASM build[1] that was around ~30MB. The Electric team [2] have gone one step further and created a complete build of Postgres that’s under 3MB.
> Their implementation is technically interesting. Postgres is normally multi-process - each client connection is handed to a child process by the postmaster process. In WASM there’s limited/no support for process forking and threads. Fortunately, Postgres has a relatively unknown built-in “single user mode” [3] primarily designed for bootstrapping a new database and disaster recovery. Single-user mode only supports a minimal cancel REPL, so PGlite adds wire-protocol support which enables parametrised queries etc.