News for hackers. Stuff that matters.
Re:Learn Postgres at the Playground – Postgres compiled to W... by craigkerstiens on Wednesday August 17, 2022 @12:49PM (#32498722)
Craig here from Crunchy. Pretty excited to ship this. It started with one of our engineers showing up in slack 6 weeks ago "So I did something crazy over the weekend..." from there it evolved into much more.

The post explains a lot of the high level, but we're going to being doing some deeper dives as well including the build process, but also some of how the tutorials are powered by an internal notion doc which allows us to easily iterate and collaborate on the tutorials themselves.

Perhaps our favorite easter egg is that you can bring your own SQL into it for example: https://www.crunchydata.com/developers/playground?sql=https:...

Re:Learn Postgres at the Playground – Postgres compiled to W... by EgoIncarnate on Wednesday August 17, 2022 @07:03PM (#32502927)
Maybe I missed it, but is the licensing info available anywhere? The playground seems to be using v86.js I don't see the required "Redistributions in binary form must reproduce the above copyright notice" -- https://github.com/copy/v86/blob/master/LICENSE
Re:Learn Postgres at the Playground – Postgres compiled to W... by craigkerstiens on Monday August 29, 2022 @09:48AM (#32638188)
Late to this, hadn't noticed until now. We have the license included and linked from from inside the VM as it starts up.
Re:Learn Postgres at the Playground – Postgres compiled to W... by gigel82 on Wednesday August 17, 2022 @09:30PM (#32504113)
v86 is an interesting choice, I wonder why they couldn't compile Postgres itself with Emscripten (AFAIK it's all C code).
Re:Learn Postgres at the Playground – Postgres compiled to W... by rockwotj on Thursday August 18, 2022 @05:24AM (#32507177)
I'm assuming there are too many details like syscalls and file system specific APIs that they needed a lower level virtualization?
Re:Learn Postgres at the Playground – Postgres compiled to W... by starik36 on Wednesday August 17, 2022 @02:00PM (#32499638)
Your scientists were so preoccupied with whether they could, they didn’t stop to think if they should.

Great job!

Re:Learn Postgres at the Playground – Postgres compiled to W... by MuffinFlavored on Wednesday August 17, 2022 @03:49PM (#32500881)
What were the hardest parts of getting it to compile for WASM?
Re:Learn Postgres at the Playground – Postgres compiled to W... by data-leon on Wednesday August 17, 2022 @03:34PM (#32500730)
Very cool, I work on https://sqlpad.io which allows people to practice sql coding interview questions online.

Do you provide 3rd party hosting? Might consider replacing ours to something more flexible like yours in the future.

Re:Learn Postgres at the Playground – Postgres compiled to W... by craigkerstiens on Wednesday August 17, 2022 @03:47PM (#32500866)
Feel free to drop me a note craig.kerstiens at crunchydata and happy to have a conversation to see what options may exist.
Re:Learn Postgres at the Playground – Postgres compiled to W... by apatheticonion on Wednesday August 17, 2022 @11:14PM (#32504836)
Any chance you can give us access to the PSQL sandbox without it being attached to a tutorial. Would both be a great way to learn and also function as a productivity tool if one could fool around with PSQL "scratch pad"
Re:Learn Postgres at the Playground – Postgres compiled to W... by motleydev on Wednesday August 17, 2022 @01:13PM (#32499044)
That's a heck of an easter egg. It's like the TS playground feature, letting people explore exactly what you mean with a bug, etc. Kudos.
Re:Learn Postgres at the Playground – Postgres compiled to W... by xfalcox on Wednesday August 17, 2022 @02:26PM (#32499917)
Broke it trying to load our db schema at https://www.crunchydata.com/developers/playground?sql=https:...

Any ideas?

Re:Learn Postgres at the Playground – Postgres compiled to W... by craigkerstiens on Wednesday August 17, 2022 @02:28PM (#32499951)
Maybe give it another shot or two, it's definitely a slow process to import. We have some improvements coming there in time but it's ideal at moment for smaller schemas and datasets.
Re:Learn Postgres at the Playground – Postgres compiled to W... by capableweb on Wednesday August 17, 2022 @03:55PM (#32500964)
You definitely seem to have some issues with memory usage, crashes my tab when trying to load that link on a device with low amount of memory (4GB).
Re:Learn Postgres at the Playground – Postgres compiled to W... by treeman79 on Wednesday August 17, 2022 @07:38PM (#32503247)
Maybe a per tab memory limit. Step 11 talks about increasing memory.

https://www.guidingtech.com/fix-google-chrome-out-of-memory-...

Re:Learn Postgres at the Playground – Postgres compiled to W... by thesausageking on Wednesday August 17, 2022 @01:50PM (#32499537)
This is awesome. Can you talk about how was it implemented? Is it actually a port of the postgres code that's been compiled to WASM?
Re:Learn Postgres at the Playground – Postgres compiled to W... by craigkerstiens on Wednesday August 17, 2022 @02:28PM (#32499952)
This is definitely our plan, we've got some follow on posts that go into much more detail on how we built it so stay tuned for those.
Re:Learn Postgres at the Playground – Postgres compiled to W... by ZitchDog on Wednesday August 17, 2022 @03:27PM (#32500656)
Would love to see this! I could see a wasm version of postgres being useful for all sorts of things, especially an easy dev instance of pg runing inside a node app.
Re:Learn Postgres at the Playground – Postgres compiled to W... by stuaxo on Wednesday August 17, 2022 @04:58PM (#32501653)
This is great, I can't wait for someone to get python in the browser talking to postgres in the browser (and hopefully very soon afterward Django in the browser).
Re:Learn Postgres at the Playground – Postgres compiled to W... by nerpderp82 on Wednesday August 17, 2022 @05:40PM (#32502069)
You are going to need K8S in there to manage all the complexity.
Re:Learn Postgres at the Playground – Postgres compiled to W... by codethief on Thursday August 18, 2022 @12:55PM (#32512139)
And Docker in between to properly isolate processes and dependencies.
Re:Learn Postgres at the Playground – Postgres compiled to W... by FpUser on Wednesday August 17, 2022 @07:22PM (#32503101)
I agree. Those damn computers are becoming too fast. It is time to to slow'em down proper so we can pay more for a hardware.
Re:Learn Postgres at the Playground – Postgres compiled to W... by 2Gkashmiri on Thursday August 18, 2022 @02:50AM (#32506165)
Bring back the turbo button
Re:Learn Postgres at the Playground – Postgres compiled to W... by xfalcox on Wednesday August 17, 2022 @12:56PM (#32498818)
> Perhaps our favorite easter egg is that you can bring your own SQL into it for example

That is super awesome! I plan to use it to allow people to peruse our table structure easily.

Re:Learn Postgres at the Playground – Postgres compiled to W... by titzer on Wednesday August 17, 2022 @07:32PM (#32503200)
This is great. Have you done any benchmarking? I am currently looking to find/create good Wasm benchmarks, and it seems like this might be a good workload.
Re:Learn Postgres at the Playground – Postgres compiled to W... by dprice1 on Thursday August 18, 2022 @02:36PM (#32513291)
@Craig, I wonder if you've thought of making this available (would it work??) for test case construction. Today (working in Go) I start a postgres in a docker container for testing database code. Could I instead use a go wasm runtime, and start postgres inside of it? That would potentially free me from the docker dependency in these tests.
Re:Learn Postgres at the Playground – Postgres compiled to W... by craigkerstiens on Monday August 29, 2022 @09:49AM (#32638202)
The communication in and out is a bit of extra work at the moment. We've got some thoughts on improving this in the future, but it's a bit unclear on timeline and roadmap. We're excited to hear what people want from it and how they use it and that'll inform a lot of how we move forward.
Re:Learn Postgres at the Playground – Postgres compiled to W... by staplung on Wednesday August 17, 2022 @10:53PM (#32504698)
> Perhaps our favorite easter egg is that you can bring your own SQL into it

This is very cool but I wouldn't call it an easter egg, I'd just call it a feature!

Re:Learn Postgres at the Playground – Postgres compiled to W... by Mo3 on Wednesday August 17, 2022 @01:31PM (#32499300)
This is a really cool tool. Nice work
Re:Learn Postgres at the Playground – Postgres compiled to W... by tofuahdude on Wednesday August 17, 2022 @01:18PM (#32499120)
Pretty cool project!