2019 · 33 citations · 34 references
ComputingComputer ScienceInformation SystemsAlgorithmsDatabasesFormal MethodsEquivalence CheckingQuery ProcessingComplexity-theoretic HardnessCounterexample AnalysisNp-completeness
For testing the correctness of SQL queries, a standard practice is to execute the query in question on some test database instance and compare its result with that of the correct query. Given two queries $Q_1$ and $Q_2$, we say that a database instance D is a counterexample (for $Q_1$ and $Q_2$) if $Q_1(D)$ differs from $Q_2(D)$; such a counterexample can serve as an explanation of why $Q_1$ and $Q_2$ are not equivalent. While the test database instance may serve as a counterexample, it may be too large or complex to understand where the inequivalence arises. Therefore, in this paper, given a known counterexample D for $Q_1$ and $Q_2$, we aim to find the smallest counterexample $D' \subseteq D$ where $Q_1(D') \neq Q_2(D')$. The problem in general is NP-hard. Drawing techniques from provenance and constraint solving, we develop a suite of algorithms for finding small counterexamples for different classes of queries, including those involving negation and aggregation. We evaluate the effectiveness and scalability of our algorithms on student queries from an undergraduate database course, and on queries from the TPC-H benchmark. We also report a user study from the course where we deployed our tool to help students with an assignment on relational algebra.
34
Some simplified NP-complete graph problems
M. R. Garey, David S. Johnson, Larry Stockmeyer · Theoretical Computer Science · 1976 · 2.1K citations
The complexity of relational query languages (Extended Abstract)
Moshe Y. Vardi · 1982 · 1.2K citations
Computing, Computer Science, Algebra +16
Incomplete Information in Relational Databases
Tomasz Imieliński, Witold Lipski · Journal of the ACM · 1984 · 1K citations · Full text
Todd J. Green, Grigoris Karvounarakis, Val Tannen · 2007 · 799 citations · Full text
The SMT-LIB Standard Version 2.0
Clark Barrett, Aaron Stump, Cesare Tinelli · 2010 · 722 citations