Together AI

AI for Systems: Using LLMs to Optimize Database Query Execution

Apr 3, 2026
AI for Systems: Using LLMs to Optimize Database Query Execution
SummaryAI, from the source post

This post details the development of DBPlanBench, a harness for Apache DataFusion that serializes physical query plans into a token-efficient JSON schema for LLM analysis. It introduces the use of JSON Patches for targeted, safe edits to query plans, and an evolutionary search strategy for iterative optimization. The post also presents a method for transferring optimized plans from smaller scale factors (SF3) to larger ones (SF10), demonstrating significant speedups and resource reductions without modifying the database engine.