hn.today

Minipg: PostgreSQL as a Single Executable

progrium.github.io134 points21 comments
Screenshot of Minipg: PostgreSQL as a Single Executable

Minipg packages PostgreSQL as a single executable, aiming to make a database as easy to create, move, and use as a directory. Each .pgdb folder contains the database files, configuration, generated superuser password, and PostgreSQL data; copying a stopped folder copies the database. Running minipg opens a psql shell, executes a query, or supplies a connection URL. It can also run an application with DATABASE_URL set, serve a database explicitly, and dump or restore it. A server starts on demand, is protected by a single-process lock, and shuts down when idle. The design is intended to simplify local development and CI, including static Linux builds that need no special privileges.

Under the hood, minipg embeds Docker Hub’s postgres:18-alpine image but does not use Docker or boot a Linux kernel. The h9 library runs the image’s PostgreSQL programs through a Linux personality on host hypervisors, with a native backend available on supported Linux systems. PostgreSQL tools run in separate, short-lived h9 machines and communicate with the database server. The project also provides a browser demo, which uses v86 and a prebuilt database template to avoid slow initialization. Minipg is early-stage: PostgreSQL is about twice as slow as native for one client on h9’s native backend and performs worse under load. Its developers warn against using it for data that cannot be recreated.

Read on progrium.github.io21 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.