• Home
  • Search
  • Logical and Physical Optimizations for SQL Query Execution over Large Language Models
  • Cite Icon1
  • https://doi.org/10.1145/3725411Copy DOI Icon

Logical and Physical Optimizations for SQL Query Execution over Large Language Models

Show More
  • Abstract
  • Literature Map
  • References
  • Citations
  • Similar Papers
Abstract

Interacting with Large Language Models (LLMs) via declarative queries is increasingly popular for tasks like question answering and data extraction, thanks to their ability to process vast unstructured data. However, LLMs often struggle with answering complex factual questions, exhibiting low precision and recall in the returned data. This challenge highlights that executing queries on LLMs remains a largely unexplored domain, where traditional data processing assumptions often fall short. Conventional query optimization, typically cost-driven, overlooks LLM-specific quality challenges such as contextual understanding. Just as new physical operators are designed to address the unique characteristics of LLMs, optimization must consider these quality challenges. Our results highlight that adhering strictly to conventional query optimization principles fails to generate the best plans in terms of result quality. To tackle this challenge, we present a novel approach to enhance SQL results by applying query optimization techniques specifically adapted for LLMs. We introduce a database system, GALOIS, that sits between the query and the LLM, effectively using the latter as a storage layer. We design alternative physical operators tailored for LLM-based query execution and adapt traditional optimization strategies to this novel context. For example, while pushing down operators in the query plan reduces execution cost (fewer calls to the model), it might complicate the call to the LLM and deteriorate result quality. Additionally, these models lack a traditional catalog for optimization, leading us to develop methods to dynamically gather such metadata during query execution. Our solution is compatible with any LLM and balances the trade-off between query result quality and execution cost. Experiments show up to 144% quality improvement over questions in Natural Language and 29% over direct SQL execution, highlighting the advantages of integrating database solutions with LLMs.

Similar Papers
  • Research Article

Evaluating gpt-4 for zero-shot classification of bleeding and clotting events: Can large language models serve as second reviewers?

  • Nov 03, 2025
  • Blood
  • Samantha Rizzo +5
  • Research Article

Evaluating large language models for clinical note processing: local fine-tuning and internal-external validation using electronic health records from South Asia.

  • Feb 25, 2026
  • BMC medical informatics and decision making
  • Seyed Alireza Hasheminasab +18
  • Research Article

#2924 Comparison of large language models and traditional natural language processing techniques in predicting arteriovenous fistula failure

  • May 23, 2024
  • Nephrology Dialysis Transplantation
  • Suman Lama +6
  • Research Article

TencentLLMEval: A Hierarchical Evaluation of Real-World Capabilities for Human-Aligned LLMs

  • Apr 29, 2025
  • ACM Transactions on Intelligent Systems and Technology
  • Shuyi Xie +15
  • Conference Article
  • Citations18

Medical Adaptation of Large Language and Vision-Language Models: Are We Making Progress?

  • Jan 01, 2024
  • Daniel P Jeong +3
  • Research Article
  • Citations51

Large language models for biomedicine: foundations, opportunities, challenges, and best practices.

  • Apr 24, 2024
  • Journal of the American Medical Informatics Association : JAMIA
  • Satya S Sahoo +8
  • Research Article

Protocol for a scoping review examining the application of large language models in healthcare education and public health learning spaces

  • Jan 02, 2026
  • PLOS One
  • Henry Ndukwe +1
  • Research Article
  • Citations642

A Review on Large Language Models: Architectures, Applications, Taxonomies, Open Issues and Challenges

  • Jan 01, 2024
  • IEEE Access
  • Mohaimenul Azam Khan Raiaan +8
  • PDF
  • Research Article
  • Citations13

Advancements and Applications of Large Language Models in Natural Language Processing: A Comprehensive Review

  • Nov 26, 2024
  • Applied and Computational Engineering
  • Mengchao Ren
  • Research Article

Can LLMs effectively provide game-theoretic-based scenarios for cybersecurity?

  • Dec 11, 2025
  • Frontiers in Computer Science
  • Daniele Proverbio +5
  • Research Article
  • Citations67

The life cycle of large language models in education: A framework for understanding sources of bias

  • Jul 12, 2024
  • British Journal of Educational Technology
  • Jinsook Lee +4
  • Research Article
  • Citations19

A novel prompting method for few-shot NER via LLMs

  • Aug 24, 2024
  • Natural Language Processing Journal
  • Qi Cheng +5
  • Research Article

Large language model enhanced framework for systematic reviews and meta-analyses

  • Oct 01, 2025
  • BMJ Digital Health & AI
  • Jiashu Shen +5
  • Conference Article
  • Citations4

Knowledge graph Extraction from Textual data using LLM

  • Jan 01, 2024
  • Research Article
  • Citations20

DialogueLLM: Context and emotion knowledge-tuned large language models for emotion recognition in conversations.

  • Dec 01, 2025
  • Neural networks : the official journal of the International Neural Network Society
  • Yazhou Zhang +6
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.