-
Peter from Snaplet here. A month ago I saw the CrunchyData post and wanted to play around with the code that made it happen, it wasn't OSS so I asked for help:
> If anyone out there wants to work on an open source version of this full-time please reach out to me. [0]
Paul reached out and we started working on it almost immediately. Check out the repo here: https://github.com/snaplet/postgres-wasm
We have a blog post about some of the interesting technical challenges that we faced whilst building this: https://www.snaplet.dev/post/postgresql-in-the-browser
Like most things, this is built on-top of the amazing open-source projects that made this possible, but special mention goes to v86.js and buildroot. We just glued it together.
---
[0] Request for collaboration: https://news.ycombinator.com/item?id=32500526
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
I believe the team at Wasmer have worked on something like this:
https://github.com/wasmerio/wasmer-postgres
It only works for PG10, but I can't imagine it will take much effort to bring it up to the latest version
-
-
copycat
Generate deterministic fake values: The same input will always generate the same fake-output.
-
Puts Debuggerer
Ruby library for improved puts debugging, automatically displaying bonus useful information such as source line number and source code.
-
-
We actually kinda see parts of this in https://github.com/superfly/litefs, albeit for SQLite.
And here we see some ideas forming around "pluggable storage for PostgresQL": https://wiki.postgresql.org/wiki/Future_of_storage#Pluggable...
Seriously! If any of this sounds interesting to build, reach out, and we'll make it happen!
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
Greenplum
Discontinued Greenplum Database - Massively Parallel PostgreSQL for Analytics. An open-source massively parallel data platform for analytics, machine learning and AI.
I was wondering if anyone had thought about using this to experiment with the planner.
The engineering and support teams at Greenplum, a fork of Postgres, have a tool (minirepro[0]) which, given a sql query, can grab a minimal set of DDLs and the associated statistics for the tables involved in the query that can then be loaded into a "local" GPDB instance. Having the DDL and the statistics meant the team was able to debug issues in the optimizer (example [1]), without having access to a full set of data. This approach, if my understanding is correct, could be enabled in the browser with this Postgres WASM capability.
[0] https://github.com/greenplum-db/gpdb/blob/6X_STABLE/gpMgmt/b...
-
Have you looked at compressing that ~16MB wasm file with something like Brotli?
When I was actively doing stuff with wasm (~2019), Brotli was the best compression approach. eg 16MB uncompressed -> 2.4MB compressed
https://github.com/golang/go/wiki/WebAssembly#reducing-the-s...
-
> How much work was done supporting the VM
All of the heavy lifting here is done by v86: https://github.com/copy/v86
v86 can be used for a number of things besides Postgres - things like Repls or other entire applications are definitely achievable.
Networking between Postgres and the internet was a lot of work, and Mark came up with a neat solution detailed in the blog post.
This solution can be used for any other application. If you're looking to run a native application in the browser using v86, the repo & blog post is a good launching pad.
-
I think `direnv` [1] may be closer to `asdf` than this. They also mention it, and the integration, `asdf-direnv` on their website [2].
[1] https://direnv.net/
-
I was trying to find a way to make apps "data-leak resistant" and one step into this direction was to let the user store the data by bringing his/her own database. I even made a poc https://github.com/andersonDadario/byoda (explanation in the blog post link found on the readme) - but no user would manage his own database. Having a database in the browser opens more possibilities though. I will give it some thought. Looking forward to what else will be built on WASM.
-
I wrote an in-browser serverless platfrom [1] a few months ago with which this would pair well; but seeing the techniques described here, it might make sense to compile workerd [2] to wasm instead.
[1] https://github.com/johnhenry/actually-serverless
-
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Related posts
-
Show HN: I made a SQL game to help people learn / challenge their skills
-
Ask HN: Who is hiring? (May 2022)
-
How do I make my github project straight out of github buildable (no library dependecy errors,no library manager bullshit)?
-
This Is Why You Should Use Cloudflare Workers
-
Modern Web Development Sucks? How PostgreSQL Can Replace Your Tech Stack