August 12th, 2024

Postgres.new: In-browser Postgres with an AI interface

postgres.new is an in-browser Postgres sandbox that integrates AI assistance for managing databases, supporting features like CSV imports, report generation, and semantic search, with future cost-effective deployments planned.

Read original articleLink Icon
ImpressionSkepticismEnthusiasm
Postgres.new: In-browser Postgres with an AI interface

postgres.new is an innovative in-browser Postgres sandbox that integrates AI assistance, allowing users to create and manage multiple Postgres databases directly in their browser. This tool leverages PGlite, a WebAssembly version of Postgres, enabling functionalities such as drag-and-drop CSV imports, report generation, chart creation, and database diagramming. The AI component, currently utilizing GPT-4o, operates with full autonomy over the database, facilitating seamless execution of SQL commands and error handling. Users can visualize data quickly through integrated charting features and generate entity-relationship diagrams based on AI-generated SQL statements. The platform also supports semantic search capabilities through the pgvector extension, which allows for in-browser vector searches. Future enhancements include read-only deployments on S3, making it cost-effective for developers to utilize Postgres features without the overhead of a full database. PGlite's architecture supports various data persistence backends and is designed for rapid unit testing and local development. Overall, postgres.new aims to streamline database interactions and enhance developer productivity by combining the power of Postgres with AI-driven tools.

- postgres.new offers an in-browser Postgres experience with AI assistance.

- Users can perform tasks like CSV imports, report generation, and chart creation seamlessly.

- The platform utilizes PGlite, enabling fast and efficient database operations.

- Future plans include cost-effective read-only deployments on S3.

- The integration of semantic search capabilities enhances data querying and analysis.

AI: What people are saying
The comments on the article about postgres.new reveal a mix of enthusiasm and skepticism regarding the tool's capabilities and integration of AI.
  • Many users find the AI assistance impressive, successfully generating complex database schemas and handling queries.
  • Some users express concerns about the limitations of AI, noting issues with generating valid SQL and the need for manual code review.
  • There is a desire for a version of the tool that operates without mandatory AI features, as some users prefer a more traditional database management approach.
  • Users appreciate the potential for educational use and collaboration, particularly in teaching SQL and simplifying database interactions for non-technical users.
  • Several comments highlight technical questions and suggestions for future features, indicating active interest in the tool's development.
Link Icon 32 comments
By @stkni - 2 months
This is seriously impressive. I asked it to create 3 different databases:

- a customer orders database with products with a timeseries of prices, and multiple fulfilments per order. - an issue tracking system with a reflexive user/manager database - a family relationship model

In each case I got it to put in sample model and then asked postgres.new to answer some questions about the data it had inserted. I thought the family model would trip it up, especially when I told it to put in cousins and uncles. But no, it was pretty bang on.

The only thing it didn't quite manage is that some of the relationships are reciprocal (i.e. my sibling also has me as a sibling).

I asked postgres.new to review the data and it fixed some, and i asked it to check again and it fixed the rest. This is a very useful tool that I can see myself using!

By @TeeWEE - 2 months
It is a neat tech demo but it clearly shows the limits of AI:

- I got it to generate invalid SQL resulting in errors - it merely generates reasonable SQL, but in my case it generated to disjoint set of tables…. - In practice you have tot review all code - It can point you into the wrong direction. Novel systems often have something smart/abstract in there. This system creates mostly Straightforward simple systems. That’s not where the value is

All in all, it’s not worth it to me. Writing code myself is easier than having to review LLM code

Within our organization we have forbidden full LLM merge request because more often than not the code was suboptimal. And had sneaky bugs/mistakes.

I’m not saying these can’t be overcome. But not with current LLM design. They mostly generate stuff they have seen and are bad as truly new stuff.

By @AlexErrant - 2 months
Clicking "New database" doesn't do anything for me...? No changes in the UI, and no messages in the console. Admittedly I'm not signed in with Github, but isn't that only for the AI thing (that really I don't want to use).

Edit: Okay reading kiwicopple's comment makes it clearer that chatGPT is not-optional. I'm... not enthused by this. Why would you take something that's local-first and gatekeep it with something as useless as an AI-for-your-db?

https://pglite.dev/repl/ is available as a more barebones browser-pglite playground.

By @refset - 2 months
There's a video overview here: https://www.youtube.com/watch?v=ooWaPVvljlU

Really impressive stuff - congratulations!

By @kolbe - 2 months
Basic question. Is there a service out there where I can easily link my database to an LLM to do this exact same type of analysis, except on one of my own Postgres DBs instead of one backed by PGlite? My org has several non-technical people who would greatly benefit from being able to interact with our DB via an LLM, rather than SQL 101 queries. The PostgreSQL Explorer extension on VS Code helps some, but doesn't quite make it as seamless at this.
By @solarkraft - 2 months
It would be cool to have this without the AI stuff.

Also, does the WASM build perhaps enable using Postgres as an embedded db, where typically SQlite would be used?

