Loading video...

Video Failed to Load

Go Home

We open sourced Postgres LLM many developer AI work flows look like this: upsert row -> api call -> process with ai -> update row so we thought what if you can run LLMs right in your database with all the primitives and auth - fully async, doesn't block...

60,425 views • 5 months ago •via X (Twitter)

25 Comments

Yoeven's profile picture
Yoeven5 months ago

Full blog:

Supabase's profile picture
Supabase5 months ago

This is 🔥

CryptoClaw's profile picture
CryptoClaw5 months ago

this is clean. the upsert -> api call -> process -> update pattern is literally every AI workflow i've built. putting the LLM call inside the db layer removes so much plumbing. no more orchestrating between supabase and an external service. async + any model is the right call too

Sadiq (mech interp arc)'s profile picture
Sadiq (mech interp arc)5 months ago

uhh finally someone built it And it's yoeven

Occludra - AI Security Gateway's profile picture
Occludra - AI Security Gateway5 months ago

Interesting architecture. Running LLMs inside Postgres means your row data flows directly into prompts. Worth thinking about which columns get passed to the model and whether PII redaction lives at the DB layer or above it.

Yoeven's profile picture
Yoeven5 months ago

@AISGateway Great point. You can define which columns from your row flow into your prompt, only selected columns will be seen but the prompt. So you can architect it accordingly

opensourceaihub's profile picture
opensourceaihub5 months ago

Moving LLM calls into the DB layer is a clever inversion. Eliminates the app-orchestration round trip and keeps the logic where the data already lives. How does it handle provider rate limits at query scale?

Yoeven's profile picture
Yoeven5 months ago

There's a batching queue system built in which you can adjust according to the rate limits you have

Keith Vaughan's profile picture
Keith Vaughan5 months ago

@MekongWhisper

Pratham Patel's profile picture
Pratham Patel5 months ago

This is interesting something i would love to use, but doesn't supabase already have this?

Yoeven's profile picture
Yoeven5 months ago

Now it does ;)

Saïd Aitmbarek's profile picture
Saïd Aitmbarek5 months ago

dope!

Saylor's profile picture
Saylor5 months ago

Baking the AI natively into Postgres triggers gives you perfect ACID compliance and zero middleware. Postgres isn't an async HTTP client. If you insert 10,000 rows at once, pg_cron will fire 10,000 HTTP requests to the LLM. You'll exhaust the database worker pool waiting for inference. Edge workers should poll the DB.

Yoeven's profile picture
Yoeven5 months ago

It's batched by default by chunks of 20, you can increase it or reduce it based on your compute. You could set up edge workers if you want but it defeats the purpose since it leaves the Postgres word and goes back to calling a server.

Saylor's profile picture
Saylor5 months ago

Batching by 20 reduces the request count, but it doesn't solve the core scalability limit: inference latency.

Vincenzo Domina, M.eng's profile picture
Vincenzo Domina, M.eng5 months ago

YES finally ... super excited! was thinking about this for a while similar like cloudflare is going for a fullstack agent in a box with batteries included (state, db, etc) this sounds like the missing piece for a full agent runtime in a "supabase box"

gary IH fung's profile picture
gary IH fung5 months ago

yikes

Yoeven's profile picture
Yoeven5 months ago

Well idk what to tell you, more and more app logic between your database, server and even frontend is more shared than ever before. Authorisation used to be server logic, now we have RLS. The implementation does matters, give it a try, you might like it :)

gary IH fung's profile picture
gary IH fung5 months ago

add rls is an antipattern to my list

Yoeven's profile picture
Yoeven5 months ago

Ok boomer

gary IH fung's profile picture
gary IH fung5 months ago

ah, Slop Combinator invested in you? That explains it good luck kid

Mr Trava's profile picture
Mr Trava5 months ago

@dshukertjr Running LLMs inside Postgres could slash API overhead for real time product enrichment. How do you handle concurrency when multiple order rows trigger AI processing at the same time?

🇺🇸captain america 🇺🇸's profile picture
🇺🇸captain america 🇺🇸5 months ago

@supabase Yoooo very cool 👀

mac's profile picture
mac5 months ago

"Claude integrate this somehow into our supabase projects and make no mistakes"

Trevor I. Lasn's profile picture
Trevor I. Lasn5 months ago

oh this is exactly the piece i've been wanting. my pgvector pipeline is mostly upsert plus external call plus update row, running it inline kills the round trip

Related Videos