Live data from Hacker News

Postgres WASM

supabase.com

21–30 of 190 posts

Re: Postgres WASM

#21
One of the things I love from this post is the collaboration on this kind of OSS projects.

Making Postgres Wasm helped:

- v86[0] to find a new bug

- Providing a great deep-dive article that will trigger new ideas in the future

- Showcase the possibilities of Wasm and how you can overcome the current challenges

I really appreciate these projects are OSS :)

Congratulations for the project!

[0] https://github.com/copy/v86

Re: Postgres WASM

#22

For me it's interesting can this work without the need of external proxy server which seems to be needed only to overcome browser connections limitations and nothing else. May there be some more "internal" way to implement/allow these connections? Overall this seems an inspiring thing. Thanks!

Snaplet person here: Totally. It cannot, and it very likely will never be able to do that. Raw sockets were added, and subsequently removed, from Chromium.

Do you mean, connect from 1 browser tab to another?

Re: Postgres WASM

#23

For me it's interesting can this work without the need of external proxy server which seems to be needed only to overcome browser connections limitations and nothing else. May there be some more "internal" way to implement/allow these connections? Overall this seems an inspiring thing. Thanks!

Supabase developer here.

At this point, the proxy is necessary because all the major browsers block direct TCP/IP traffic. They allow websocket connections so that's how we're getting around it.

There have been proposals to open up TCP/IP traffic but they've all been shot down so for the security implications.

Re: Postgres WASM

#24

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 is room for serverless applications with a sane and reasonably complete data storage interface (which localstorage and indexeddb are not.) You could offer users the ability to backup data locally using the filesystem api (which is reasonably usable), or perhaps sync data using p2p using webrtc (which is not as usable as it should be).

Re: Postgres WASM

#25
This is amazing! I used https://rextester.com/l/postgresql_online_compiler to rapidly iterate/prototype some complex jsonb queries for a project at work ~3 years ago, but it has since been locked behind a patreon paywall.

While I've since switched to the native https://postgres.app/, it will be nice to be able to spin up a fresh postgres test db in the browser in the future.

Re: Postgres WASM

#26
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

Re: Postgres WASM

#27
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…

I can really appreciate the fun and technical challenge of running postgres in a browser. However the use cases are extremely far fetched.

1. training website: you can use a hosted PG, or use a sqlite wasm

2. same as above

3. if the use case is being offline, then the web browser isn't very relevant. If the use case is to avoid a load on the server, the sqlite in wasm will be just fine.

It's only if you go into triggers and such that it might start being relevant, but then I'd start seriously questioning what on earth are you trying to do :D

All of that to say: well done to the team that has done it, really fun and interesting work, I just can't see the use from where I stand.

Re: Postgres WASM

#28

For me it's interesting can this work without the need of external proxy server which seems to be needed only to overcome browser connections limitations and nothing else. May there be some more "internal" way to implement/allow these connections? Overall this seems an inspiring thing. Thanks!

Snaplet person here: Totally. It cannot, and it very likely will never be able to do that. Raw sockets were added, and subsequently removed, from Chromium. Do you mean, connect from 1 browser tab to another?

Interestingly we can do this, sorta, but in Chrome only. Using arp you can open a network between multiple tabs of the same Chrome instance, putting each browser vm on a different private ip. I only see this useful, though, for testing clustering systems. There won't be any outside internet connectivity in a setup like this though.

Re: Postgres WASM

#29
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…

Supabase developer here. I've used this to move data from a live Supabase database down to the browser for testing and playing around with things in a "sandbox" environment. Then I save snapshots along the way in case I mess things up. To move a table over from my Supabase-hosted postgres instance to the browser, I just exit out of psql and run something like this: pg_dump --clean --if-exists --quote-all-identifiers…

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.

Re: Postgres WASM

#30

Great! Really impressive. It seems that WASM could be an alternative container solution. This approach is like an intermediate step before recompiling it to wasm.

One that performs way worse then existing container solutions but that will of course be used to distribute binary blobs.
Post reply on HN