By @xyst - 2 months
Normally not a fan of the “AI/LLM” + {existing workflow} headlines that companies have been pumping out but honestly. This might be a decent case. In my experience, LLM is pretty good at generating on the fly data for inserting into databases. So instead of hand rolling or building a query to insert data, it would be easier to query LLM.

Overall, looks pretty good. I’m on mobile but stumbled upon the blog post in comments.

Ask: I understand why it won’t run on mobile but at least give mobile a synopsis of what it’s suppose to do. I almost ignored this if it wasn’t for the luck of seeing your comment.

By @dvasdekis - 2 months
This tool is amazing for us. There's so many pieces to this - the capability is a big step forward for architecting databases.

Rudimentary compared to what you've done, but is it possible to take an existing database schema, developed either in the Supabase migrations style or another tool like Flyway, and draw the diagram? That alone is huge for us in an enterprise setting, and would allow us to communicate the structure of the database to business folks (especially large databases). How does the tool build that from migrations currently?

By @gregnr - 2 months
Supabase engineer here. This was a lot of fun to build with the Electric team. There were a lot of technical hurdles to jump over - I’m happy to cover any questions. We’ll continue shipping throughout the week. I see a lot of feedback in this thread already which we’ll get started with.
By @filleokus - 2 months
> Please connect from a laptop or desktop to use postgres.new.

There's nothing wrong using Webkit / Safari on your laptop or desktop. There are dozens of us, DOZENS!

By @Exuma - 2 months
Immediately closed when you require me to connect to github to just run a query without the use of AI.
By @lolpanda - 2 months
I like the UI. The chat interface is a good fit for this task. How do you prevent or should you prevent users from entering "write me a fib(n) in python" in the chat? To me the chat is solely designed for table creation directives.
By @remus - 2 months
From a quick play this is pretty cool! The design choices it made all seemed pretty sensible to me. For example I asked it to create a schema to support a chat application and it came up with something that works pretty well. I then asked it to modify the schema to support various different bits of functionality (e.g. adding support for images in messages, and soft deleting participants from chats) and it was able to handle all those. In addition it was suggesting sensible constraints (foreign keys, nullable, unique) where you'd expect them.

Good work

By @ignoramous - 2 months
From the blog's section on semantic search:

  Under the hood, we store the embeddings in a meta.embeddings table then pass back to AI the resulting IDs for each embedding. We do this because embedding vectors are big, and sending these back and forth to the model is not only expensive, but also error prone. Instead, the language model is aware of the meta.embeddings table and simply subqueries to it when it needs access to an embedding.
A couple Qs if anyone knows:

1. What does it mean to "pass back to AI the resulting IDs for each embedding" but not the table rows corresponding to the matched vectors?

2. Does "the language model is aware of the meta.embedding table" mean Supabase has deployed a fine-tuned GPT-4o?

By @samwillis - 2 months
Hey 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 on it over the last month or so. It's fead directly back into the development of PGlite and helped us iron out some bugs and finish hitting the feature list required.

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 paring is going to be incredibly influential, it opens up what has traditionally been a complex technical problem 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!

By @xnx - 2 months
Utilizes PGLite

2 hours ago | 41 comments: https://news.ycombinator.com/item?id=41224689

By @oulipo - 2 months
Very cool! What about projects/integrations with

- duckdb which also supports WASM - UWData's Mosaic (https://github.com/uwdata/mosaic) which supports real-time plots

would be really nice to have a kind of "drop-in" page that we could add to any intranet where people could just retrieve an export of some database, and plot it with your code

By @GordonS - 2 months
This is so cool, "just because we could", but I am curious about possible use cases for Postgres in the browser?
By @fsiefken - 2 months
Nice! 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
By @saisrirampur - 2 months
Super cool. Great work team! Love the deploy feature to deploy the entire playground to the cloud and get a connection string. Helps devs get started with Postgres projects very quickly.
By @xilis - 2 months
> create a partitioned table for events with a unique constraint on the event id

infinite error loop

By @netcraft - 2 months
this looks awesome. Is it possible to create a database and load it with data and then share it with others? Would be amazing for teaching SQL, but also just many data collaboration tasks
By @surfingdino - 2 months
Nothing a decent SQL training course could not teach.
By @zooq_ai - 2 months
what kind of data load are we talking here? I know it gets stored locally. So, is it limited by my local disk size?

How will it perform if I have 1TB of data?

By @codingwagie - 2 months
I really do think that software engineering as we know it is ending. It will take 3-5 years for tools like this to mature. But it will happen, and hard fought skill sets like SQL database design, query design, and maybe even ORMs will become obsolete.

My biggest prediction is that ORMs will not be necessary when LLMs can generate SQL. Low level SQL is a better abstraction for LLMs than ORMs, and as people are removed from the equation, so too will abstractions built to help them craft code.

By @maximilianburke - 2 months
> In-browser Postgres

NICE!

> with an AI interface

... uhh

By @mrcwinn - 2 months
It’s asking me to install Flash. Any ideas?