Live data from Hacker News

Postgres WASM

supabase.com

101–110 of 190 posts

Re: Postgres WASM

#101

Hey HN, we’re excited about this launch. This was a collaborative effort with the team at Snaplet [0]. postgres-wasm is an embeddable Linux VM with Postgres installed, which runs inside a browser. It provides some neat features: persisting state to browser, restoring from pg_dump, logical replication from a remote database, etc. The idea was inspired by CrunchyData’s HN post about a month ago [1]. We love the possibi…

> an embeddable Linux VM with Postgres installed, which runs inside a browser. Wow! I feel like this is the lede. How much work was done supporting the VM and OS privatives (eg networking) vs PG specific work? I feel like a minimal Linux in the browser opens up a LOT more opportunities than just a database. When figma got bought out, a lot of articles were written about “where’s the wasm applications”, and I feel lik…

> 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.

Re: Postgres WASM

#102
This is very cool. An important area of ignorance (for me) is how well browsers do with local data. A nightmare scenario is that a user happily uses your app, stores data locally, and then Chrome decides they don't need localstorage anymore. What's the status on local data reliability in browsers?

Re: Postgres WASM

#103

Earlier quoted context omitted.

Correct me if I'm wrong, but given your profile (I assume someone in the tech world), nothing stopping you from doing all of the above with a local pg. If installing is annoying you could run it in docker.

You're absolutely right, you can use a local pg. This just makes it easier for me, as it's sort of a "sandbox" environment and I can easily take snapshots to do A/B testing or roll things back. I can also send a snapshot to a coworker so they can get my entire environment with all my data in a few seconds.

People really do want to make the browser be the new OS.

Re: Postgres WASM

#104

This is very cool. An important area of ignorance (for me) is how well browsers do with local data. A nightmare scenario is that a user happily uses your app, stores data locally, and then Chrome decides they don't need localstorage anymore. What's the status on local data reliability in browsers?

Wise-men know better than to integrate google stuff into mission critical systems. Their behavior is purely governed by the information consolidation facet of any product or service they offer. Thus, given they already sample user traffic on 80% of the web, the company will continue to cull unpopular projects at astonishingly high rates.

I've lost count of the number of projects I saw get burned by this common mistake.

Re: Postgres WASM

#105

Earlier quoted context omitted.

Agree, it is much slower. I would be interesting to see a comparison between a full recompiled version running on top of a wasm runtime vs some container solution but seems they found a lot of problems recompiling it.

I love how you guys are already pushing us to think about performance issues on this project. Hacker news really pushes technology to the next level!

A good comparison might be something like Flatpak or gVisor.

Re: Postgres WASM

#106
I wish we could replace Docker for dev environments with asdf which examines your project and makes available language tooling for Ruby, Node etc and other tools with pinned versions. With this we could cd to our project and have a Postgres server ready for this project.

Re: Postgres WASM

#107

I wish we could replace Docker for dev environments with asdf which examines your project and makes available language tooling for Ruby, Node etc and other tools with pinned versions. With this we could cd to our project and have a Postgres server ready for this project.

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/ [2] https://asdf-vm.com/guide/introduction.html#direnv

Re: Postgres WASM

#108
Well done.

I can appreciate the technical effort made here. And I think opensourcing something closesourced is always a good thing to do. Documenting also contribute of the global knowledge for different but similar project. I liked the 'page_poisioning' part for size optimization on the blogpost, nice trick.

I have to admit I don't see a lot of "real case application" where this might came really handy, but, who knows, sometimes I'm surprised how OSS make the most of anything seemingly not interesting at first.

Re: Postgres WASM

#109
post #37
post #9

The use cases here are going to be really wide spread in my opinion, just a few ideas off the cuff. Obviously the 30mb size means it won't really be for regular consumer apps, but for enterprise or specific tasks it can make a lot sense. 1. Training websites 2. Interview challenges involving SQL 3. Client side tooling that loads data into your local machine and displays into a SaaS web app without the SaaS app ever h…

IMHO the prime use case for all these WASM stuff is going to be platform independence. Web browsers are not that interesting because for regular use they already have ballooning resource use issues and making web apps even more resource intensive is not exactly inspiring, HOWEVER the web technologies are the only true multi-platform solution we have and it makes sense to use it to make everything with it and everythi…

Isn't that Deno and Node.js?

Re: Postgres WASM

#110

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…

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...

Our demo is on Netlify, so I'm assuming that they've got gzip or something along those lines enabled.

On my 50mbit/s (Germany :/) connection it's ~2 seconds

Post reply on HN