Live data from Hacker News

PGlite – Embeddable Postgres

pglite.dev

81–90 of 118 posts

Re: PGlite – Embeddable Postgres

#81
The last time I ended up trying something like this I was implementing postgres features that the mocks didn’t.

Now, I just tested against a real database in a docker container. I have over 1k tests that run about 1.5 mins. I’m pretty happy with that.

I guess given that, testing isn’t quite the use case for this (for me). Wonder what else this could be used for.

Re: PGlite – Embeddable Postgres

#83
I'm so optimistic about this, especially in the context of local-first web applications. With Postgres on both the client and the server, and something like PowerSync or ElectricSQL to keep the two together, you get a homomorphic database environment between client and the server. That has a lot of architectural benefits I'm actively exploring. The client and the server can share a lot more code, for one.

But I read the following posts, and I have some serious concerns about PGlite's performance:

https://antoine.fi/sqlite-sync-engine-with-reactivity – describes memory leaks, minute-long db startup time, and huge slowdowns with live queries

https://github.com/marcus-pousette/sqlite3-bench - shows performance dropping to multi-second territory for inserts and lookups, compared to sqlite which is significantly faster

It sadly makes me slightly skeptical about adopting what effectively feels like a hack... SQLite has obviously had decades of adoption and I'm not expecting PGlite to match that level of legacy or optimisation - but it's enough to give me pause.

I really, really want to adopt PGlite in a project I'm currently architecting, so would love some insight on this if anybody has any!

Re: PGlite – Embeddable Postgres

#84
I was evaluating local storage solutions a while back and I tried setting up PGlite, but unfortunately I couldn't get it to work in Next.js with Turbopack in a web worker.

I've been using SQLite locally instead with wa-sqlite and it's been working great for my use case so far. It's also more lightweight.

Re: PGlite – Embeddable Postgres

#86

I was evaluating local storage solutions a while back and I tried setting up PGlite, but unfortunately I couldn't get it to work in Next.js with Turbopack in a web worker. I've been using SQLite locally instead with wa-sqlite and it's been working great for my use case so far. It's also more lightweight.

How are you measuring "lightweight" here, what do you mean by it?

(Not doubting your claim this just seems one of those words that means many different things depending on the context.)

Re: PGlite – Embeddable Postgres

#87
post #69

Earlier quoted context omitted.

Does pglite in memory outperform “normal” postgres? If so then supporting the network protocol so it could be run in CI for non-JS languages could be really cool

Look into libeatmydata LD_PRELOAD. it disables fsync and other durability syscalls, fabulous for ci. Materialize.com uses it for their ci that’s where i learned about it.

[deleted]

Re: PGlite – Embeddable Postgres

#89

Hey everyone, I work on PGlite. Excited to see this on HN again. If you have any questions I'll be sure to answer them. We recently crossed a massive usage milestone with over 3M weekly downloads (we're nearly at 4M!) - see https://www.npmjs.com/package/@electric-sql/pglite While we originally built this for embedding into web apps, we have seen enormous growth in devtools and developer environments - both Google Fir…

Any chance for a Flutter library?

Re: PGlite – Embeddable Postgres

#90
Hello, can you please summarize the advantages of PGLite compared to SQLite?

I've never used Postgres before, my work is mostly on the embedded domain using files and a lot of browser execution on the client side.

With SQLite there is simplicity attached to the databases, with PGLite I see a lot of interesting extensions to try out but what would the big difference when compared to SQLite?

Post reply on HN