Affiliation:
1. Pontificia Universidad Católica de Chile, Chile and IMFD Chile, Chile, IMFD Chile
2. University of Bordeaux, CNRS, Bordeaux INP, LaBRI, France
3. University of Edinburgh, Oxford, UK
4. University of Edinburgh, Edinburgh, UK
Abstract
This work deals with the problem of semantic optimization of the central class of conjunctive queries (CQs). Since CQ evaluation is NP-complete, a long line of research has focussed on identifying fragments of CQs that can be efficiently evaluated. One of the most general restrictions corresponds to generalized hypetreewidth bounded by a fixed constant
k
≥ 1; the associated fragment is denoted GHW
k
. A CQ is semantically in GHW
k
if it is equivalent to a CQ in GHW
k
. The problem of checking whether a CQ is semantically in GHW
k
has been studied in the constraint-free case, and it has been shown to be NP-complete. However, in case the database is subject to constraints such as tuple-generating dependencies (TGDs) that can express, e.g., inclusion dependencies, or equality-generating dependencies (EGDs) that capture, e.g., key dependencies, a CQ may turn out to be semantically in GHW
k
under the constraints, while not being semantically in GHW
k
without the constraints. This opens avenues to new query optimization techniques. In this article, we initiate and develop the theory of semantic optimization of CQs under constraints. More precisely, we study the following natural problem: Given a CQ and a set of constraints, is the query semantically in GHW
k
, for a fixed
k
≥ 1, under the constraints, or, in other words, is the query equivalent to one that belongs to GHW
k
over all those databases that satisfy the constraints? We show that, contrary to what one might expect, decidability of CQ containment is a necessary but not a sufficient condition for the decidability of the problem in question. In particular, we show that checking whether a CQ is semantically in GHW
1
is undecidable in the presence of full TGDs (i.e., Datalog rules) or EGDs. In view of the above negative results, we focus on the main classes of TGDs for which CQ containment is decidable and that do not capture the class of full TGDs, i.e., guarded, non-recursive, and sticky sets of TGDs, and show that the problem in question is decidable, while its complexity coincides with the complexity of CQ containment. We also consider key dependencies over unary and binary relations, and we show that the problem in question is decidable in elementary time. Furthermore, we investigate whether being semantically in GHW
k
alleviates the cost of query evaluation. Finally, in case a CQ is not semantically in GHW
k
, we discuss how it can be approximated via a CQ that falls in GHW
k
in an optimal way. Such approximations might help finding “quick” answers to the input query when exact evaluation is intractable.
Funder
Royal Society in the context of the project “RAISON DATA”
EPSRC Programme
Millennium Institute for Foundational Research on Data
Fondecyt
EPSRC
ANR project QUID
ANR project DéLTA
Publisher
Association for Computing Machinery (ACM)
Subject
Artificial Intelligence,Hardware and Architecture,Information Systems,Control and Systems Engineering,Software
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Answer Counting under Guarded TGDs;Logical Methods in Computer Science;2023-09-14
2. Efficiently Enumerating Answers to Ontology-Mediated Queries;Proceedings of the 41st ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems;2022-06-12
3. The Complexity of Conjunctive Queries with Degree 2;Proceedings of the 41st ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems;2022-06-12
4. The Case of SPARQL UNION, FILTER and DISTINCT;Proceedings of the ACM Web Conference 2022;2022-04-25