Live data from Hacker News

PGlite – Embeddable Postgres

pglite.dev

61–70 of 118 posts

Re: PGlite – Embeddable Postgres

#61

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…

This looks really interesting...but why WASM-only? Naively it seems like WASM-ification would be a 2nd step, after lib-ification. Obviously missing something...

Yeah... I was super excited by this project when it was first announced--and would even use it from Wasm--but since it ONLY works in Wasm, that seemed way too niche.

Re: PGlite – Embeddable Postgres

#63

Earlier quoted context omitted.

If I understand correctly, what this project does is take the actual postgresql sources, which are written in C, compile them to wasm and provide typescript wrappers. So you need the wasm to be able to use the C code from js/ts.

Yes. I would like to use the code as a library from something other than js/ts.

So compile it and use it?

Re: PGlite – Embeddable Postgres

#64
I'd love to to use PGLite in a non-JavaScript runtime. For example, embed PGLite into my Go CLI with a WASM runtime and use PGLite as a replacement for SQLite.

https://github.com/electric-sql/pglite/issues/89 makes it sound like there's "third-party" bindings for Rust. Is there any interest in "official" PGLite bindings to other languages?

Re: PGlite – Embeddable Postgres

#65
post #64

I'd love to to use PGLite in a non-JavaScript runtime. For example, embed PGLite into my Go CLI with a WASM runtime and use PGLite as a replacement for SQLite. https://github.com/electric-sql/pglite/issues/89 makes it sound like there's "third-party" bindings for Rust. Is there any interest in "official" PGLite bindings to other languages?

yep PGLite + Go would be great!

Re: PGlite – Embeddable Postgres

#66

Are people using this in SPA applications with success? I saw on the website that syncing via ElectricSQL is in alpha and that no CRDT is available, afaik. Any other options? Also, I guess pgsql extensions are out of scope? Nonetheless, this could be interesting for data heavy SPA's.

We have been using it for the last 8 months in production at CompoundingEdges. It's been great for allowing users to generate large amounts (100-300k records/day) of their own isolated data and automatically persist it to their local machine. The only hiccup we have had had been throttling data to be saved via the webworker.

We are not syncing with Electric, but I've heard good things about it.

Re: PGlite – Embeddable Postgres

#67
Is it just me or is downloading 3MB for the DB runtime plus the database itself, kind of crazy?

At this point, this should be built into the browser which could fetch signed db data and be extremely performant.

Re: PGlite – Embeddable Postgres

#68

Earlier quoted context omitted.

Amazing work! It makes setting up CI so much easier.

huh. could you tell how you use it in ci?

I'm using it for a service that has DB dependencies. Instead of using SQLite in tests and PG in production, or spinning up a Postgres container, you use Postgres via pglite.

In my case, the focus is on DX ie faster tests. I load shared database from `pglite-schema.tgz` (~1040ms) instead of running migrations from a fresh DB and then use transaction rollback isolation (~10ms per test).

This is a lot faster and more convenient than spinning up a container. Test runs are 5x faster.

I'm hoping to get this working on a python service soon as well (with py-pglite).

Re: PGlite – Embeddable Postgres

#69

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…

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.

Re: PGlite – Embeddable Postgres

#70

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…

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

for CI you can already use postgresql with "eat-my-data" library ? I don't know if there's more official image , but in my company we're using https://github.com/allan-simon/postgres-eatmydata
Post reply on HN