Index recommendation is crucial for optimizing database performance. However, existing heuristic- and learning-based methods often rely on inefficient exhaustive search and estimated costs, leading to low efficiency (due to the vast search space) and unsatisfactory actual latency (due to inaccurate estimations). Inspired by the refinement strategies of experienced DBAs-who efficiently identify and iteratively refine indexes with database feedback-we present LLMIA, an out-of-the-box, tuning-free index advisor leveraging large language models (LLMs) through in-context learning for index recommendation. LLMIA injects database expertise into the LLM using a high-quality demonstration pool and comprehensive workload feature extraction, while iteratively incorporating database feedback to guide the index refinement. This design enables LLMIA to emulate the decision-making process of expert DBAs: efficiently recommending and refining indexes for various workloads within just a few interactions with the DBMS. We validate LLMIA with extensive experiments on five standard OLAP benchmarks (TPC-H with different scales, JOB, TPC-DS, SSB), where it consistently outperforms or matches 12 baselines by producing superior index recommendations with minimal database interactions. Additionally, LLMIA demonstrates robust generalization on two real-world commercial workloads, delivering high-quality recommendations without the need for additional adaptation or retraining, highlighting its out-of-the-box capability.
翻译:索引推荐对优化数据库性能至关重要。然而,现有基于启发式和学习的方法通常依赖低效的穷举搜索和估算成本,导致效率低下(由于搜索空间庞大)和实际延迟不理想(由于估算不准确)。受经验丰富的数据库管理员(DBA)优化策略(通过数据库反馈高效识别并迭代优化索引)的启发,我们提出LLMIA——一种开箱即用、免调优的索引顾问,通过大语言模型的上下文学习实现索引推荐。LLMIA利用高质量示范池和全面的工作负载特征提取,将数据库专业知识注入大语言模型,同时迭代整合数据库反馈以指导索引优化。该设计使LLMIA能够模拟专家DBA的决策过程:仅需与数据库管理系统进行少量交互,即可高效推荐并优化适用于各类工作负载的索引。我们在五个标准OLAP基准测试(不同规模TPC-H、JOB、TPC-DS、SSB)上进行了广泛实验验证,结果表明LLMIA通过以最少数据库交互生成更优索引推荐,始终优于或匹敌12个基线方法。此外,LLMIA在两个真实商业工作负载上展现出强大的泛化能力,无需额外适配或重新训练即可提供高质量推荐,凸显其开箱即用特性。