Live data from Hacker News

Postgres WASM

supabase.com

11–20 of 190 posts

Re: Postgres WASM

#11
post #5

This is a really exciting milestone for WASM! Has anyone tried compiling postgres for wasm32-wasi and implementing a wasi-compatible interface for the file system and other OS bits postgres needs? I think that would be a big improvement.

Supabase developer here. I worked on this project with the guys over at Snaplet.

One thing we are working on is putting postgres on an alternative filesystem using 9p. There's some really cool work by humphd that creates a filesystem inside IndexedDB[0]. We'd also like to maybe use the browser filesystem component to let you store the database on the host device in a path of your choosing. Not sure if these are possible yet, though.

[0] https://humphd.github.io/browser-shell/

Re: Postgres WASM

#12

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.

Re: Postgres WASM

#13
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 -t my_table -h db.xxxxx.supabase.co -U postgres | psql -U postgres

Keep in mind if you try something like this, our proxy is rate limited for now to prevent abuse, so it might not be super fast. It's easy to remove rate limiting at the proxy, though.

Re: Postgres WASM

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

Also, in case you're curious, PostgreSQL logical replication to the browser wasm instance DOES work. I've done it. :)

Re: Postgres WASM

#15

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.

>We have [...] WebSQL Not any more - iirc it was depreciated. In the case of IndexedDB, I haven't looked into it, but Mozilla has the following to say about it: >Note: IndexedDB API is powerful, but may seem too complicated for simple cases. If you'd prefer a simple API, try libraries in See also section that make IndexedDB more programmer-friendly.[0] I suppose this project could make development easier by allowing…

Oh wow, I never knew WebSQL was deprecated. And yeah IndexedDB is pretty complicated, I've tried working with the API a few times but always abandoned it for simpler solutions.

Re: Postgres WASM

#16
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!

Re: Postgres WASM

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

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

Re: Postgres WASM

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

Re: Postgres WASM

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

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

Post reply on HN