Live data from Hacker News

Postgres WASM

supabase.com

31–40 of 190 posts

Re: Postgres WASM

#31
The first thing to point out is that our implementation isn't pure WASM. We attempted to compile Postgres for WASM directly from source, but it was more complicated that we anticipated.

Crunchy's HN post provided some hints about the approach they took, which was to virtualize a machine in the browser. We pursued this strategy too, settling on v86 which emulates an x86-compatible CPU and hardware in the browser.

I’m out-of-domain but very curious about this part - it seems like a pretty extreme solution with a lot of possible downsides. Does this mean the “just compile native code to WASM” goal is still far off?

Re: Postgres WASM

#32
Looks really nice, but I'm really curious about what hurdles you encountered in making a native WASM version of Postgres. It seems that both the performance and binary size suffer immensely from the VM running underneath. For example, if I compare to DuckDB-WASM [1] there is an immense difference in load time and query execution speed.

Are there future plans at creating a native WASM version of Postgres? Making it run many times faster would certainly open up a lot more use cases.

(Disclaimer: I work on DuckDB, but have not worked on the WASM version myself)

[1] https://shell.duckdb.org

Re: Postgres WASM

#33

One interesting use case that wasn't mentioned is edge computing. If you buy into Chrome-as-a-container that can run on an "edge" more easily than a data center, this is a step in that direction

And those are very likely to have tcp sockets at some point in the future (or at least that is the hope!)

Re: Postgres WASM

#34

Very impressive technically, but what are the practical use cases for this? We have IndexedDB and WebSQL, so apart from the other comments mentioning using it in tutorials, I'm not sure what the value add is. edit: as always, I should read the whole article first. The idea of using it as a dev environment is very cool.

There are some things that are uniquely beneficial for Postgres beyond the data storage - the main one I'm excited about is using PostGIS inside the browswer. OSM + PostGIS in the browser has the potential to do for Maps, what Figma's WASM approach did for design.

But why is it relevant that PostGIS runs inside the browser?

Re: Postgres WASM

#35
post #20

Earlier quoted context omitted.

> 3. Client side tooling that loads data into your local machine and displays into a SaaS web app without the SaaS app ever having your data Member mini mongo? Supabase will be Meteor in no time.

> Supabase will be Meteor in no time. As in they will crash and burn?

Nah I think Supabase will do well. Meteor also did well all things considered. My point is really that they are revisiting all the same technology and product decisions and coming to the same conclusions.

There's only one way to architect a PaaS. Next.js and Vercel's offerings are, essentially, also the same.

The real risk is having one person build it all. They have a team but not really. Personally I believe that's a good risk to take.

But I think it will take a powerful psychological toll to operate this way, having to pretend to have a team (because investors like teams and not solo founders), having to pretend this isn't Meteor (because investors don't like being reminded of "losers"), etc. etc.

Like downvote random Internet comments all you want, but actually I think it's a great idea to have one person do "Better Meteor," it's not my fault investors don't.

Re: Postgres WASM

#36
post #31

The first thing to point out is that our implementation isn't pure WASM. We attempted to compile Postgres for WASM directly from source, but it was more complicated that we anticipated. Crunchy's HN post provided some hints about the approach they took, which was to virtualize a machine in the browser. We pursued this strategy too, settling on v86 which emulates an x86-compatible CPU and hardware in the browser. I’m…

Supabase developer here. I've tried compiling directly to WASM, but it did not go well. As I recall, there were features used by PostgreSQL that WASM didn't support yet. This is definitely something we'll revisit though, especially as WASM matures!

Re: Postgres WASM

#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 everything instantly becomes multi-platform.

What I suspect may happen is, the rise of web browsers of a 3rd kind where these are not really for browsing the web but running code written for native domains. So instead of browsing web of linked text, we can have a web of algorithms to process data and requests.

Re: Postgres WASM

#38
I don't mean to take anything away from this post - its quite amazing and I can't wait to play with it more - but wanted to mention that there are sites out there that I believe solve the training portion maybe a little bit better, at least if all you want is to train on SQL not DBA type actions. My favorite is https://dbfiddle.uk/ - the ability to link and fork a set of statements is extremely handy.
Post reply on HN