Researchers trained a 4B model to accelerate SQL queries in Postgres
September 16, 2026

Developers introduced QoRL — a specialized model with 4 billion parameters designed to optimize SQL query execution plans. During testing, the system demonstrated the ability to generate plans that execute 44.7% faster than the standard PostgreSQL optimizer. To achieve the result, the model underwent a stage of fine-tuning using reinforcement learning (RL). The effectiveness of the solution was tested on a set of 113 complex queries containing a large number of join operations (join-heavy queries). In peak scenarios, the performance gain reached 81% compared to native Postgres planning algorithms. The system architecture is focused on reducing latency when choosing the execution path. Unlike classical heuristic methods, the model analyzes data structure and distribution statistics to make decisions in real-time. The source code and evaluation methodology are available in the project repository. Integrating similar models into DBMS allows for automating performance tuning in high-load environments. Using the 4B model provides a balance between plan prediction accuracy and computational inference costs, which is critical for database management systems where every millisecond of delay affects overall throughput.



