Tractable Orders for Direct Access to Ranked Answers of Conjunctive Queries

We study the question of when we can answer a Conjunctive Query (CQ) with an ordering over the answers by constructing a structure for direct (random) access to the sorted list of answers, without actually materializing this list, so that the construction time is linear (or quasilinear) in the size of the database. In the absence of answer ordering, such a construction has been devised for the task of enumerating query answers of free-connex acyclic CQs, so that the access time is logarithmic. Moreover, it follows from past results that within the class of CQs without self-joins, being free-connex acyclic is necessary for the existence of such a construction (under conventional assumptions in fine-grained complexity). In this work, we embark on the challenge of identifying the answer orderings that allow for ranked direct access with the above complexity guarantees. We begin with the class of lexicographic orderings and give a decidable characterization of the class of feasible such orderings for every CQwithout self-joins. We then continue to the more general case of orderings by the sum of attribute scores. As it turns out, in this case ranked direct access is feasible only in trivial cases. Hence, to better understand the computational challenge at hand, we consider the more modest task of providing access to only one single answer (i.e., finding the answer at a given position). We indeed achieve a quasilinear-time algorithm for a subset of the class of full CQs without self-joins, by adopting a solution of Frederickson and Johnson to the classic problem of selection over sorted matrices. We further prove that none of the other queries in this class admit such an algorithm.

[1]  Cristian Riveros,et al.  Ranked enumeration of MSO logic on words , 2020, ArXiv.

[2]  Jakub Závodný,et al.  Factorised representations of query results: size bounds and readability , 2012, ICDT '12.

[3]  Dan Suciu,et al.  Approximate Lifted Inference with Probabilistic Databases , 2014, Proc. VLDB Endow..

[4]  Virginia Vassilevska Williams,et al.  Hardness of Easy Problems: Basing Hardness on Popular Conjectures such as the Strong Exponential Time Hypothesis (Invited Talk) , 2015, IPEC.

[5]  M. Golumbic CHAPTER 4 – Triangulated Graphs , 1980 .

[6]  Greg N. Frederickson,et al.  An Optimal Algorithm for Selection in a Min-Heap , 1993, Inf. Comput..

[7]  Wolfgang Gatterbauer,et al.  Optimal Join Algorithms Meet Top-k , 2020, SIGMOD Conference.

[8]  Donald B. Johnson,et al.  Selecting the Kth element in X + Y and X_1 + X_2 + ... + X_m , 1978, SIAM J. Comput..

[9]  Georg Gottlob,et al.  Hypertree Decompositions: Questions and Answers , 2016, PODS.

[10]  Amir Abboud,et al.  Popular Conjectures Imply Strong Lower Bounds for Dynamic Problems , 2014, 2014 IEEE 55th Annual Symposium on Foundations of Computer Science.

[11]  Neil Immerman,et al.  The Complexity of Resilience and Responsibility for Self-Join-Free Conjunctive Queries , 2015, Proc. VLDB Endow..

[12]  Mihalis Yannakakis,et al.  Algorithms for Acyclic Database Schemes , 1981, VLDB.

[13]  Andranik Mirzaian,et al.  Selection in X+Y and Matrices With Sorted Rows and Columns , 1985, Inf. Process. Lett..

[14]  Nicole Schweikardt,et al.  Answering (Unions of) Conjunctive Queries using Random Access and Random-Order Enumeration , 2019, PODS.

[15]  Jeff Erickson,et al.  Lower bounds for linear satisfiability problems , 1995, SODA '95.

[16]  Etienne Grandjean,et al.  Sorting, linear time and the satisfiability problem , 1996, Annals of Mathematics and Artificial Intelligence.

[17]  Arnaud Durand,et al.  On Acyclic Conjunctive Queries and Constant Delay Enumeration , 2007, CSL.

[18]  Jens Keppeler,et al.  Answering Conjunctive Queries and FO+MOD Queries under Updates , 2020 .

[19]  Dan Olteanu,et al.  Factorized Databases , 2016, SGMD.

[20]  Mark H. Overmars,et al.  On a Class of O(n2) Problems in Computational Geometry , 1995, Comput. Geom..

[21]  Ronald L. Rivest,et al.  Expected time bounds for selection , 1975, Commun. ACM.

[22]  Shaleen Deep,et al.  Ranked Enumeration of Conjunctive Query Results , 2019, ArXiv.

[23]  Manuel Blum,et al.  Time Bounds for Selection , 1973, J. Comput. Syst. Sci..

[24]  Bernard Chazelle,et al.  Lower bounds for linear degeneracy testing , 2005, J. ACM.

[25]  Johann Brault-Baron,et al.  De la pertinence de l'énumération : complexité en logiques propositionnelle et du premier ordre. (The relevance of the list: propositional logic and complexity of the first order) , 2013 .

[26]  Benny Kimelfeld,et al.  A dichotomy in the complexity of deletion propagation with functional dependencies , 2012, PODS '12.

[27]  Wolfgang Gatterbauer,et al.  Any-k Algorithms for Exploratory Analysis with Conjunctive Queries , 2018, ExploreDB@SIGMOD/PODS.

[28]  Richard Ryan Williams,et al.  Tight Hardness for Shortest Cycles and Paths in Sparse Graphs , 2017, SODA.

[29]  R. Möhring Algorithmic graph theory and perfect graphs , 1986 .

[30]  Nicole Schweikardt,et al.  Constant delay enumeration for conjunctive queries , 2020, ACM SIGLOG News.

[31]  Mihai Patrascu,et al.  Towards polynomial lower bounds for dynamic problems , 2010, STOC '10.

[32]  Markus Kröll,et al.  Enumeration Complexity of Conjunctive Queries with Functional Dependencies , 2018, ICDT.

[33]  Erik D. Demaine,et al.  Subquadratic Algorithms for 3SUM , 2005, WADS.

[34]  Donald B. Johnson,et al.  Generalized Selection and Ranking: Sorted Matrices , 1984, SIAM J. Comput..

[35]  Wolfgang Gatterbauer,et al.  Optimal Algorithms for Ranked Enumeration of Answers to Full Conjunctive Queries , 2019, Proc. VLDB Endow..