Top
Best
New

Posted by rguiscard 12 hours ago

Minipg: PostgreSQL as a Single Executable(progrium.github.io)
208 points | 33 comments
t3ntxcles 1 hour ago|
Cool hack, getting fork-per-connection postgres running with no kernel is quite interesting

I'm struggling to see the use case for minipg itself. For embedded or in-process postgres there's pglite as mentioned in comments. For dev/test parity there's embedded-postgres (go, java, node, python), which downloads native binaries and gives you a throwaway postgres with no docker. These by themselves cover what most people would want from "sqlite-style postgres," without the hypervisor layer or significant slow down.

Is minipg intended to become a real tool, or is it mainly a showcase for h9, with Postgres as the hard case that proves it works?

gavinray 59 minutes ago|
I was confused about the use case as well but the authors blog post linked in this thread clears it up. I'm not sure I agree with it, personally would just run WASM postgres:

  > So when you find self-hostable open source software you'd like to run on your own computer, it can be daunting when it says it requires Postgres. Now you're responsible for setting up a database and getting it ready for the software to use.

  > Sure, you can run Postgres in Docker, and plenty of projects recommend it. But now you have two dependencies. If you don't already have Docker, you have to install it, which can mean a VM and a daemon on your machine. Then you have to run Postgres in it and make sure it's running whenever you use the software. That's a lot just to try something you don't know you want yet.

  > Wouldn't it be great to have the SQLite   experience, but with Postgres?

  > That's miniPG . It isn't Postgres as a library. There's already a WASM project for that, reasonably called PGlite. miniPG is closer to the SQLite CLI
singpolyma3 5 minutes ago||
I just don't understand what's daunting about apt install postgresql
msrbuilds 2 minutes ago||
This can be a good testing tool
Ciantic 5 hours ago||
I can see this very useful for small self-hosted applications. I could imagine deploying this instead of sqlite in some cases. Though having a real server is not maybe ideal for self-hosted apps.

For unit tests I've found that I don't need PGLite or other tools, only podman and official images.

Regular postgres starts in 800 milliseconds, TimeScale DB in 1 second.

I have setup where first unit test that starts podman container and after finish it ends it all. On each test I create new database (or search path), time it takes to create db is in milliseconds.

Trick is to use `--image-volume tmpfs` when starting the container. I have my pg test server as Rust in here: https://github.com/Ciantic/app-frame/blob/main/crates/pgtest...

nextaccountic 3 hours ago||
> I can see this very useful for small self-hosted applications. I could imagine deploying this instead of sqlite in some cases.

I think you would be better off with either https://github.com/electric-sql/pglite or https://github.com/f0rr0/oliphaunt

They actually run as a library, like sqlite does, with no separate process

ptman 4 hours ago||
I've played with databases and schemas for isolating tests, but I think pgtestdb has the winning concept: load fixtures into a template database and clone if for each test https://github.com/peterldowns/pgtestdb
phmx 6 hours ago||
Author's post on the subject -- https://progrium.xyz/articles/2026/single-binary-postgres/
nomercy400 9 hours ago||
Impressive. Uses postgres alpine's docker image, without docker. Instead it used h9, a young embedded hypervisor tool.
jgarzik 2 hours ago||
In Other Words, RooDB: https://github.com/jgarzik/roodb
WanderZil 2 hours ago||
Nice that a command starts a shared background server if needed, then shuts it down after a minute idle.
anilgulecha 11 hours ago||
For folks working in this area, may I request a MySQL/mariadb-lite?

pglite is great for browser / testing emulation for PG. MySQL in browser does not have an equally good story. Closest is https://github.com/ephpm/litewire , but it isnt really MySQL fully.

t3ntxcles 1 hour ago|
There are a couple of very early attempts. lite4mariadb (https://github.com/shyim/lite4mariadb) compiles MariaDB's embedded server (InnoDB) to WASM with a PGlite-style API and IndexedDB persistence, and mysql-wasm (https://github.com/benmerckx/mysql-wasm) does the same for MySQL 9.7.

Can't recommend it but I experimented myself with lite4mariadb and hit a few rough edges, e.g. transactions aren't isolated when the callback is async, memory use is insane. Issues are also disabled on the repo (it's a github fork), so there's nowhere to report bugs.

General issue of both is them being single-connection and being less battle tested.

If translation is acceptable, wordpress playground's sqlite driver (sqlite-database-integration) parses mysql into an ast which is based on my experience is the most proven approach in browser today.

Would be genuinely excited if mysql in WASM gets more attention.

dolmen 48 minutes ago||
Looks useful for CI.
maCDzP 4 hours ago|
This is cool. I can start building against Postgres and run the db as a file. Then, when my LLM-assisted project spirals out of control I can move it to a dedicated server.
More comments...