TL;DR
This paper introduces a formal framework to quantify the "responsibility" of specific parameter values (like constants in a WHERE clause) for a database query's result. By adapting the SHAP score from machine learning, the authors provide a principled way to measure parameter importance, offering both exact polynomial-time algorithms for acyclic queries and a robust approximation scheme for more complex, correlated scenarios.
What Problem Does This Paper Address?
When we run a database query, the results are often dictated by specific choices of constants—parameters like a maximum price, a specific date, or a category. But how much does each choice actually matter? If a search for "flights under $500 on Friday" returns no results, is the price limit or the date more "to blame"?
Standard sensitivity analysis often fails here because parameters interact: changing one might have no effect unless another is also changed. This is a classic problem of contribution attribution in cooperative game theory. While the machine learning community has embraced SHAP (Shapley Additive Explanations) to explain model features, the database community lacked a rigorous equivalent for query parameters. This paper fills that gap, focusing on the computational complexity of calculating these scores across different query types and similarity measures.
Methods
The authors define the importance of a parameter as its SHAP score. To calculate this, the framework requires:
- A Parameterized Query ($Q$): A query where some constants are treated as variables that can change.
- A Probability Distribution ($\Gamma$): A model of how those parameters might realistically vary.
- A Utility Function ($s$): A way to measure the similarity between the original query result and the result obtained with randomized parameters (e.g., Jaccard index or intersection size).
The core of the method involves evaluating the expected change in query results as parameter sets are toggled. The authors prove a significant theoretical result: two different intuitive approaches to defining importance—measuring the effect of fixing a parameter vs. changing it—actually converge on the same SHAP score.
Datasets
The paper is primarily theoretical and does not utilize large-scale empirical datasets for training or benchmarking. Instead, it uses illustrative examples, such as a flight database schema (Flight, Airline) and synthetic relational structures, to demonstrate the complexity of the algorithms and the behavior of the SHAP scores.
Key Insights and Ideas
- The "Parameter-Acyclic" Requirement: The authors show that standard query acyclicity isn't enough for tractability. They introduce p-acyclicity, which requires the query to remain acyclic even when parameters are treated as variables. If the parameter structure itself is complex (e.g., forming a clique), the problem becomes #P-hard.
- Projection is a Bottleneck: Similar to results in query counting, the presence of existential quantifiers (projection) often pushes the complexity of exact SHAP computation from polynomial time to #P-hardness, even for simple "star-shaped" queries.
- Why-Not Explanations: The framework elegantly extends to "why-not" questions (explaining why a specific tuple is missing from a result). By treating query filters as "players" in a game, SHAP scores can rank which part of the query is most responsible for excluding the expected data.
- Sampling for Correlation: While exact computation is often hard, the authors demonstrate that if you can efficiently sample from the parameter distribution (even if parameters are correlated, like in a Bayesian network), you can achieve an FPRAS (Fully Polynomial Randomized Approximation Scheme) for the SHAP score.
Key Results
- Tractability for Full pACQs: The paper provides polynomial-time algorithms for computing exact SHAP scores for "full" (no projection) acyclic conjunctive queries using natural similarity functions like Intersection and Negative Difference.
- Hardness Proofs: They establish that computing SHAP is #P-hard for queries with projection and for queries involving certain inequality filters, even with independent parameters.
- Approximation Guarantees: They prove that an additive approximation of the SHAP score can be computed efficiently for any tractable query class, provided the similarity function is bounded.
Limitations and Future Work
- Aggregate Queries: The current framework focuses on set-based results (relational algebra). The authors note that extending this to aggregate queries (e.g.,
SUM,AVG) where similarity is measured numerically is a vital next step. - Continuous Parameters: While the paper touches on discretization, a native treatment for continuous probability distributions (like Gaussian models for price or time) remains an open area for refinement.
- Real-world Applications: The authors suggest applying this framework to fact-checking, specifically to detect "cherry-picked" claims that rely too heavily on arbitrary parameter choices to remain true.
Summary updated