arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.25568cs.AIcs.CLcs.DB
收藏

LLMs在数据库中是否过时:对SQL有限性的研究

Are LLMs Overkill for Databases?: A Study on the Finiteness of SQL

Cornell University(康奈尔大学)

Yue Li, David Mimno, Unso Eun Seo Jo

AI总结:

本文通过376个数据库样本研究SQL查询的有限性,发现查询复杂度受现实需求限制,且模板分布呈现幂律特征,表明SQL查询可被模板高效覆盖。

摘要:

将自然语言转换为SQL进行数据检索因代码生成LLM而更易实现。但生成SQL的难度如何?尽管数据库复杂度可能无界,但查询复杂度受现实需求限制。通过376个数据库样本,本文显示SQL查询在实际中具有有限的复杂度。数据库表数量增加与SQL查询复杂度增加之间无明显单调关系。在模板形式下,SQL查询的频率分布呈现幂律特征,其中70%的测试查询可由13%的模板类型覆盖,表明大多数SQL查询可预测。这表明尽管代码生成LLM有用,但在数据库访问领域,它们可能在狭窄且高度公式化的空间中运行,模板可能更安全、更经济且可审计。

英文摘要:

Translating natural language to SQL for data retrieval has become more accessible thanks to code generation LLMs. But how hard is it to generate SQL code? While databases can become unbounded in complexity, the complexity of queries is bounded by real life utility and human needs. With a sample of 376 databases, we show that SQL queries, as translations of natural language questions are finite in practical complexity. There is no clear monotonic relationship between increases in database table count and increases in complexity of SQL queries. In their template forms, SQL queries follow a Power Law-like distribution of frequency where 70% of our tested queries can be covered with just 13% of all template types, indicating that the high majority of SQL queries are predictable. This suggests that while LLMs for code generation can be useful, in the domain of database access, they may be operating in a narrow, highly formulaic space where templates could be safer, cheaper, and auditable.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