An unofficial, read-only Hacker News reader. Join the beta →

Minipg: PostgreSQL as a Single Executable (opens external site)

300 points by rguiscard 2 days ago | progrium.github.io | 47 comments on HN

View full thread · View on Hacker News

Comment thread (3)

  1. 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...

    Replies (2)
    1. 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
    2. > 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