WyvernoDragon

WyvernoDragon

I’ve been working on pgRx: a query engine that uses BEAM lightweight processes instead of PostgreSQL’s fork-per-connection model.

The numbers: 50 idle connections cost PostgreSQL 729MB additional memory. On pgRx it’s 0KB. Hibernated BEAM processes drop to ~400 bytes each.

How it works:

  • Each connection is a GenServer (~2KB active, hibernated to
    ~400 bytes when idle)
  • SQL parsing and execution happens in a Rust NIF via
    pg_query (the same parser PostgreSQL uses)
  • Shared state via RwLock — no per-connection data
    duplication
  • Wire protocol v3 implemented — psql connects without
    changes

What works today: JOINs (all types), subqueries, aggregates, GROUP BY, HAVING, ORDER BY, INSERT/UPDATE/DELETE with RETURNING, prepared statements.

The thesis: PostgreSQL’s process-per-connection model is essentially a worse version of BEAM’s actor model. OpenAI runs 800M ChatGPT users on a single PostgreSQL and has already hit connection storms causing outages. The architecture hasn’t changed since 1986. BEAM was built for exactly this problem at Ericsson - millions of concurrent isolated processes.

GitHub:

https://github.com/JagritGumber/pgrx

Demo site:

Would love to know the parts that have been annoying you, so I can fix them with this iteration.

Where Next? Top

Trending in RFCs Top

Hedgehog-ai
Hello I would like feedback on an experimental neuroevolution (including substrate encoding) library called Bardo based on the amazing wo...
New
Agostinho1965
Hey everyone — I’m putting together a practical, code-first book on building production-ready business applications with Phoenix LiveView...
New
tallakt
Hi I was working on an old idea of a “Soft PLC” written on top of Elixir. It was too much work but with the advent of better AI I though...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews