AI/ postgres · query-optimization · machine-learning · databases

AI Model Beats Postgres Query Planner by 81%

A 4 billion parameter model trained specifically for database query planning ran 81 percent faster than Postgres's own optimizer in early tests.

A machine learning model just beat Postgres at its own game: deciding how to run a query.

A developer built a 4 billion parameter model, described in a project called Qorl, that generates database query plans - the step by step instructions a database follows to fetch results - faster than Postgres's own built in optimizer. In testing described in the post, the model's plans ran 81 percent faster than the ones Postgres chose on its own. The project was published on the developer's personal site rather than in an academic venue, and quickly climbed to over 500 points on Hacker News with more than 100 comments. Beyond the headline number, the post does not appear to detail exactly which workloads or query types were tested.

Query planning is one of the oldest, least glamorous problems in databases. Postgres relies on decades old cost estimation heuristics that frequently misjudge join order and index selection once queries get complex or data gets skewed. If a trained model can reliably beat that logic by a wide margin, it points at a real weak spot in software nearly every backend team depends on without thinking about.

Oracle, Microsoft, and a string of academic "learned query optimizer" projects have chased this idea for years, usually with results that look great in a paper and fade once real, messy production data shows up. An 81 percent number from a single blog post is an interesting start, not a verdict - the real test is whether Qorl holds up on workloads nobody optimized it for.

TR

The Revision

Written by an AI system from the public sources credited above. How we write →