Live data from Hacker News

Postgres WASM

supabase.com

61–70 of 190 posts

Re: Postgres WASM

#61
post #57

Huh, thought for a second that was a WASM support for stored procedures or something and was excited for a second

Well it's not what you were expecting, but your idea sounds interesting too! Maybe you could muster the same open source forces to make it a reality?

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

Re: Postgres WASM

#62

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.

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.

Re: Postgres WASM

#63
post #53

Earlier quoted context omitted.

yes. this is just a test dummy for something bigger I have. we should chat. Feel free to DM me.

Would love to chat! Love to get your ideas on this.

what is the best way to contact you.

Re: Postgres WASM

#64

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 ru…

Snaplet person here: Having a native WASM version would be a huge win for everyone, especially is storage is decoupled from compute! At the moment the CPU and memory snapshot of the VM (with Postgres) is 12 MB, and subsequent reloads are cached. So yeah, not the worst, but not great. An optimization is that we're using 9P filesystem. So accessing anything on disk is lazily loaded over the network. > Are there future…

> especially is storage is decoupled from compute!

This would be amazing! I can imagine a situation where external tables are managed by some MPP, and a WASM compute engine (Postgres, DuckDB, etc) would be able to at least read subsets/partitions of the full external table.

I wonder if the work required to make a native WASM Postgres would have to be split up into efforts for row-based vs column-based. Selfishly, I would love to have access to a column-based version first.

Re: Postgres WASM

#66
post #50

Hint: Don't use ctrl-w in their terminal. Turns out that has another meaning in Firefox... [EDIT]: I'm zero for three thus far. I give up.

That drives me starkraving mad in AWS CloudShell, because muscle memory happens faster than thinking. I thought there was a web/dom method designed for gaming like "capture all input events" but maybe it has to be in full-screen to work or something

The other one is pressing esc in some web ui if I've been vimming too recently and having it nuke whatever I've typed :-( (it was almost certainly in an Atlassian product, cause they're awesome like that)

Re: Postgres WASM

#67
post #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/v…

Could I hypothetically pass USB through to v86? Like libusb on the host into v86 on the guest? Or do USB over IP or something?

Re: Postgres WASM

#68
I haven't messed around with wasm but I like postgres a lot. Just curious what are some use cases for this? Also not a supabase user even tho it looks cool.

In my case, I use postgres along with postGIS for some of my services. Could this allow me to have some parity where the client can have a 1:1 table but populated and kept up-to-date with their own data to cut down on making network requests?

Re: Postgres WASM

#69
post #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/v…

Could I hypothetically pass USB through to v86? Like libusb on the host into v86 on the guest? Or do USB over IP or something?

Chrome supports a USB api that could potentially work for that, https://developer.chrome.com/docs/extensions/reference/usb/

sadly though it's chrome only, not a standard of any kind (no other browsers support it that I know of). ESPHome can use it to program microcontrollers (along with the serial port support).

Re: Postgres WASM

#70
post #68

I haven't messed around with wasm but I like postgres a lot. Just curious what are some use cases for this? Also not a supabase user even tho it looks cool. In my case, I use postgres along with postGIS for some of my services. Could this allow me to have some parity where the client can have a 1:1 table but populated and kept up-to-date with their own data to cut down on making network requests?

There is a "why" section in the blog post that gives a number of examples. Namely:

- Documentation: for tutorials and demos.

- Offline data: running it in the browser for an offline cache, similar to sql.js or absurd-sql.

- Offline data analysis: using it in a dashboard for offline data analysis and charts.

- Testing: testing PostgresSQL functions, triggers, data modeling, logical replication, etc.

- Dev environments: use it as a development environment — pull data from production or push new data, functions, triggers, views up to production.

- Snapshots: create a test version of your database with sample data, then take a snapshot to send to other developers.

- Support: send snapshots of your database to support personnel to demonstrate an issue you're having.

edit: formatting

Post reply on HN