arXiv:2511.07663cs.DBcs.AI2025-11被引 21

让SQL直接处理文本数据,速度提升70倍。

Cortex AISQL: A Production SQL Engine for Unstructured Data

论文配图:Cortex AISQL: A Production SQL Engine for Unstructured Data
图 1 · 摘自论文原文
  • 把大模型推理成本纳入查询优化,动态调度计算资源。
  • 用快慢模型分层处理,提速2-6倍且保持90%以上准确率。
  • 将复杂匹配转为分类任务,查询效率提升15-70倍。

Snowflake的Cortex AISQL是一个生产级SQL引擎,将原生语义操作直接集成到SQL中。用户可编写同时包含关系运算与语义推理的声明式查询,轻松跨结构化与非结构化数据进行检索。然而,语义操作在大规模生产环境下面临根本性挑战:其计算成本远高于传统SQL操作,延迟与吞吐特性差异显著,且在查询编译时无法预知其代价与选择性。现有查询引擎亦未针对此类操作优化。AISQL执行引擎基于Snowflake客户的生产部署数据,提出三项创新技术:第一,AI感知查询优化将大语言模型(LLM)推理成本作为首要优化目标,在查询规划阶段直接推理模型开销,实现2-8×加速;第二,自适应模型级联通过快速代理模型处理多数行数据,仅将不确定样本升级至高性能溯源模型,实现2-6×加速并维持90-95%的溯源模型质量;第三,语义连接查询重写将原本二次方时间复杂度的连接操作重构为多标签分类任务,实现15-70×加速,且预测质量常有提升。AISQL已在Snowflake生产环境中部署,支撑客户在分析、搜索与内容理解等多样化工作负载中的应用。

原文摘要 · Abstract (English)

Snowflake's Cortex AISQL is a production SQL engine that integrates native semantic operations directly into SQL. This integration allows users to write declarative queries that combine relational operations with semantic reasoning, enabling them to query both structured and unstructured data effortlessly. However, making semantic operations efficient at production scale poses fundamental challenges. Semantic operations are more expensive than traditional SQL operations, possess distinct latency and throughput characteristics, and their cost and selectivity are unknown during query compilation. Furthermore, existing query engines are not designed to optimize semantic operations. The AISQL query execution engine addresses these challenges through three novel techniques informed by production deployment data from Snowflake customers. First, AI-aware query optimization treats AI inference cost as a first-class optimization objective, reasoning about large language model (LLM) cost directly during query planning to achieve 2-8$\times$ speedups. Second, adaptive model cascades reduce inference costs by routing most rows through a fast proxy model while escalating uncertain cases to a powerful oracle model, achieving 2-6$\times$ speedups while maintaining 90-95% of oracle model quality. Third, semantic join query rewriting lowers the quadratic time complexity of join operations to linear through reformulation as multi-label classification tasks, achieving 15-70$\times$ speedups with often improved prediction quality. AISQL is deployed in production at Snowflake, where it powers diverse customer workloads across analytics, search, and content understanding.

SQL引擎大模型集成语义查询高效推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。