[Paper Review] Efficiently Computing Provenance Graphs for Queries with Negation
This paper presents a unified, efficient framework for computing provenance graphs to explain both why tuples appear and why they are missing in first-order queries with negation. It introduces firing rules extended to capture successful and failed derivations, uses SQL-based rewriting for scalable execution, and demonstrates significant performance gains over prior methods by pruning irrelevant provenance early.
Explaining why an answer is in the result of a query or why it is missing from the result is important for many applications including auditing, debugging data and queries, and answering hypothetical questions about data. Both types of questions, i.e., why and why-not provenance, have been studied extensively. In this work, we present the first practical approach for answering such questions for queries with negation (first-order queries). Our approach is based on a rewriting of Datalog rules (called firing rules) that captures successful rule derivations within the context of a Datalog query. We extend this rewriting to support negation and to capture failed derivations that explain missing answers. Given a (why or why-not) provenance question, we compute an explanation, i.e., the part of the provenance that is relevant to answer the question. We introduce optimizations that prune parts of a provenance graph early on if we can determine that they will not be part of the explanation for a given question. We present an implementation that runs on top of a relational database using SQL to compute explanations. Our experiments demonstrate that our approach scales to large instances and significantly outperforms an earlier approach which instantiates the full provenance to compute explanations.
Motivation & Objective
- Address the challenge of explaining both why answers appear and why they are missing in queries with negation, which requires unifying 'why' and 'why-not' provenance.
- Overcome the scalability limitations of existing approaches that instantiate full provenance graphs, which become infeasible for large databases.
- Develop a practical, efficient method to compute only the relevant parts of provenance (explanations) for specific user questions, avoiding unnecessary computation.
- Enable efficient provenance computation over large-scale relational databases using standard SQL, making the approach deployable in real-world systems.
- Support complex queries with multiple variables and negated subgoals, which are common in real-world data analysis and auditing workloads.
Proposed method
- Introduce 'firing rules'—a rewriting of Datalog rules that capture the derivation context of each rule application, including input tuple dependencies.
- Extend firing rules to model failed derivations by tracking missing input tuples, enabling explanation of missing answers via negative provenance.
- Define 'explanations' as the minimal provenance subgraph relevant to a specific query (why or why-not), pruning irrelevant parts early.
- Compile the provenance computation into SQL queries that are executed on a relational database, enabling efficient, scalable evaluation.
- Apply optimizations such as early pruning of non-relevant paths based on the query’s binding constraints, reducing computational overhead.
- Support complex Datalog queries with negation, existential variables, and multiple joins by expressing the provenance logic as a set of relational views in SQL.
Experimental results
Research questions
- RQ1How can we efficiently compute provenance for both positive and negative answers in first-order queries with negation?
- RQ2Can we avoid constructing the full provenance graph by computing only the relevant subgraph (explanation) for a specific query?
- RQ3How does the performance of our approach scale with increasing database size and query complexity, especially for queries with multiple variables and negation?
- RQ4Can we achieve significant performance improvements over existing methods that instantiate the entire provenance graph?
- RQ5What optimizations are effective in reducing the size and computation time of provenance explanations for missing answers?
Key findings
- The proposed approach significantly outperforms the prior DM method, which is limited to datasets under 10,000 tuples, while scaling to much larger databases.
- For queries with many variables and negation (e.g., r4, r5, r6), the approach remains efficient and avoids timeouts where DM fails even on small datasets.
- The runtime of the proposed method grows sub-quadratically with database size for why-not questions, while DM’s runtime becomes prohibitive beyond small instances.
- The approach achieves scalable performance on both DBLP and TPC-H workloads, with consistent speedups across different query types and binding patterns.
- Pruning optimizations reduce the size of computed provenance graphs by focusing only on relevant derivation paths, leading to faster query execution and lower memory usage.
- The SQL-based implementation enables deployment on standard RDBMS, making the framework practical for real-world data auditing and debugging applications.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.