VLDB2021
Beyond Equi-joins: Ranking, Enumeration and Factorization
Nikolaos Tziavelis, Wolfgang Gatterbauer, Mirek Riedewald
24 citations
Abstract
We study theta-joins in general and join predicates with conjunctions and disjunctions of inequalities in particular, focusing on ranked enumeration where the answers are returned incrementally in an order dictated by a given ranking function. Our approach achieves strong time and space complexity properties: with ๐ denoting the number of tuples in the database, we guarantee for acyclic full join queries with inequality conditions that for every value of ๐, the ๐ top-ranked answers are returned in O (๐ polylog ๐ + ๐ log ๐) time. This is within a polylogarithmic factor of O (๐ + ๐ log ๐), i.e., the best known complexity for equi-joins, and even of O (๐ + ๐), i.e., the time it takes to look at the input and return ๐ answers in any order. Our guarantees extend to join queries with selections and many types of projections (namely those called "free-connex" queries and those that use bag semantics). Remarkably, they hold even when the number of join results is ๐ โ for a join of โ relations. The key ingredient is a novel O (๐ polylog ๐)-size factorized representation of the query output, which is constructed on-the-fly for a given query and database. In addition to providing the first nontrivial theoretical guarantees beyond equi-joins, we show in an experimental study that our ranked-enumeration approach is also memory-efficient and fast in practice, beating the running time of state-of-the-art database systems by orders of magnitude.