Interacting with relational databases remains challenging for users across different expertise levels, particularly when composing complex analytical queries or performing administrative tasks. Existing systems typically address either natural language querying or narrow aspects of database administration, lacking a unified and intelligent interface for general-purpose database interaction. We introduce AskDB, a large language model powered agent designed to bridge this gap by supporting both data analysis and administrative operations over SQL databases through natural language. Built on Gemini 2, AskDB integrates two key innovations: a dynamic schema-aware prompting mechanism that effectively incorporates database metadata, and a task decomposition framework that enables the agent to plan and execute multi-step actions. These capabilities allow AskDB to autonomously debug derived SQL, retrieve contextual information via real-time web search, and adaptively refine its responses. We evaluate AskDB on a widely used Text-to-SQL benchmark and a curated set of DBA tasks, demonstrating strong performance in both analytical and administrative scenarios. Our results highlight the potential of AskDB as a unified and intelligent agent for relational database systems, offering an intuitive and accessible experience for end users.
翻译:与关系数据库的交互对于不同专业水平的用户而言仍然具有挑战性,尤其是在编写复杂的分析查询或执行管理任务时。现有系统通常仅解决自然语言查询或数据库管理的特定狭窄方面,缺乏一个统一且智能的通用数据库交互界面。我们介绍了AskDB,一种基于大语言模型的智能体,旨在通过自然语言支持对SQL数据库的数据分析和管理操作,以弥合这一差距。基于Gemini 2构建的AskDB集成了两项关键创新:一种动态感知模式提示机制,能有效整合数据库元数据;以及一个任务分解框架,使智能体能够规划并执行多步骤操作。这些能力使AskDB能够自主调试生成的SQL、通过实时网络搜索检索上下文信息,并自适应地优化其响应。我们在一个广泛使用的Text-to-SQL基准测试和一组精心设计的DBA任务上评估了AskDB,结果显示其在分析和管理场景中均表现出色。我们的结果凸显了AskDB作为关系数据库系统统一智能智能体的潜力,为终端用户提供了直观且易于使用的体验。