Query Optimization and Evaluation via Information Theory: A Tutorial
2026-04-06 • Databases
DatabasesInformation Theory
AI summaryⓘ
The authors explain a general method called PANDA for efficiently answering database queries, specifically conjunctive queries. Normally, it’s hard to find one method that works as fast as custom-built algorithms for every query. PANDA uses math to estimate the sizes of intermediate results during query processing and creates query plans based on those estimates. This approach links the theory and algorithm closely, sometimes matching or beating specialized algorithms. The paper provides examples to help readers understand how PANDA works.
Conjunctive QueryQuery EvaluationQuery OptimizationDatabase TheoryConstraint Satisfaction ProblemsGraph AlgorithmsIntermediate RelationQuery PlanInformation TheoryMatrix Multiplication
Authors
Mahmoud Abo Khamis, Hung Q. Ngo, Dan Suciu
Abstract
Database theory is exciting because it studies highly general and practically useful abstractions. Conjunctive query (CQ) evaluation is a prime example: it simultaneously generalizes graph pattern matching, constraint satisfaction, and statistical inference, among others. This generality is both the strength and the central challenge of the field. The query optimization and evaluation problem is fundamentally a "meta-algorithm" problem: given a query $Q$ and statistics $\cal S$ about the input database, how should one best answer $Q$? Because the problem is so general, it is often impossible for such a meta-algorithm to match the runtimes of specialized algorithms designed for a fixed query -- or so it seemed. The past fifteen years have witnessed an exciting development in database theory: a general framework, called PANDA, that emerged from advances in database theory, constraint satisfaction problems (CSP), and graph algorithms, for evaluating conjunctive queries given input data statistics. The key idea is to derive information-theoretically tight upper bounds on the cardinalities of intermediate relations produced during query evaluation. These bounds determine the costs of query plans, and crucially, the query plans themselves are derived directly from the mathematical proof of the upper bound. This tight coupling of proof and algorithm is what makes PANDA both principled and powerful. Remarkably, this generic algorithm matches -- and in some cases subsumes -- the runtimes of specialized algorithms for the same problems, including algorithms that exploit fast matrix multiplication. This paper is a tutorial on the PANDA framework. We illustrate the key ideas through concrete examples, conveying the main intuitions behind the theory.