Cortex AISQL: A Production SQL Engine for Unstructured Data
Paritosh Aggarwal, Bowei Chen, Anupam Datta, Benjamin Han, Boxin Jiang, Nitish Jindal, Zihan Li, Aaron Lin, Pawel Liskowski, Jay Tayade, Dimitris Tsirogiannis, Nathan Wiegand, Weicheng Zhao
Snowflake的Cortex AISQL是一个生产SQL引擎,它将本机语义操作直接集成到SQL中。 这种集成允许用户编写声明性查询,将关系操作与语义推理相结合,使他们能够毫不费力地查询结构化和非结构化数据。 然而,在生产规模下使语义操作高效带来了根本性的挑战。 语义运算比传统的 SQL 操作更昂贵,具有明显的延迟和吞吐量特性,并且在查询编译过程中,它们的成本和选择性是未知的。 此外,现有的查询引擎并不是为了优化语义操作而设计的。 ASQL查询执行引擎通过Snowflake客户的生产部署数据提供三种新技术来应对这些挑战。 首先,AI感知查询优化将AI推理成本作为一流的优化目标,推理大型语言模型(LLM)成本在查询规划过程中直接实现2-8×的提速。 其次,自适应模型级联通过快速代理模型路由大多数行来降低推理成本,同时将不确定的情况升级到强大的神谕模型,实现2-6倍的加速,同时保持90-95%的oracle模型质量。 第三,语义连接查询重写将连接操作的二次时间复杂度降低到线性,通过重新计算作为多标签分类任务,实现15-70×加速,通常提高预测质量。 AISQL部署在Snowflake的生产中,为分析,搜索和内容理解的不同客户工作负载提供支持。
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...