Live data from Hacker News

PGlite – Embeddable Postgres

pglite.dev

91–100 of 118 posts

Re: PGlite – Embeddable Postgres

#91

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?

The main use case, in my opinion, is for tests/CI. SQLite has traditionally been used to quickly run tests, however, if your actual infra uses PostgreSQL then the value is limited.

Re: PGlite – Embeddable Postgres

#92

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?

The main use case, in my opinion, is for tests/CI. SQLite has traditionally been used to quickly run tests, however, if your actual infra uses PostgreSQL then the value is limited.

You think the main use for sqlite is running tests?

Re: PGlite – Embeddable Postgres

#93

Earlier quoted context omitted.

The main use case, in my opinion, is for tests/CI. SQLite has traditionally been used to quickly run tests, however, if your actual infra uses PostgreSQL then the value is limited.

You think the main use for sqlite is running tests?

I think they meant sqlite is often used in CI/CD testing environments as an alternative to running a client/server database in these environments. For simple crud webapps, or frameworks that are db agnostic it works well.

Re: PGlite – Embeddable Postgres

#94

Earlier quoted context omitted.

The main use case, in my opinion, is for tests/CI. SQLite has traditionally been used to quickly run tests, however, if your actual infra uses PostgreSQL then the value is limited.

You think the main use for sqlite is running tests?

My read is that the person you're responding to thinks that pglite could be a better fit than sqlite for ci/cd, where currently sqlite is used.

Not that testing is the main use of sqlite.

Re: PGlite – Embeddable Postgres

#95

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.

Sounds you only need to create the APIs for calling into WASM if so, so as long as your language of choice can do that, you're good to go.

Re: PGlite – Embeddable Postgres

#96
post #59

What is the advantage of using something like this instead of the IndexedDB Browser Feature

I was shocked to discover how incredibly poorly IndexedDB works. I always thought it would be fast and snappy if a bit alien. But nope, it's incredibly bad! Despite being a native feature to the browser it's incredibly slow, and the way it works in terms of fetching records based on non-primary keys forces you to either load your entire dataset into RAM at once or iterate though it record-by-record in a slow callback…

I've built some pretty intensive stuff in indexeddb and it was the only thing I've ever done, using native browser features, that I could get to consistently crash the browsers I tested it on (granted, this was many years ago). On top of that, the API is so ugly. I cannot believe indexeddb won over websql (when every browser ever already embeds sqlite). What a shame.

Re: PGlite – Embeddable Postgres

#97

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.

You can use it in Rust if you like. I've used pglite through wasmer before. Also [pglite-oxide](https://lib.rs/crates/pglite-oxide) is pretty usable.

Re: PGlite – Embeddable Postgres

#99

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…

Well downloads doesn’t equal usage does it ? How do you know how many deployments you actually have in the wild?

True downloads don’t equal usage but there’s a correlation. I also doubt deployment equals usage - I can deploy to some env and not make any requests.

Additionally, how you can get data on how many deployments without telemetry? The only telemetry that I’m interested in is for my uses, and don’t really care about sending data on deployment count to a third party. So the download count becomes a “good enough” metric.

Re: PGlite – Embeddable Postgres

#100
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!

Yeah would really make testing a tonne easier.
Post reply on HN