SAGE Unifies AI Functions in SQL for Better Performance

Xiangqi Wang, Nhan H. Pham, Oktie Hassanzadeh, Dharmashankar Subramanian, Xiangliang Zhang· August 24, 2026 View original

Key takeaways

  • SAGE unifies diverse AI functions into three SQL primitives: AI_SCALAR, AI_AGG, AI_JOIN.
  • It provides a self-adaptive execution framework that optimizes AI operations within SQL.
  • The framework significantly improves efficiency and quality for AI-powered data tasks.
  • SAGE can drastically reduce computational costs for complex AI joins in databases.

Who benefits

Data AnalyticsSoftware DevelopmentFinancial ServicesBusiness IntelligenceCloud Computing

Summary

SAGE (Self-Adaptive Generative Execution) is a new framework that unifies AI functions within SQL systems using three primitives: AI_SCALAR, AI_AGG, and AI_JOIN. It offers a confidence-gated execution interface and self-adaptive strategies, significantly improving the quality and efficiency of AI-powered SQL operations.

A novel framework named SAGE (Self-Adaptive Generative Execution) has been developed to streamline the integration and execution of AI functions within SQL databases. Despite the diverse APIs of AI functions for tasks like classification or summarization, they fundamentally perform only three relational roles: transforming individual rows, aggregating groups, or generating relationships between pairs of rows. SAGE captures these roles with three unified primitives: AI_SCALAR, AI_AGG, and AI_JOIN. These primitives are designed to compose naturally with standard relational operators and share a confidence-gated execution interface. A key innovation lies in SAGE's self-adaptive physical strategies, particularly for AI_JOIN operations. The system intelligently analyzes predicates and decomposes complex conditions, using a "recipe card" and a small label-free probe to select the most efficient execution strategy. Extensive evaluations across various AI operators and workloads demonstrate that SAGE consistently enhances both the quality and efficiency of AI-driven SQL queries. For instance, it can reduce pairwise model calls in factorable joins by over two orders of magnitude, leading to substantial cost reductions and superior overall performance on benchmarks like SemBench.

Why it matters

Data professionals and developers can leverage SAGE to integrate AI capabilities more efficiently and cost-effectively directly within their SQL environments, simplifying complex data processing and analysis workflows.

How to implement this in your domain

  1. 1Explore the SAGE framework's primitives (AI_SCALAR, AI_AGG, AI_JOIN) for potential integration into data platforms.
  2. 2Assess current SQL-based AI function implementations for opportunities to unify and optimize using SAGE's principles.
  3. 3Develop proof-of-concept applications using SAGE-like constructs to demonstrate efficiency gains in AI-powered data queries.
  4. 4Advocate for database system enhancements that support unified, self-adaptive execution of AI functions within SQL.

Original post by Xiangqi Wang, Nhan H. Pham, Oktie Hassanzadeh, Dharmashankar Subramanian, Xiangliang Zhang

"arXiv:2608.20630v1 Announce Type: new Abstract: SQL systems increasingly expose AI functions for tasks such as classification, extraction, filtering, ranking, retrieval, joining, and summarization. Despite their diverse APIs, these functions play only three relational roles: tran…"

View on X

Originally posted by Xiangqi Wang, Nhan H. Pham, Oktie Hassanzadeh, Dharmashankar Subramanian, Xiangliang Zhang on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses

More in AI Engineering & DevTools