1min.

1MIN · DATABASES

A query-planning experiment trains on measured Postgres execution

Rohan Bansal trained a small language model to propose Postgres planning hints, execute candidate plans and learn from measured runtimes. The target is repeated analytical queries, where expensive upfront exploration might pay off across later executions. Its agent can inspect schema and statistics, test alternatives, or keep the database’s default plan when changes do not help.

Rohan Bansal · Sep 16, 2026

Why it matters

A concrete example of building an agent training environment around measurable engineering outcomes.

More context

Read the harness and benchmark methodology before trying the linked code. It uses pg_hint_plan and model inference infrastructure. The best reported result selects among up to 15 candidates per query; it does not come from one instantaneous model prediction.

Keep in mind

Research experiment, not a production optimizer replacement. Benchmark-specific gains exclude the broader cost of searching and training; 1min has not reproduced the measurements.

Original read

More engineering ideas, one minute at a time.

Explore more stories