LLM4Hint: Leveraging Large Language Models for Hint Recommendation in Offline Query Optimization
Suchen Liu, Jun Gao, Yinjun Han, Yang Lin

TL;DR
This paper introduces LLM4Hint, a novel approach that uses large language models to recommend query optimization hints, improving efficiency and generalization in offline query optimization for database management systems.
Contribution
The paper proposes a hybrid method combining lightweight models and large language models to enhance hint recommendation, reducing inference latency and fine-tuning costs while outperforming existing learned optimizers.
Findings
LLM4Hint outperforms state-of-the-art learned optimizers in effectiveness.
The approach improves generalization across different query workloads.
Using a query rewriting strategy simplifies SQL semantics for better LLM understanding.
Abstract
Query optimization is essential for efficient SQL query execution in DBMS, and remains attractive over time due to the growth of data volumes and advances in hardware. Existing traditional optimizers struggle with the cumbersome hand-tuning required for complex workloads, and the learning-based methods face limitations in ensuring generalization. With the great success of Large Language Model (LLM) across diverse downstream tasks, this paper explores how LLMs can be incorporated to enhance the generalization of learned optimizers. Though promising, such an incorporation still presents challenges, mainly including high model inference latency, and the substantial fine-tuning cost and suboptimal performance due to inherent discrepancy between the token sequences in LLM and structured SQL execution plans with rich numerical features. In this paper, we focus on recurring queries in…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
