Show HN: PGlite – in-browser WASM Postgres with pgvector and live sync
PGlite is a lightweight, embeddable Postgres database under 3MB, operating in a WebAssembly environment, supporting dynamic extensions, reactive programming, and AI-driven database creation via Supabase.
Read original articlePGlite is a lightweight, embeddable version of Postgres that operates locally in a WebAssembly (WASM) environment, with a total size of under 3MB when gzipped. It features a dynamic extension loading mechanism, allowing for the integration of various extensions such as pgvector and PostGIS. PGlite supports reactive programming, enabling data loading, synchronization, and live query capabilities. Users can create and publish a Postgres database using AI through Supabase, and the platform offers an interactive experience directly in the browser. PGlite is dual-licensed under Apache 2.0 and the PostgreSQL License.
- PGlite is a lightweight Postgres database running in a WASM environment.
- It supports dynamic extension loading, including pgvector and PostGIS.
- The platform offers reactive programming features for data synchronization and live queries.
- Users can create and publish databases using AI through Supabase.
- PGlite is dual-licensed under Apache 2.0 and the PostgreSQL License.
Related
Postgres vs. Pinecone
Postgres and Pinecone differ in performance and cost. Pinecone criticizes Postgres for index issues, while Postgres showcases superior performance with tweaks, specialized indexes, and cost-effectiveness, offering transparency and customization.
Major Developments in Postgres Extension Discovery and Distribution
The article covers advancements in Postgres extension discovery and distribution. Postgres extensions enhance database capabilities with features like query hints and encryption. PGXN facilitates extension access. A summit in Vancouver will address extension challenges, encouraging developer involvement for ecosystem enhancement.
PgManage: Modern, cross platform graphical database client
PgManage is a graphical client for Postgres databases, based on OmniDB. Visit the PgManage website for installation, documentation, and setup instructions, including details for Ubuntu and dependencies.
PostgREST – Serve a RESTful API from Any Postgres Database
PostgREST creates RESTful APIs from PostgreSQL databases, offering high performance, security via JWT, multiple API versions, self-documentation with OpenAPI, and community support for contributions and sponsorships.
Pgzx: Postgres Extensions with Zig
Xata has launched pgzx, an open-source framework for building PostgreSQL extensions with Zig, enhancing code maintainability and efficiency, and includes features for memory safety, error handling, and testing.
- Many users appreciate PGlite's lightweight nature and ease of installation, comparing it favorably to Docker and SQLite.
- There is a strong interest in its compatibility with various frameworks, particularly Next.js, and its potential for integration testing.
- Users are curious about performance comparisons with traditional PostgreSQL and SQLite, as well as the implications for data persistence and syncing.
- Several comments express excitement about the potential for PGlite to support additional programming languages beyond JavaScript.
- Questions arise regarding specific features, such as support for live queries, at-rest encryption, and the relationship with ElectricSQL.
Since that's still not spinning up an actual network server, that feels like it's an alternative to SQLite - you can spin up a full in-process PostgreSQL implementation, that persists to disk, as part of an existing Node.js/Bun application.
That's really interesting!
I'd love to use this from Python, via something like https://github.com/wasmerio/wasmer-python or https://github.com/bytecodealliance/wasmtime-py - has anyone run PGlite via one of those wrappers yet?
It's the perfect solution to have Postgres without the need of Docker. With just `npm install`, you can have a Postgres instance on your computer. So, it's extremely easy to onboard a new developer in your team.
And, the good news, PGlite works perfectly with Next.js.
I'm using PGlite in local and development environment with Next.js Boilerplate: https://github.com/ixartz/Next-js-Boilerplate
With only one command `npm install`, you can have a full-stack application, which also includes the database (a working Postgres). And, no need to have/install external tools.
The immediate DX is incredible and I'm itching to use PGLite (and ElectricSQL) in a production project, I expect it would remove quite a few pain points I'm currently experiencing. (Also, I just like working with CRDTs.)
I don't have any constructive criticism to offer right this moment, but I just wanted to congratulate you on the launch and an incredible looking product!
Also, fun etymological thing, SQLite is actually SQL-ite, as in, urbanite, not SQ-Lite, but due to rebracketing [0] and libfixing [1], now people seem to use the -lite suffix rather than the -ite one, presumably because lite actually implies something whereas ite would not, as much. It's like how helicopter is actually helic and opter, a helical wing that spins, but now people think of it as heli and copter, calling other things related to it like helipad, or quadcopter, as Wikipedia states.
The ability to replicate and subscribe to the changes, all within the browser seems incredibly powerful.
Having worked on medical software that runs a 2,000,000+ patient workload that perform refills for chemotherapy/HIV/immuno drugs, where it was common for people to trample each others work as they ran insurance, called patients etc...
We had to roll our own locking system that relied on interval functions (yay IE7) and websockets... This meant when you called the patient, someone running financial assistance would be unable to work on the same profile.
I can envision other uses for FTS or even vector search locally, since they are insanely expensive at scale.
Very cool! Most of the examples for reactive queries are very basic (only single tables). Do live queries support joins / aggregations?
I see "PostgreSQL 15devel" in a screenshot so I'm assuming that means v15 but explicit documentation on current and future Postgres version usage would be very nice. For example, how will I know when (if) you update to v16?
Just added a new section to my "Postgres Is Enough" gist:
https://gist.github.com/cpursley/c8fb81fe8a7e5df038158bdfe0f...
If they get it to a stage where other languages apart from JS can use it, it could be revolutionary. The possibilities are limitless.
However, running `SELECT to_tsvector('fat cats ate fat rats') @@ to_tsquery('fat & rat');` fails with `y is not a function`. Then trying to run the first query yields `null`, which is weird. I can open an issue if you want :)
> "We would recommend using the IndexedDB VFS in the browser at the current time as the OPFS VFS is not supported by Safari."
Is it possible to configure PGLite to use IndexedDB on Safari and OPFS on Chrome & Firefox?
Subabase announcement post
Postgres.new: In-browser Postgres with an AI interface
Is it possible to use PGLite for that purpose in non-JS environments, like e.g. golang?
I already default to SQLite for new side projects with the idea that "eventually I'll migrate to Postgres if this project gets legs", so switching to PGlite feels like a no-brainer as long as it's not going to weigh my apps down or force me to upgrade out of whatever entry-level server solution I'm using is for a given project.
EDIT: Found the benchmarks here https://pglite.dev/benchmarks
Related
Postgres vs. Pinecone
Postgres and Pinecone differ in performance and cost. Pinecone criticizes Postgres for index issues, while Postgres showcases superior performance with tweaks, specialized indexes, and cost-effectiveness, offering transparency and customization.
Major Developments in Postgres Extension Discovery and Distribution
The article covers advancements in Postgres extension discovery and distribution. Postgres extensions enhance database capabilities with features like query hints and encryption. PGXN facilitates extension access. A summit in Vancouver will address extension challenges, encouraging developer involvement for ecosystem enhancement.
PgManage: Modern, cross platform graphical database client
PgManage is a graphical client for Postgres databases, based on OmniDB. Visit the PgManage website for installation, documentation, and setup instructions, including details for Ubuntu and dependencies.
PostgREST – Serve a RESTful API from Any Postgres Database
PostgREST creates RESTful APIs from PostgreSQL databases, offering high performance, security via JWT, multiple API versions, self-documentation with OpenAPI, and community support for contributions and sponsorships.
Pgzx: Postgres Extensions with Zig
Xata has launched pgzx, an open-source framework for building PostgreSQL extensions with Zig, enhancing code maintainability and efficiency, and includes features for memory safety, error handling, and testing.