DEV Community

Harsh Kadyan
Harsh Kadyan

Posted on

An AI model that writes postgres query plans

been deep in query optimization at work this week. postgres is fast but once your tables get big the planner starts making weird choices

just read about this open weight model that learned to generate postgres query plans. 4 billion params. runs 81% faster than the native planner on the queries they tested

the wild part is it's not replacing postgres. it sits beside the planner and suggests better plans for the slow stuff. kinda like having a senior DBA in your query path

i deal with this daily at megallm. some queries just refuse to be fast no matter how many indexes u throw at them. an AI that actually understands the shape of your data and picks a better join order could be huge

has anyone tried hooking a model into their actual production query pipeline tho. feels risky but the numbers are tempting

harshkadyan #thedevs #brutalharsh

Top comments (0)