Posted by rguiscard 12 hours ago
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?
> 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 CLIFor 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...
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
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.
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.