← Back to KHAO

PostgreSQL ·

Tuning a 4B model to produce 81% faster query gears up than Postgres

2 min read

Compiled by KHAO Editorial — aggregated from 1 source. See llms.txt for citation guidance.

◌ Single Source

The two join trees for our query. The lower join runs first; the result is an input into the root join.

Leis et al. asked this exact question in 2015.

Key facts

Summary

Despite an enormous body of research spanning a decade since their original exploration, they found that query optimizers continue to leave much to be desired. So query optimizers are hard. What’s not as hard is verifying whether a query plan an optimizer picks is good or not. What follows is a breakdown of an experiment the reporter ran to explore the question: can a small, open-weights model be post-trained via supervised fine-tuning (SFT) and agentic reinforcement learning (RL) to produce Postgres query plans that beat Postgres’s default plans? Attaining a 44.7% latency reduction across 113 join-heavy queries from a 4B model initially unable to produce a query plan for 99 of them.

Read full article at rohanbansal.com →

#PostgreSQL