# Databricks — Are LLM agents good at join order optimization?

- Company: Databricks (databricks.com)
- Announced: 2026-04-22T21:30:00+00:00
- Category: research-paper
- Coverage: not counted
- Announcement: yes
- Group: announcements
- Source: https://www.databricks.com/blog/are-llm-agents-good-join-order-optimization
- Record: https://forck.live/items/25349-are-llm-agents-good-at-join-order-optimization
- Subject: Mosaic AI

Databricks reports that a prototype LLM agent beat its own query optimizer on join ordering in 80% of benchmark cases, cutting query latency by 1.3x overall. The work, a research collaboration with UPenn, targets a decades-old database problem: cardinality estimation is hard, and the number of possible join plans grows exponentially with the number of tables, so optimizers often pick poor orderings. The agent acts like an offline experimenter rather than sitting in the optimizer's hot path, which must choose join orders in a few hundred milliseconds. It has one tool that executes a candidate join order and returns its runtime, capped at the original query's runtime, plus the size of each computed subplan. The agent ran 50 iterations per query, free to exploit promising plans or explore risky ones, and structured model outputs force every tool call to produce a valid join reordering. Evaluation used the Join Order Benchmark, whose IMDb dataset was scaled up by duplicating each row 10 times, with 15 rollouts per query across all 113 queries.

## Evidence

Verbatim from https://www.databricks.com/blog/are-llm-agents-good-join-order-optimization:

> In experimental benchmarks, the prototype agent improved upon the Databricks optimizer in 80% of cases, improving query latency by a factor of 1.3x overall.

---

Record: https://forck.live/items/25349-are-llm-agents-good-at-join-order-optimization
Catalogue: https://forck.live/llms.txt
Current issue: https://forck.live/feed.md
