Neither Cover nor Pack: Distributed Worst-Case Optimality of Degree-2 Joins
Abstract
We study the worst-case communication complexity of the join query evaluation problem over large-scale data in distributed shared-nothing systems under the MPC model. We focus on multi-round MPC algorithms that run in constant number of rounds. The problem is well-understood for a few classes of queries, mainly the class of acyclic queries and the class of graph-like queries. For queries not belonging to either class, the complexity picture is much less clear. We study the class of degree-two queries and fragments thereof. In this paper, we tighten the gap between the upper and lower bounds for the studied classes and establish worst-case optimality for some fragments of the considered classes. We also debunk a well-believed conjecture about which query-related quantity, in the worst-case, optimally captures the communication complexity of the studied problem.
Keywords and phrases:
degree-two joins, worst-case optimality, distributed algorithmsFunding:
Heba Aamer: The work of Heba Aamer is fully funded by FWO-grant 1210525N.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Distributed computing models ; Theory of computation Logic and databases ; Theory of computation Abstract machinesFunding:
This work is partially funded by FWO-grant G062721N.Editors:
Balder ten Cate and Maurice FunkSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
In this work, we study the communication complexity of evaluating a (join) query over large-scale data in distributed shared-nothing systems. Our model of computation is the Massively-Parallel Communication (MPC) model, which has become the standard model of computation in this context, and which puts communication complexity, rather than time complexity, as representative cost measure. We particularly focus on worst-case communication complexity in the constant-round MPC model. This worst-case complexity is well-understood for a few classes of queries, mainly including the class of acyclic queries and the class of graph-like queries, which are queries over binary (and possibly unary and nullary) relations. For queries not belonging to these classes, the picture is much less clear.
To have a better understanding of the communication complexity of the join evaluation problem, we initiate in this work the study on the class of degree-two queries as it is a broad class of cyclic queries that allows for relations with unrestricted arities, yet its queries have structural properties. A degree-two query is a query in which every attribute belongs to precisely two relations.111From this definition, we see that the dual (in terms of hypergraphs) of every degree-two query is a graph-like query. As graph-like queries enjoy some graph-theoretic properties, naturally degree-two queries have similar properties. Those properties for graph-like queries were sufficient to obtain a unified understanding for their communication complexity. On the other hand, to obtain any non-trivial bounds for degree-two queries, more restrictions were needed as degree-two queries turn out to be more diverse. Among the class of degree-two queries, we give the subclass of semi-grids special attention as its queries enjoy more structural properties. A semi-grid is a degree-two query without odd cycles. Semi-grids can be recognized visually as the nodes of their hypergraph can be placed on a two-dimensional grid such that all relations are vertical or horizontal lines containing precisely the nodes they cross, and with every attribute belonging to precisely one horizontally and one vertically-oriented relation.
In this paper, we investigate what is known about the communication complexity of degree-two queries in terms of upper and lower bounds, we tighten the gap between those bounds for some fragments of degree-two queries, and we show worst-case optimality for a few of those fragments.
In the rest of the introduction, we summarize the literature of the studied problem, mention some concrete research questions that we try to answer, and summarize our contributions.
MPC model
The MPC model is well-established in the database theory community for studying distributed algorithms. The model takes a number as parameter, representing the number of available servers. Servers have no direct access to each other’s memory, but they are connected through a network and can communicate with each other via private (one-to-one) message-passing.
Algorithms in the MPC model are executed in rounds, with each round consisting of a local computation phase followed by a global communication phase. In the local computation phase, every server performs a computation over the data it has locally. During this phase, no messages are sent or received. In the communication phase, every server can send messages to other servers in the network. During this phase, no computation is performed by the servers. We refer to the number of messages (i.e., tuples) received by a server during the communication phase as the server’s load in that round.
In general, the cost of an MPC algorithm is measured in terms of maximum load and number of rounds. By maximum load, we mean the maximum load of any server during any of the algorithm’s rounds. Nonetheless, in this work we only consider constant-round algorithms, for which the maximum load naturally defines the asymptotic cost of the entire algorithm. Since our analysis is for constant-round algorithms, sometimes we do not explicitly mention it in our results.
MPC worst-case optimality of the join evaluation problem
A join algorithm in the MPC model computes a join query over a database instance that is distributed over the servers correctly, when every tuple in the output of over is computable (i.e., producible) by at least one of the servers in some round. In this paper, we focus on worst-case optimality. That is, we are interested in algorithms that optimize (i.e., minimize) the maximum load of the algorithm w.r.t. given cardinality constraints, rather than for the specific database instance over which the query is computed. The instance is initially evenly (and arbitrarily) partitioned over the servers, hence requiring a linear load of to read the input (with being the number of tuples in ). This linear load is essentially the best load one can hope for, but it is unrealistically low for most queries.
Several asymptotic lower and upper bounds for the join query evaluation problem in the MPC model are known. All the bounds relevant to this line of research, and hence to this paper, are of the form , with a number depending on the structure of the target query. The larger the value of , the higher the load is. In the context of lower bounds, we will often say the load is based on to mean that it is bounded from below by . Similarly, in the context of upper bounds, we say that the cost of an algorithm is based on to mean that the load is bounded from above by . Finally, it is noteworthy that the bounds are in terms of (and not the number of bits) because we consider tuple-based algorithms, inline with other works.
Known bounds and algorithms
Early work mostly focuses on single-round MPC algorithms [2, 3, 4, 10] and in this variant of the model (opposed to the multi-round variant) the worst-case load is now well-understood. An algorithm of particular importance in this context is HyperCube [2, 3], also called the shares algorithm. The HyperCube algorithm runs with a load of where is the fractional vertex covering number (aka, fractional edge packing number) of the query (see Section 2). This load is worst-case optimal in the sense that its load matches a lower bound [4] up to a polylog factor and with high probability when the input database is skew-free and with all relations having the same size. Skew-freeness means that the degrees of attribute values (and by extension, partial tuples over attributes) do not exceed certain threshold values that are defined by a parameterization of the run for HyperCube.
Without constraints on the database, the worst-case optimal load of single-round MPC algorithms is and an algorithm exists that can achieve it w.h.p. and up to a polylog factor [10]. The number is the edge quasi-packing number and is equal to the maximum fractional vertex covering number of all residuals of the target query. A residual of a query is the query obtained after removing some attributes of (from all relations that have these attributes). Since every query is a residual of itself, it is immediate that holds.
When more than one round is allowed, the load can be significantly improved, below , for some queries. A key advantage of the multi-round MPC model is that (residual) queries can be simplified by computing semi-joins (i.e., removing redundant relations) in one round with linear load, before proceeding with the actual join computation.
For the multi-round variant, a few results are known, and several questions are open. It is known that, for every query, the worst-case optimal load is at least , where the number is the fractional edge covering number (aka, fractional vertex packing number) of the query (see Section 2). This lower bound result was obtained in [10], and for some join queries this bound is tight. This is the case for Loomis-Whitney (LW) queries (which is a very specific family of queries with ) [10], all graph-like queries (i.e., join queries involving relations with at most two attributes) [10, 8, 12, 11, 9, 1] as well as for all join queries that are acyclic [5, 13, 1]. We remark that holds for all queries, and hence, the one-round algorithm is already optimal in the multi-round setting for all queries with .
For a while, it has been thought that could be the worst-case optimal load in general, but this idea was recently debunked. In particular, it is shown in [5] that is a tighter lower bound for a very specific fragment of semi-grids. This new lower bound directly shows that there are other queries for which the one-round algorithm based on is effectively worst-case optimal in the multi-round case. This is precisely the case for all degree-two queries with and with lower bound on the load based on such as boat queries (see Section 2 for the precise definition).
It is worth noting that the initial worst-case optimal multi-round algorithms proposed in the literature for LW, graph-like, or acyclic queries cannot straightforwardly be generalized to arbitrary join queries, and hence, the one-round worst-case load based on remains a reasonable generic upper bound in the multi-round setting as well.
Known generic algorithms
In efforts to have a multi-round algorithm that works for arbitrary join queries, two algorithms of different nature have been proposed in the literature [11, 1]. We will refer to these as the -algorithm [11] (see below what is) and the PAC algorithm [1],222For completeness, there is a map-reduce join algorithm that shares some similarities with the original PAC algorithm [7]. The algorithm allows the number of servers to grow as needed to achieve a specific load guarantee which suits the map-reduce model but not the MPC model. For this reason, we no longer mention that algorithm. respectively. It is worth noting that the load of the PAC algorithm depends on a parameter whose optimal value is non-trivial to compute.
The load of the -algorithm has a fixed upper bound of with being the maximum arity of the relations in the query and being a new query-related quantity called generalized vertex packing number. It was shown that holds for every query as well as where is the total number of attributes in the query.333The relationship of follows from Lemma 3.1 and the discussion of Lemma 4.3 in [11]. The general upper bound can be shown to be worst-case optimal for graph-like queries and boat queries. However, this bound does not recover the worst-case optimality for acyclic queries nor for LW queries. Moreover, there is no clear relationship between and . In particular, some queries have , which means that for these queries the worst-case-optimal one-round algorithm guarantees a strictly better load than the multi-round -algorithm.
On the other hand, the PAC algorithm takes a parameter called the spectrum which is a sequence of discrete values allowing for a more fine-grained definition of skew. Parameterized with a specific spectrum , the algorithm runs with load that is defined to be the best possible load of the most difficult subproblem. The more-fine grained the choice of , the tighter the load of the algorithm can be. It is shown that for any choice of spectrum , holds and hence it runs with a load that is at most that of the one-round algorithm. This straightforwardly recovers the worst-case optimality for boat queries. It was also shown that with a choice of , the relationship holds for graph-like queries and for acyclic queries, which is worst-case optimal for both classes. The LW queries, on the other hand, are the only class of queries whose worst-case optimality was not recovered by the PAC algorithm, which is alluded to a non-tight load analysis of the algorithm.
Questions, results, and contributions
Based on the current literature, in this work we investigate the following questions:
-
1)
It is known that holds for all degree-two queries. Moreover, in case the database is already skew-free, the aforementioned optimal one-round load bound is based on . Accordingly, the generic multi-round lower bound that is based on seems unreasonable. We thus investigate if the -lower bound can be generalized to other degree-two queries.
-
2)
There is a believed conjecture in [5] that the worst-case load for any query is characterized by . Can we verify if this conjecture truly hold for all degree-two queries?
-
3)
We have a clear understanding of the load for the class of boat queries, which is a very restricted fragment of degree-two queries. Can we show any non-trivial upper bounds for subclasses of degree-two queries that structurally generalize the class of boat queries? And can any of the existing algorithms be used to achieve this?
To answer the third question, we consider two generalizations of the class of boat queries: semi-binary queries and grid queries. The two classes are, in a sense, complementary to each other, where, intuitively, the first limits the connectivity of the relations, while the other fully exploits this such that the diameter of any query is exactly two.444The diameter of a query is the maximum length of a shortest path connecting any two of its attributes. To better understand the rest of this section, we summarize the relationship between the aforementioned classes in the next depiction. See Section 2 for formal definitions.
| Generic Bounds | Class of Queries | Specific Multi-Round Bounds [Sources] |
| [10] [10, 1] [11] [1] | acyclic | [5, 1] |
| LW | [10] | |
| graph-like | [8, 12, 11, 9, 1] | |
| degree-two () | [5] extended by Theorem 9 | |
| Theorem 22 | ||
| grids () | Theorem 7 | |
| Theorem 24 |
Table 1 gives a summary of our worst-case load results in addition to the already known bounds. These complexity results and our other contributions are summarized as follows.
Lower bounds: debunk and go beyond.
-
1.
We show that the load for computing grid queries is at least . For the class of grid queries, this load is both higher than the loads based on and , debunking the existing conjecture in [5] that the worst-case optimal load in the constant-round MPC model is based on for all join queries.
-
2.
We identify a simple class of semi-binary queries as the hardness core of all semi-grid queries. Precisely, we show that if the load for this class of queries is at least the load based on , then the same holds for the entire class of semi-grid queries. The latter enables a new class of queries whose lower bound depends on and extends the existing understanding of [5].
-
3.
Additional Technical Contribution: The previous lower-bound results are obtained through a new generic approach that can reduce a query to its sub-queries. More precisely, we present in Theorem 6 a generic framework that allows to deduce that some queries are at least as hard to solve as some of their residual queries.
New upper bounds.
-
4.
We give an algorithm that computes every degree-two query with load (recall that is the number of attributes in the query). This improves on the upper bound known by the -algorithm since holds for all queries.
-
5.
We give different algorithms showing that every grid query is computable with a load that is at most , which is strictly better than the one-round algorithm and the -algorithm since for grid queries.
-
6.
Additional Technical Contribution: All our algorithms are instantiations of the PAC algorithm [1]. However, in some cases, the load guarantee of the PAC algorithm was not tight enough. To obtain tighter upper-bound guarantees, we provide a new analysis of the load guarantee of the PAC algorithm that is tighter compared to the original analysis. Thereto, we define a new query related quantity, the edge-weighted fractional vertex cover, which better captures the load of a query when evaluated on a skew-free database with relations having different cardinalities.
Understanding the gap based on query structures.
-
7.
Our generic upper bound for degree-two queries is already optimal for all semi-binary queries with and without odd-like cycles (see Corollary 5). This result is interesting because it is the first class of queries with to show optimality for, for which the one-round algorithm is not. Remark that all other solved classes of queries by multi-round algorithms have in common.
-
8.
Additionally, our algorithms to compute grid queries are strictly better than the one-round algorithm and the -algorithm, since for grid queries. This upper bound is also worst-case optimal for all grid queries with and unbounded (see Corollary 5).
Paper outline
The paper is further organized as follows.555We remark that due to space limitations, most of the proofs will appear in a full version of the paper. In Section 2, we give the necessary preliminaries and formally define the class of degree-two queries and the considered subclasses with their properties. Section 3 presents our new lower-bound results. In Section 4, we briefly review the PAC algorithm where we give a tighter load analysis for the algorithm. Afterwards, in Section 5, we use the results of the algorithm section to show our new upper-bound results. Finally, we conclude in Section 6.
2 Preliminaries
For a positive integer , we write to denote the set of integers, and to denote the set . We write as an abbreviation for the set of rationals between, and including, and . For a family of sets, we use to denote the set of all nonempty subsets of the sets of ; that is, . We also use to denote the set of all elements appearing in the sets of ; that is, .
Henceforth, we assume countably infinite disjoint domains , , and of relation names, attributes, and data values, respectively. For convenience of notation, and specifically to avoid nondeterminism in some of our results, we assume a total order over .
Queries
A (join) query , that is full and self-join free, is a pair with being a nonempty finite set of relation names from and being a total function that maps every relation name from to a nonempty finite set of attributes from . We say that a set of attributes is a full set (w.r.t. ) if there is some relation with and there does not exist a relation with .
Henceforth, we will use to refer to precisely the set of attributes appearing in the image of the function . We will also use to mean where is the image of the function ; that is, is the set of sets of attributes of appearing together in at least one relation of . For consistency, we will use as an equivalent notation to denote the set . Moreover, for a query and a set of attributes, we slightly abuse notation and use to denote the set of relations in that contains all the attributes of ; that is, . When is a set of a single attribute, we will opt to write in place of .
Instances
A tuple over a finite set of attributes is a total function from to . When we want to emphasize the fact that a tuple is defined over a set , we will say that is an -tuple. For an -tuple and a set , we write to denote the -tuple with for every in which case we say that is an extension of . By convention, we consider every tuple an extension of itself and of the empty tuple. We say that an -tuple and a -tuple are consistent if .
A finite set of tuples over the same set of attributes is called a relation instance over . A (database) instance for a query is a mapping associating every relation name with a relation instance over , where we write to denote the total number of tuples in . An instance is said to be a fragment of if for every relation that is defined for.
Sometimes we will be interested in relating the cardinalities of relation instances in a fragment to the size of . To capture this information, we associate a size reduction mapping for a query that is defined as . Henceforth, we use the term default size reduction, denoted , to refer to the mapping that assigns to every relation of . We define (where the value for will be set accordingly when needed):
Definition 1.
Let be a query and an instance that is a fragment of an instance . We say that is compatible with a size reduction for and a positive value if for every relation .
Given an instance for a query and a tuple over , we use to refer to the instance with for every ; that is, contains all and only the tuples of that are consistent with in every relation instance. We say that is consistent with if, for every , is nonempty. We denote the set of all -tuples consistent with as . The output of a query over an instance , denoted , is defined as .
Query transformations
Given a query , a set of relations, and a set of attributes, we use to denote the subquery of that is defined with and with for where is the set of relations. That is, is obtained from by removing the relations of along with the relations whose attributes are exclusively from , and by removing all the attributes of from the remaining relations. Note that when the set is empty then is the residual query of (w.r.t. ); in which case, we will sometimes write in place of .
For two distinct relations , we say that is reducible into when . We say that is reduced if it has no reducible relations. We also say that a query is not clean if there are two distinct relations with ; otherwise, the query is said to be clean. A query that is not reduced or not clean can be turned into a clean and reduced query by removing duplicated and reducible relations. Since multiple outcomes are possible depending on the order in which relations are removed, we denote by the unique clean and reduced query derived from by removing duplicated and reducible relations, one-by-one, following the order of .
Weight mappings and edge-weighted fractional vertex covers
It is common to view queries in terms of their hypergraph representation. This allows us to use graph-theoretic notions in our analysis. For this, the term vertex usually corresponds to attribute and edge corresponds to relation (atom). In this work, we define a new query-related quantity called edge-weighted fractional vertex cover that captures the load of computing a query over a fragment taking into consideration a size reduction. For this, we consider weight mappings for queries which are functions associating nonnegative rational weight to every attribute . For simplicity of notation, we often write with a set of attribute to denote the sum of the individual weights. The weight of is then defined to be the value of .
A relation of is said to be covered by a weight mapping w.r.t. a given size reduction if . We then call an edge-weighted fractional vertex cover for w.r.t. if covers every relation of w.r.t. . Consistent with the literature, we call a fractional vertex cover for if is an edge-weighted fractional vertex cover for w.r.t. . Observe that the minimum weight taken over all fractional vertex covers for defines the query-related quantity which is the fractional vertex covering number of .
Two other query-related quantities are important: the edge quasi-packing number () and the fractional vertex packing number (). The value of is defined to be the maximum fractional vertex covering number taken over all the residual queries of ; that is, . On the other hand, is defined to be the maximum weight of a weight mapping such that the sum of weights assigned to the attributes of every relation is .666Fractional vertex covers and fractional edge packings are duals with being the optimal for both. Similarly, fractional vertex packings and fractional vertex coverings are duals with being their optimal values.
Classes of degree-two queries and their properties
We formally define, in this section, the classes of queries we consider. We give in Figure 1 depiction of three queries that illustrate different query classes we consider.
A query is linear if every two relations have at most one attribute in common. A degree-two query is a query whose all attributes belong to exactly two relations, that is, for every attribute . Given a query , a sequence of relations from , with the relations being pairwise distinct, is called a cycle if there is an attribute in common between each two consecutive relations. The length of the cycle in that case is the number . A cycle of length is said to be odd-like if is even and is an odd integer.
In what follows, we will refer to the class of linear reduced degree-two queries without odd-length cycles as semi-grids. Semi-grids enjoy the following nice property :
Proposition 2.
Every semi-grid query has a fractional vertex cover, fractional edge cover, fractional vertex packing, and fractional edge packing that are optimal with integral weights.
In this work, we are interested in the class of semi-grids in general and particularly in two fragments thereof: semi-binary queries and grid queries. A query is said to be semi-binary if it is a semi-grid and every attribute belongs to at least one binary relation of .
As for grid queries, for convenience, we will only define them in some canonical form. An grid query, with integers , is composed of two disjoint sets of relations and . The former are called row relations while the latter are called column relations. Each row relation has the set of as its attributes. Similarly, each column relation has . Thus, the set of attributes of is . Notice that every attribute belongs to exactly two relations: the row relation and the column relation . The query in Figure 1(a) is an example of a grid query.
For grid queries, we know the following (see Appendix A.1 for a proof):
Proposition 3.
Let be an arbitrary grid query with . Then, we have , , and .
Observe that the class of boat queries is precisely the class of semi-grids that are grids and semi-binary queries at the same time. Every boat query is an grid query with . From that observation and by Proposition 2, we directly obtain:
Lemma 4.
Every boat query has .
3 Lower bounds
All existing lower-bounds on the worst-case load for computing queries in the constant-round MPC model are of the form , with a number based on the structure of the considered query , with the size of the relations in the database instance, and with the considered number of servers. Depending on the different results [5], some restrictions may apply to and . The bounds that we introduce in this section also have this form. Therefore, we will write for positive number to denote the class of queries for which is considered a correct worst-case load. To be precise, for a query , we write to mean that for every and every evaluating requires a load on some instance with relations of size using servers. From the literature, we have and as common values for ; in which case, we are simply going to write or to mean the classes and respectively.
The following results are known to hold [10, 5]:
-
for every query , . Notice that all queries of Figure 1 belong to this category;
-
for every query that belongs to a strict subset of semi-grid queries (including boat queries), . Note that, from Figure 1, only and belong to this category where for the -based lower bound is higher (i.e., tighter) compared to the -based lower bound and it is indeed optimal.
Similar in spirit to how the one-round lower bound for the worst-case load considers the worst-case load of all residual queries, our new lower bounds, for the classes of degree-two queries, take the lower bounds of some sub-queries into consideration.
Subquery-based lower-bound framework
We motivate the framework with the following example.
Example 5.
For illustration of what we mean by subquery-based lower bounds, consider and from Figures 1(a) and 1(c), respectively. The best-known lower bound for is based on either or as they are equal, hence, we have no knowledge that for . As for , its best-known lower bound is based on although for this query . For each of the two queries, take and to be the subqueries of and obtained by removing all the black-colored attributes from Figures 1(a) and 1(c) respectively. We will be able to verify that for and for .
In this section, we argue that best-known lower bounds for and are not tight enough. To establish this, we show that the worst-case load for and cannot be higher than the worst-case load for the original queries.
We formulate this idea as follows:
Theorem 6.
Let be a query and be a reduced subquery of with the same set of relations. Then, for MPC join algorithms running in constant number of rounds, the worst-case load for is at least the worst-case load for ; that is, if for some , then .
Next, we apply the framework for the class of grid queries establishing a tighter lower bound for this class and we also apply it to the class of semi-grids. In the latter case, we rely on a new result on the worst-case load required to compute a Cartesian-product query.
Grids lower bound
For grid queries, it is known that , and the -based lower-bound framework of [5] applies. In this section, we improve on that lower bound for grid queries. Precisely:
Theorem 7 (Grids Lower Bound).
For every grid query and integer , there is a family of instances with relation instances of size such that the load required to compute over servers is w.h.p.
Without loss of generality, we assume that , and hence, by Proposition 2, we know that and in this case. For grids with , the maximum between is simply which is the best-known bound. For this reason, we continue the argument for grids with , which are the queries for which a tighter lower bound can be established.
The next proposition along with Theorem 6 completes the argument for Theorem 7. The idea of the construction is similar to obtaining the subquery from the query as per Example 3.
Proposition 8.
For every grid query with , there is a reduced and clean subquery of with and .
Semi-grids lower bound
We now turn to the (full) class of semi-grids. It is known that every semi-grid query has . Nonetheless, for some semi-grids, the best-known lower bound on the worst-case load is based on (query of Figure 1(c) is an example.) In the rest of this section, we show that the lower bound based on can be extended to all semi-grid queries if all semi-binary queries with some specific property have as a valid lower bound on the worst-case load.
Theorem 9 (Semi-Grids Conditional Lower Bound).
If holds for every semi-binary query with . Then, for every semi-grid query and integer , there is a family of instances of relation instances of size such that the load required to compute over servers is w.h.p.
The above theorem directly pinpoints to the simple fragment of degree-two queries that is most challenging within the class of semi-grids. In order to have a better understanding for this fragment, we give a rather simple (sufficient) condition for semi-binary queries with for which the -based lower-bound argument applies. The condition is based on the absence of odd-like cycles from queries.
Theorem 10.
For every semi-binary with and without odd-like cycles, .
To establish Theorem 9, we relate the worst-case load of computing a Cartesian product between two queries to the worst-case load known for those queries in the following way.
Proposition 11.
Let and be two distinct queries with disjoint sets of attributes such that and . Suppose that is the Cartesian product query . Then, .
Proposition 12.
Let be a semi-grid. Then, there is a (possibly empty) set of attributes for which is reduced and with such that one of the following holds:
-
;
-
and is a semi-binary query with ; or
-
is the Cartesian product of two queries and such that where is a semi-binary query with .
From Example 3, note that is a subquery of the third form as in Proposition 3 with being a grid query (i.e., boat query) of and being a query of singleton duplicated relations of and . Thus, by Proposition 3, we can deduce of Figure 1(c) has the property . Thus,
Corollary 13.
There exist semi-grid queries with for which the -based lower-bound framework of [5] does not apply.
4 The PAC algorithm: new analysis
We mentioned, in the introduction, the load guarantee, , that the PAC algorithm provides, is dependant on a parameter referred to as the spectrum. In its general form, the spectrum is a finite increasing sequence of rationals from for .
For a particular choice of , we know the following (where is the guarantee we can algorithmically obtain for a query given and it will be defined later):
Theorem 14 (Theorem 8 of [1]).
Let be a query and an instance. Then, the PAC algorithm computes in three rounds using servers with load w.h.p.
We remark that, although we give in this section a slightly different, yet more accessible, presentation for the PAC algorithm, all the relevant upper-bound results carry over to our presentation. One such result is the following (where is a valid spectrum):
Theorem 15 (Theorem 18 of [1]).
Let be an arbitrary query. Then, for any choice of spectrum , the relationship of holds.
In what follows, we give a high-level overview of the PAC algorithm. We then point out to one limitation in the original analysis and show how to overcome this limitation resulting in a tighter analysis. Due to space limitations, all missing details will appear in the full version.
Spectrum indicator, ranges, and fragments
In this work, we restrict ourselves to a particular form of spectrums that we define using what we call spectrum indicator. A spectrum indicator is a positive integer. The spectrum defined by such a spectrum indicator is the sequence of rationals (that is, for ). Henceforth, when we write we naturally mean with being the spectrum defined by the indicator .
Similar to all existing algorithms, the PAC algorithm relies on the technique of heavy-light decomposition in which (partial) tuples are labeled as heavy or light based on their degrees. Given an instance , the spectrum indicator divides the range of degrees from to into discrete sequence of ranges: such that the degrees in are lighter (i.e., lower) than degrees in for all , in which case the degrees of are considered light while all the rest are considered different levels of heavy. Having these ranges, is divided into complementary fragments such that for every set of attributes from , all the -tuples in have similar degrees in (i.e., within the same range).
Configurations provide all the degree information relevant to a particular fragment. A configuration of a query and spectrum indicator is a total mapping . Note that the value assigned to a set of attributes by a configuration , say , means that the degrees of all -tuples in the corresponding fragment are in the th range (that is, ). In what follows, we will use to refer to the unique fragment of corresponding (i.e., defined by) the configuration .
We remark that not all mappings from to are equally meaningful. For this, we define the notion of valid configuration.
Definition 16.
A configuration of and is valid if for every pair of sets with , and, if for every full set . The set of all valid configurations of and is denoted by .
The first condition states that the degrees of tuples over a set of attributes cannot be lighter than any of its extensions. The second condition is a consequence of having instances defined as sets. Thus, it is straightforward to show that, for every invalid configuration , where . Therefore, from now on, we only consider valid configurations.
Solution procedure and its load analysis
Note that the value for is assumed to be fixed beforehand. The PAC algorithm then runs in parallel on all the fragments and hence the load of the algorithm is determined by the most difficult fragment. That is, . For a particular fragment , this measure intuitively means that there is a way with which the algorithm runs over the fragment with load using at most servers.
Naturally, the query can be computed over a fragment in various ways (i.e., parameterization), each is referred to as a solution. In that case, the load of computing over is simply determined by the most efficient solution where with here ranging over compatible solutions only. Before we explain what solutions are, and what compatible means, we define some additional concepts. Henceforth, for a fragment of corresponding to a configuration , we define
-
to denote the set of all sets such that is light in (i.e., );
-
to refer to the set of ; i.e., all the heavy sets of attributes; and
-
.
To define what is, it is more intuitive to introduce its components from the computation of over a fragment . Thereto, to compute , the following phases will be followed:
- Broadcast phase:
-
broadcast all relations in to all servers. Now, the query can be simplified to the query with being the relations of .
- Decomposing phase:
-
choose a subset from such that the sets of are pairwise disjoint and choose a subset . For each set , choose a set of attributes with . Henceforth, we use the terms of patches and anchors to mean the sets and , respectively. Let be the set of relations from and be the union .
The query is decomposed into a set of subqueries: for each anchor , the relations of make one subquery; all the remaining relations in make one last subquery, which is in this case.
- Partitioning phase:
-
for each tuple in over , we assign a group of servers to compute the residual query of , obtained by removing the attributes from , over the sub-fragment . Let .
- Semi-join phase:
-
over each group of servers, we apply semi-joins to simplify the query from all the redundancies to obtain the query .
- Final join phase:
-
over each group of servers, we compute the join of all relations of over the instance . In this phase, the remaining relations in relevant for each subquery of are handled separately. In which case, the relations of the subquery are joined using HyperCube algorithm parameterized by a weight assignment . Henceforth, we use to refer to the subquery .
With this procedure in mind, is defined as [1]. For each such solution , the is defined as
We remark that the load induced by some choices of cannot be bounded, as there are conditions that needs to satisfy to have a compatible solution. According to [1], a solution to a fragment corresponding to a configuration is said to be compatible if is a frac. vertex cover for of weight with for every heavy set .777The condition of for all heavy sets guarantees that applying HyperCube with the shares of to the attributes make the relations skew-free. The following has been shown to compatible solutions (from which Theorem 14 directly follows):
Theorem 17 (Theorem 14 of [1]).
Let be a compatible solution for a fragment of . Then is computable using servers with load w.h.p.
Limitation
The requirement that has to be a fractional vertex cover for is not necessary and it can be made tighter in some cases. Thereto, for a given configuration and an -tuple , we define the size-reduction induced by , denoted , to be the size reduction of with, for every , such that is the set .
We now observe and claim that after the partitioning phase in the aforementioned procedure, there exists some value such that the (sub)fragment is compatible with the size reduction and . We formulate and prove this claim in the full version. Nonetheless, this observation allows us to obtain a tighter analysis in some cases. Thereto, we say that a solution to corresponding to a configuration is said to be reduced if is an edge-weighted frac. vertex cover for and the size reduction , of weight and, with for every heavy set and every . We show:
Theorem 18.
Let be a reduced solution for a fragment of . Then is computable using servers with load w.h.p.
Finally remark that all compatible solutions are reduced but not all reduced solutions are compatible. Since Theorem 18 is analogous to Theorem 17, we obtain that in some cases is strictly less compared to considering compatible solutions only. For instance, this will be essential in establishing the (optimal) upper bound of some grid queries in the following section.
5 New upper bounds
In this section, we show all the upper bounds we claimed in the introduction. To show that the worst-case load of computing a query over any instance using servers is asymptotically upper bounded by , we choose a value for the spectrum indicator and then show that for every fragment of , . That is, we argue that every fragment has at least one compatible or reduced solution with .
Degree-two algorithm
For all degree-two queries , we set where and we choose . We next show
Proposition 19.
Every fragment corresponding to a configuration has .
Thereto, let be an arbitrary configuration from and let be the corresponding fragment to . The image of in this case is where corresponds to heavy, corresponds to semi-heavy, and corresponds to light.
Notice that we only consider relations of with at least one attribute with . All other relations are going to be broadcast in the first phase of the algorithm.
An attribute is called isolated if it is light and all its adjacent attributes are individually heavy. We use to refer to set of all isolated attributes. Now, we differentiate between:
-
case 1: every non-broadcastable relation contains an isolated attribute.
-
case 2: there are non-broadcastable relations without isolated attributes.
For case 1, we choose a solution for with empty sets for and and with a weight mapping such that for every light attribute (i.e., all the attributes) and for every other attribute. It is easy to see that is a compatible solution.
Observe that, in this case, . To complete the argument for this case, we need to show that , which follows from the next lemma and the fact that no two attributes of can be adjacent by definition.
Lemma 20.
Every vertex packing for is of size .
As for case 2, take to be the set of all pairs of adjacent attributes such that . We call this set as anchor candidates. Now, choose a subset of of pairwise disjoint pairs such that it covers all the attributes. That is, every isolated attribute is contained in exactly one pair of . Observe that such set must exist by the following lemma :
Lemma 21.
Viewing the set as an undirected bipartite graph between and non- attributes: there is an edge packing for of size equal to . Hence, all attributes must be covered by that edge packing.
We construct the set of anchors from as follows. Take . Obviously, is light and is not, as desired. Moreover, notice that and the set of attributes in is of size .
Now, take to be the set . Observe that, since each set of attributes in is heavy, we have and the set of attributes in is of size .
Finally, take to be the weight mapping with for every remaining attribute that is either semi-heavy or light but non-isolated. It is easy to see that is equal to half the attributes it assigns weight to. Hence, overall, each attribute contributes to the solution with a cost of at most . Thus, follows from the disjointness of the different components. We argue in the full version that is indeed a compatible solution. The previous discussion and Theorem 15 directly entails:
Theorem 22 (Degree-two Upper Bound).
For every linear degree-two query and instance , is computable over servers with load w.h.p.
As a direct consequence of the previous theorem and Theorem 10, we obtain:
Corollary 23.
For every semi-binary query with and without odd-like cycles and instance , is computable over servers with load w.h.p, which is optimal.
Grid algorithms
In this part, we show the following main result:
Theorem 24 (Grids Upper Bound).
For every grid query and every instance , is computable over servers with load w.h.p.
Without loss of generality, we assume that . Hence, by Proposition 2, the upper bound in the statement can be equivalently expressed as instead. To establish Theorem 24, we set . We continue our analysis by distinguishing two cases based on grid dimensions.
First, consider the case of grids with . This is precisely the case when is a boat query. By Lemma 2 and Theorem 15, we obtain the desired result by setting since .
Now, consider grids with . We observe that in this case, it would be sufficient to only consider fragments for which a solution with a fractional vertex cover alone cannot trivially solve the query with the desired load. For this, we define in Appendix A.2 the notion of a difficult fragment of a grid query. In the full version, we give the specific arguments for and separately to finalize the proof of Theorem 24, where we use different values for the spectrum indicator, and moreover, we utilize completely different solution strategies to solve the difficult fragments. As for , we use a spectrum defined by the indicator , and we utilize multiple solution strategies in which case none uses anchors. On the other hand, for , we find that a spectrum indicator of is sufficient to obtain the upper bound we claim, and all solution strategies, we use, involve anchors.
Corollary 25.
For every grid query with and every instance , is computable over servers with load w.h.p, which is optimal.
6 Conclusion
In this work, we have studied worst-case communication complexity of the join evaluation problem for the class of degree-two queries and some of its fragments in the MPC model. We have established several new lower bounds and upper bounds for the problem for which some bounds are shown to be worst-case optimal. Although, all our upper bound results have been established through different instantiations of the PAC algorithm, it is remarkable that several techniques, that depended on the structure of the query, were needed. This shows that degree-two queries are very diverse and understanding their load complexity is crucial to eventually obtain distributed join algorithms with optimality guarantees for all queries.
Moreover, by showing a lower bound on the load for grid queries that is larger than both, the load based on the fractional vertex covering number , and on fractional vertex packing number , we showed that neither nor characterizes the worst-case optimal load. This refutes a well-believed conjecture [6] that the worst-case load in the constant-round MPC model is entirely captured by either quantities.
Our work poses several new questions and revives existing open problems. Without a doubt, the most important problem still is: what is it then the most accurate query-related quantity which captures the worst-case optimal communication complexity of the join evaluation problem?
References
- [1] Heba Aamer and Bas Ketsman. PAC: Computing Join Queries with Semi-Covers. In Sudeepa Roy and Ahmet Kara, editors, 28th International Conference on Database Theory (ICDT 2025), volume 328 of Leibniz International Proceedings in Informatics (LIPIcs), pages 6:1–6:20, Dagstuhl, Germany, 2025. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ICDT.2025.6.
- [2] Foto N. Afrati and Jeffrey D. Ullman. Optimizing multiway joins in a map-reduce environment. IEEE Trans. Knowl. Data Eng., 23(9):1282–1298, 2011. doi:10.1109/TKDE.2011.47.
- [3] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query processing. In Richard Hull and Wenfei Fan, editors, Proceedings of the 32nd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2013, New York, NY, USA, 2013, pages 273–284. ACM, 2013. doi:10.1145/2463664.2465224.
- [4] Paul Beame, Paraschos Koutris, and Dan Suciu. Skew in parallel query processing. In Richard Hull and Martin Grohe, editors, Proceedings of the 33rd ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS’14, Snowbird, UT, USA, June 22-27, 2014, pages 212–223. ACM, 2014. doi:10.1145/2594538.2594558.
- [5] Xiao Hu. Cover or pack: New upper and lower bounds for massively parallel joins. In Leonid Libkin, Reinhard Pichler, and Paolo Guagliardo, editors, PODS’21: Proceedings of the 40th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, 2021, pages 181–198. ACM, 2021. doi:10.1145/3452021.3458319.
- [6] Xiao Hu and Ke Yi. Instance and output optimal parallel algorithms for acyclic joins. In PODS, pages 450–463, 2019. doi:10.1145/3294052.3319698.
- [7] Manas Joglekar and Christopher Ré. It’s all a matter of degree. Theor. Comp. Sys., 62(4):810–853, May 2018. doi:10.1007/s00224-017-9811-8.
- [8] Bas Ketsman and Dan Suciu. A worst-case optimal multi-round algorithm for parallel computation of conjunctive queries. In Emanuel Sallinger, Jan Van den Bussche, and Floris Geerts, editors, Proceedings of the 36th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 2017, Chicago, IL, USA, May 14-19, 2017, pages 417–428. ACM, 2017. doi:10.1145/3034786.3034788.
- [9] Bas Ketsman, Dan Suciu, and Yufei Tao. A near-optimal parallel algorithm for joining binary relations. Log. Methods Comput. Sci., 18(2), 2022. doi:10.46298/lmcs-18(2:6)2022.
- [10] Paraschos Koutris, Paul Beame, and Dan Suciu. Worst-case optimal algorithms for parallel query processing. In Wim Martens and Thomas Zeume, editors, 19th International Conference on Database Theory, ICDT 2016, volume 48 of LIPIcs, pages 8:1–8:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPIcs.ICDT.2016.8.
- [11] Miao Qiao and Yufei Tao. Two-attribute skew free, isolated cp theorem, and massively parallel joins. In PODS, pages 166–180, 2021. doi:10.1145/3452021.3458321.
- [12] Yufei Tao. A simple parallel algorithm for natural joins on binary relations. In Carsten Lutz and Jean Christoph Jung, editors, 23rd International Conference on Database Theory, ICDT 2020, volume 155 of LIPIcs, pages 25:1–25:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.ICDT.2020.25.
- [13] Yufei Tao. Parallel acyclic joins with canonical edge covers. In Dan Olteanu and Nils Vortmeier, editors, 25th International Conference on Database Theory, ICDT 2022, volume 220 of LIPIcs, pages 9:1–9:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.ICDT.2022.9.
Appendix A Some proofs
A.1 Proof of Proposition 2
Before we prove Proposition 2, we first give two helpful lemmas that give upper bounds on the fractional vertex covers of the different residual queries of a grid query. These lemmas will be helpful to obtain the value of for grids.
Firstly:
Lemma 26.
Let be an grid query with . Let be a set of attributes from . Suppose there exist integers and with and such that every attribute of the residual query either belongs to the th row relation (i.e., is of the form ) or belongs to the th column relation (i.e., is of the form ). Now, let and be the set of attributes of belonging to the th row relation and the th column relation, respectively. Now, if either or is empty, then take to be the set of attributes defined as . Otherwise, take to be the set with . Then, .
Proof.
Without loss of generality, assume that both and are equal to ; hence, the row relation and the column relation of the statement are and . Accordingly, we know that . Moreover, notice that the set of attributes and that .
Since both sets form the entire set of attributes in , it is trivial to argue that
| (1) |
Now, observe that every attribute (with ) in the first set () is the only remaining attribute in the row relation ; similarly, every attribute (with ) in the second set () is the only remaining attribute in the column relation . Accordingly, any valid fractional vertex cover for in this case must assign a weight of to each such attribute. Thus,
| (2) |
If and hence it is not an attribute in , then . From Equations (1) and (2), we direction obtain that . Notice that in this case, the maximal possible set for occurs when and which are sets of size and respectively. Thus, as desired.
Now, suppose that , and hence, . When both and have other attributes, then the aforementioned weight assignment is already a valid fractional vertex cover for since both and are covered by at least one other attribute from and respectively. Notice that in this case . Hence, . The argument that is similar to that of the previous case.
On the other hand, when either or does not contain any other attribute, the previous weight assignment cannot be a valid fractional vertex cover as there is either or that is not covered and the only remaining attribute in either relation is the attribute . Thus, must also assign a weight of to , which is minimal in this case. Accordingly, we obtain that . Notice that by construction . Moreover, the maximal size of is either (when ) or (when ). In both cases, as by definition.
Secondly:
Lemma 27.
Let be an grid query with . Let be a set of attributes from such that the residual query does not satisfy the conditions of Lemma A.1. Then, .
Proof.
We prove the lemma by case distinction.
First, we consider the case that the residual query contains a set of three attributes with such that and . Take to be the weight mapping with for . So far covers 3 different row relations and 3 different column relations. Let be the query after removing the 6 covered relations. Notice that in this case. To cover the rest of the relations of we then need a weight mapping with total weight of at most . Thus, the total weight mapping for the entire is as desired.
Now, we continue with the assumption that contains no set of three attributes with such that and . Furthermore recall that does not satisfy the conditions of Lemma A.1. We obtain that the attributes of must be in one of the following two forms:
-
the attributes span exactly two row relations and each of the two rows has at least two attributes; or
-
analogously, the attributes span exactly two column relations and each of the two columns has at least two attributes.
Without loss of generality, we only give the argument for the first form. Take to be the set of indices of column relations having an attribute at the first row and similarly take to be the set of indices of column relations having an attribute at the second row. As mentioned above, each of the two sets and is of size . Let and be two attributes from such that and . Observe that such two attributes must exist by the aforementioned conditions. Take to be the weight mapping with for every . Notice that this assignment covers all the column relations of . Moreover, since the attributes are assigned by . Then, this assignment also covers each of the two row relations remaining in . This shows that as desired.
The analogous argument for the second form will result in as desired.
Now, we are in position to prove Proposition 2.
Proposition 2.
Let be an arbitrary grid query with . Then, we have , , and .
Proof.
Without loss of generality, assume that . Each of the constructions of this proof is illustrated in Figure 2.
First, we show that . For this, take to be the weight mapping with for and all other attributes have . Note that assigns a weight of to exactly one attribute per row relation and at least one attribute per column relation. Hence, is a valid vertex cover for whose total weight is equal to . Now, observe that the set of row relations form an edge packing with size as well. This shows optimality for the vertex cover obtained by and hence as desired.
Second, we show that . For this, take to be the weight mapping with for and all other attributes has . Note that is a valid vertex packing in this case with weight equal to in which case it assigns to exactly one attribute per column relation and at most one attribute per row relation. To establish the optimality (i.e., maximality) for the vertex packing obtained by , we remark that the set of column relations form a valid edge cover whose size is equal to as well. Hence, is optimal and as desired.
Finally, we show the last property of . We begin by showing that . For this, take to be the set of attributes. The residual query consists of attributes in this case; those are formed by the two sets of and . Notice that our choice for (and hence, the query satisfies the conditions of Lemma A.1 with . Thus, we obtain that as desired.
A.2 Difficult grid fragments
In this section, we define the notion of a difficult fragment of a grid query (regardless of the value indicator chosen for ).
Definition 28.
Let be a configuration from and . The fragment is said to be difficult if there is a row relation and a column relation such that:
-
every attribute with is light;
-
every attribute with is light; and
-
every attribute with and is heavy.
An example of such fragment can be found in Figure 2(d).
Observe that indeed such fragments are difficult to solve in the following sense:
Lemma 29.
Suppose that is the set of attributes. Then, if and only if is a difficult fragment.
