3 ms·
Postgres.new
- kiwicopple 2y agohey HN, supabase ceo here. Full details here: https://supabase.com/blog/postgres-new https://supabase.com/blog/postgres-new This is a new service that we're experimenting with that uses PGLite[0], a WASM build of Postgres that runs in the browser. You might remember an earlier WASM build[1] that was around ~30MB. The Electric team [2] have gone one step further and created a complete build of Postgres that’s under 3MB. Their implementation is technically interesting. Postgres is normally multi-process - each client connection is handed to a child process by the postmaster process. In WASM there’s limited/no support for process forking and threads. Fortunately, Postgres has a relatively unknown built-in “single user mode” [3] primarily designed for bootstrapping a new database and disaster recovery. Single-user mode only supports a minimal cancel REPL, so PGlite adds wire-protocol support which enables parametrised queries etc. We have created https://postgres.new https://postgres.new as an experiment. You can think of it like a love-child between Postgres and ChatGPT: in-browser Postgres sandbox with AI assistance. You can spin up as many new Postgres databases as you want because they all live inside your browser. We pair PGlite with an LLM (currently GPT-4o) and give it full reign over the database with unrestricted permissions. This is an important detail - giving an LLM full autonomy means that it can run multiple operations back-to-back: any SQL errors from Postgres are fed back to the language model so that it can have a few more attempts to solve the problem. Since it’s in-browser it’s low risk. Some other features include: - CSV upload: you can upload a CSV and it will automatically create a Postgres table which you can query with natural language. - Charts: you can ask the LLM to create a chart with the data and change the colors of the charts. - RAG / pgvector: PGLite supports pgvector, so you can ask the LLM to create embeddings for RAG. The site uses transformers.js [4] to create embeddings inside the browser. We’re working on an update to deploy your databases and serve them from S3 using pg-gateway [5]. We expect to have a read-only deployments ready by the end of the week. You can access them using any postgres-compatible tool (eg: psql). Everything is open source. A huge shout-out to the Electric team who have been a pleasure to build with. [0] PGLite: https://github.com/electric-sql/pglite https://github.com/electric-sql/pglite [1] Postgres-wasm: https://supabase.com/blog/postgres-wasm https://supabase.com/blog/postgres-wasm [2] Electric: https://electric-sql.com/ https://electric-sql.com/ [3] Single user mode: https://www.postgresql.org/docs/current/app-postgres.html#APP-POSTGRES-SINGLE-USER https://www.postgresql.org/docs/current/app-postgres.html#AP... [4] transformers.js: https://github.com/xenova/transformers.js https://github.com/xenova/transformers.js [5] pg-gateway: https://github.com/supabase-community/pg-gateway https://github.com/supabase-community/pg-gateway
- dang 2y agoPlease don't copy/paste duplicate comments. It makes merging threads a pain - we have to find the original comment (which I've since put at the top of https://news.ycombinator.com/item?id=41224286 https://news.ycombinator.com/item?id=41224286) and then merge the replies.
- samwillis 2y agoHey Sam from Electric here, I work on PGlite What the team at Supabase have built with postgres.new is incredible, it has been a lot of fun to work with them last month or so to have PGlite incorporate the things they needed. It's fed directly back into the development, helped us iron out some bugs and finish hitting the feature list required. They are the most genuinely nice team to work with. SQL databases and LLMs go together so incredible well, the structured data and schema enables an LLM to infer so much context about the database and the underlying data. This exploration into a UI over this pairing is going to be incredibly influential, it opens up what has traditionally been a complex technical problem (designing database schemas) to everyone. That's the true power of LLMs. I'm not going to go on about PGlite here as postgres.new really deserves the limelight!
- dang 2y agoPlease don't copy/paste duplicate comments. It makes merging threads a pain - we have to find the original comment (https://news.ycombinator.com/item?id=41224535 https://news.ycombinator.com/item?id=41224535 in this case) and then merge the replies.
- xyst 2y ago> Please connect from a laptop or desktop to use postgres.new. Not even basic line on what this service is supposed to do? Only able to infer that this provides some on the fly Postgres instance based on DNS name
- kiwicopple 2y agosee my comment for more context: https://news.ycombinator.com/item?id=41226482 https://news.ycombinator.com/item?id=41226482 here is a video, if you're on mobile: https://www.youtube.com/watch?v=ooWaPVvljlU https://www.youtube.com/watch?v=ooWaPVvljlU and a blog post with more details: https://supabase.com/blog/postgres-new https://supabase.com/blog/postgres-new We originally linked[0] to the blog post but it looks like this one overtook us on HN [0] https://news.ycombinator.com/item?id=41224286 https://news.ycombinator.com/item?id=41224286
- cuu508 2y ago"In-browser postgres sandbox with AI"
- MBCook 2y agoSame issue. Would it have been so hard to have an about page?
- xavdid 2y agoThere's not really more info on desktop. That said, it links to https://github.com/supabase-community/postgres-new https://github.com/supabase-community/postgres-new which has some context
- ed 2y ago> To prevent abuse we ask you to sign in before chatting with AI. I want to try this, but, likewise, "to prevent abuse of my Github I ask for some idea what the service does before signing in"
- frays 2y agoInteresting. "In-browser Postges sandbox with AI" Demo video: https://www.youtube.com/watch?v=ooWaPVvljlU https://www.youtube.com/watch?v=ooWaPVvljlU
- CodeWriter23 2y ago> Please connect from a laptop or desktop to use postgres.new. LOL, Next!
- dang 2y agoComments moved to https://news.ycombinator.com/item?id=41224286 https://news.ycombinator.com/item?id=41224286, except the ones that are duplicates and/or only make sense in this context.
- fsiefken 2y agoNice! If it’s WASM it should also work on iOS, so why can’t I connect? Pg.dev works though. I wonder if postgresql wasm can be made to run on A-Shell, even though there is a working SQLite wasm port running on A-Shell, which should be enough