# Quail: Speeding up AI-SQL by jointly optimizing query planner and inference engine

DevFeed: [Quail: Speeding up AI-SQL by jointly optimizing query planner and inference engine](<https://devfeed.tech/articles/quail-speeding-up-ai-sql-by-jointly-optimizing-query-planner-and-inference-engine-79924.md>)

Original publisher: [Read original article](<https://modal.com/blog/quail-billion-tpm>)

Author: Charles Frye; Shreya Shankar

Published: 2026-09-24T00:00:00Z

Content type: article

Language: en

Sources: [Modal](<https://devfeed.tech/sources/modal.md>)

Topics: [AI for SQL query generation](<https://devfeed.tech/topics/ai-for-sql-query-generation.md>), [performance-engineering](<https://devfeed.tech/topics/performance-engineering.md>), [AI Infrastructure](<https://devfeed.tech/topics/ai-infrastructure.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [JOIN](<https://devfeed.tech/topics/join.md>), [vllm](<https://devfeed.tech/topics/vllm.md>), [DuckDB](<https://devfeed.tech/topics/duckdb.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [benchmarking](<https://devfeed.tech/tags/benchmarking.md>), [business-intelligence](<https://devfeed.tech/tags/business-intelligence.md>), [caching](<https://devfeed.tech/tags/caching.md>), [perf](<https://devfeed.tech/tags/perf.md>), [planner](<https://devfeed.tech/tags/planner.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

The article presents Quail, an inference engine that jointly optimizes SQL query plans and LLM inference for AI-SQL workloads. It describes query planning, KV-cache reuse and kernel optimizations, and reports over one billion tokens per minute per H100 GPU on one multi-join query, with 1.84x faster performance than a vLLM baseline averaged across the authors' benchmark tasks.

## Source excerpt

Maximizing perf on AI-SQL queries with the KV-optimal left-deep join