Efficient Computation of Polynomial Explanations of Why-Not Questions

Nicole Bidoit, Melanie Herschel, Aikaterini Tzompanaki

TL;DR

This paper introduces a novel polynomial-based framework for explaining "Why-Not" database queries, which are crucial for understanding why expected data is missing. They present an efficient algorithm, Ted++, that significantly outperforms existing methods in both speed and completeness of explanations, offering a more practical solution for query debugging and refinement.

What Problem Does This Paper Address?

When querying large databases, users often encounter situations where the results don't contain the data they expect. These are "Why-Not" questions: "Why is X missing from the query results?" Traditionally, debugging these issues involves manually analyzing queries, which can be tedious and error-prone, especially with complex queries. Existing methods for answering Why-Not questions often provide incomplete or query-tree-dependent explanations, forcing users to reason about internal query structures rather than the declarative SQL they are familiar with. This paper aims to provide a more robust, efficient, and user-friendly way to explain these missing answers.

Methods

The core contribution is a formalization of Why-Not explanations as polynomials. This approach offers a unified framework that is independent of specific query execution plans and can handle various database semantics (set, bag, probabilistic). The key idea is that each term in the polynomial represents a distinct explanation (a combination of query conditions that, if "repaired," could lead to the missing data), and the coefficients indicate the number of missing tuples that explanation could recover.

To efficiently compute these polynomials, the authors developed the Ted++ algorithm. Unlike previous methods that enumerate all "compatible tuples" (tuples that could have been in the result but were pruned), Ted++ avoids this costly step. Instead, it works by:

  1. Partitioning the schema: Dividing the database schema based on the Why-Not question's conditions.
  2. Computing partial compatible tuples: Calculating compatible tuples within these partitions.
  3. Iterating through explanations: Systematically exploring combinations of query conditions as potential explanations.
  4. Estimating coefficients: Using mathematical calculations and view materialization strategies to determine how many missing tuples each explanation accounts for, without materializing the full set of compatible tuples.

Datasets

The paper uses several datasets for evaluation:

  • Crime database: A sample database used in previous work on Why-Not questions.
  • IMDB database: Real-world movie data.
  • Gov database: Information about US congressmen and financial activities.
  • TPC-H benchmark data: Used to generate synthetic datasets of varying sizes (10MB, 100MB, 1GB, 10GB) to test scalability.

No new benchmarks were introduced; instead, existing datasets were used to compare Ted++ against prior work.

Key Insights and Ideas

  • Polynomials as a unified explanation: Representing explanations as polynomials elegantly handles multiple alternative explanations and their potential impact, offering a richer understanding than simple sets of conditions.
  • Independence from query trees: The polynomial approach provides explanations that are tied to the declarative query itself, not to a specific execution plan, making them more stable and easier for users to interpret.
  • Efficiency through avoiding compatible tuple enumeration: Ted++'s key innovation is bypassing the computationally expensive step of generating all compatible tuples, leading to significant performance gains.
  • Completeness of explanations: Ted++ guarantees that all possible explanations are found, unlike previous methods that might miss alternatives or parts of explanations.
  • Coefficients as a measure of impact: The coefficients in the polynomial provide valuable information about how many missing tuples an explanation might help recover, guiding users towards more impactful fixes.

Key Results

  • Performance: Ted++ is shown to be at least as efficient as existing algorithms like NedExplain and significantly faster than the naive Ted algorithm, especially for larger datasets or more complex queries. In many scenarios, Ted++'s runtime is comparable to NedExplain, and in some cases, it's faster.
  • Completeness: Experiments demonstrate that Ted++ provides a complete set of explanations, whereas Why-Not and NedExplain often return incomplete or partial explanations. This is crucial for developers who need to explore all viable options for fixing their queries.
  • Scalability: Ted++ demonstrates good scalability with increasing database size and query complexity, making it a practical tool for real-world applications.
  • Runtime Distribution: Analysis of Ted++'s runtime shows that the coefficientEstimation phase is the most significant, but its performance scales much better with the number of compatible tuples compared to the naive Ted algorithm.

Limitations and Future Work

  • Extension to Aggregation Queries: The paper notes that extending the polynomial explanation framework to handle aggregation queries is not trivial and is a subject for future work.
  • Query Rewriting: The authors are currently working on using the polynomial explanations to efficiently rewrite queries to include missing answers, aiming to select the most promising rewritings based on factors like minimum condition changes and minimum side effects.
  • Optimization of Tuple Tracing: While Ted++ and NedExplain are efficient, the paper suggests that a better implementation of tuple tracing in the Why-Not algorithm could improve its performance to be comparable with NedExplain.

Summary updated

BibTeX
@inproceedings{bidoit2015efficient,
  author = {Nicole Bidoit and Melanie Herschel and Aikaterini Tzompanaki},
  title = {{Efficient Computation of Polynomial Explanations of Why-Not Questions}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2015},
  doi = {10.1145/2806416.2806426},
}
Figure