Abstract 1 Introduction 2 Preliminaries 3 Lower bounds 4 The PAC algorithm: new analysis 5 New upper bounds 6 Conclusion References Appendix A Some proofs

Neither Cover nor Pack: Distributed Worst-Case Optimality of Degree-2 Joins

Heba Aamer ORCID Vrije Universiteit Brussel, Belgium Xiao Hu ORCID University of Waterloo, Canada Bas Ketsman ORCID Vrije Universiteit Brussel, Belgium
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 algorithms
Funding:
Heba Aamer: The work of Heba Aamer is fully funded by FWO-grant 1210525N.
Copyright and License:
[Uncaptioned image] © Heba Aamer, Xiao Hu, and Bas Ketsman; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Distributed computing models
; Theory of computation Logic and databases ; Theory of computation Abstract machines
Funding:
This work is partially funded by FWO-grant G062721N.
Editors:
Balder ten Cate and Maurice Funk

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 p 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 q over a database instance 𝒟 that is distributed over the p servers correctly, when every tuple in the output of q 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 p servers, hence requiring a linear load of |𝒟|/p 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 |𝒟|/p1/, 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 |𝒟|/p1/. 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 |𝒟|/p1/. 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 |𝒟|/p1/τ 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 |𝒟|/p1/τ 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 |𝒟|/p1/ψ 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 q is the query obtained after removing some attributes of q (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 |𝒟|/p1/ρ, 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 |𝒟|/p1/ρ could be the worst-case optimal load in general, but this idea was recently debunked. In particular, it is shown in [5] that |𝒟|/p1/τ 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 |𝒟|/p1/αϕ/2 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 αϕk where k is the total number of attributes in the query.333The relationship of αϕk 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 αϕ/2. In particular, some queries have ψ<αϕ/2, 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 𝗋=0,1/2,1, 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. 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. 2)

    There is a believed conjecture in [5] that the worst-case load for any query is characterized by max{τ,ρ}. Can we verify if this conjecture truly hold for all degree-two queries?

  3. 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.

Table 1: Summary of existing known worst-case complexity results on the communication load in the MPC model along with our new results. The notation 𝒪~() hides a polylog factor that depends on p. Recall that τ is fractional vertex covering number, ρ is fractional edge covering number, ψ is the edge quasi-packing number, k is the number of attributes in the query, α is the maximum arity, and ϕ is the generalized vertex packing number. Moreover, recall that αϕk holds for any query.
Generic Bounds Class of Queries Specific Multi-Round Bounds [Sources]
Ω(|𝒟|/p1ρ) [10] 𝒪~(|𝒟|/p1ψ) [10, 1] 𝒪~(|𝒟|/p1αϕ/2) [11] 𝒪~(|𝒟|/p1γ𝗋) [1] acyclic 𝒪~(|𝒟|/p1ρ) [5, 1]
LW 𝒪~(|𝒟|/p1ρ) [10]
graph-like 𝒪~(|𝒟|/p1ρ) [8, 12, 11, 9, 1]
degree-two (min{ψ,k/2}τρ) Ω(|𝒟|/p1τ) [5] extended by Theorem 9
𝒪~(|𝒟|/p1min{ψ,k/2}) Theorem 22
grids (k/2ψ=τ+ρ2) Ω(|𝒟|/p1max{τ,τ+ρ4}) Theorem 7
𝒪~(|𝒟|/p1max{τ,τ+ρ3}) 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. 1.

    We show that the load for computing grid queries is at least |𝒟|/p1/max{τ,τ+ρ4}. 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 max{τ,ρ} for all join queries.

  2. 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. 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.
  1. 4.

    We give an algorithm that computes every degree-two query with load |𝒟|/p1/min{ψ,k/2} (recall that k is the number of attributes in the query). This improves on the upper bound known by the ϕ-algorithm since αϕk holds for all queries.

  2. 5.

    We give different algorithms showing that every grid query is computable with a load that is at most |𝒟|/p1/max{τ,τ+ρ3}, which is strictly better than the one-round algorithm and the ϕ-algorithm since αϕ/2ψ=τ+ρ2 for grid queries.

  3. 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.
  1. 7.

    Our generic upper bound for degree-two queries is already optimal for all semi-binary queries with τ=k/2 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.

  2. 8.

    Additionally, our algorithms to compute grid queries are strictly better than the one-round algorithm and the ϕ-algorithm, since αϕ/2ψ for grid queries. This upper bound is also worst-case optimal for all grid queries with ρ3 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 n, we write [n] to denote the set {1,,n} of integers, and [n]0 to denote the set {0,1,,n}. We write [0,1] as an abbreviation for the set {i00i1} of rationals between, and including, 0 and 1. For a family 𝒮={S1,,Sm} of sets, we use 𝗂𝗇𝗌(𝒮) to denote the set of all nonempty subsets of the sets of 𝒮; that is, 𝗂𝗇𝗌(𝒮):=(i[m]2Si). We also use 𝖾𝗅𝖾𝗆(𝒮) to denote the set of all elements appearing in the sets of 𝒮; that is, 𝖾𝗅𝖾𝗆(𝒮):=i[m]Si.

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 q, that is full and self-join free, is a pair (𝗋𝖾𝗅𝗌q,𝗌𝖼𝗁q) with 𝗋𝖾𝗅𝗌q being a nonempty finite set of relation names from 𝐫𝐞𝐥𝐬 and 𝗌𝖼𝗁q being a total function that maps every relation name from 𝗋𝖾𝗅𝗌q to a nonempty finite set of attributes from 𝐚𝐭𝐭𝐬. We say that a set A of attributes is a full set (w.r.t. q) if there is some relation R with 𝗌𝖼𝗁q(R)=A and there does not exist a relation R with 𝗌𝖼𝗁q(R)A.

Henceforth, we will use 𝖺𝗍𝗍𝗌(q) to refer to precisely the set of attributes appearing in the image of the function 𝗌𝖼𝗁q. We will also use 𝗂𝗇𝗌(q) to mean 𝗂𝗇𝗌(S) where S is the image of the function 𝗌𝖼𝗁q; that is, 𝗂𝗇𝗌(q) is the set of sets of attributes of q appearing together in at least one relation of q. For consistency, we will use 𝗋𝖾𝗅𝗌(q) as an equivalent notation to denote the set 𝗋𝖾𝗅𝗌q. Moreover, for a query q and a set A𝗂𝗇𝗌(q) of attributes, we slightly abuse notation and use 𝗋𝖾𝗅𝗌q(A) to denote the set of relations in q that contains all the attributes of A; that is, 𝗋𝖾𝗅𝗌q(A):={R𝗋𝖾𝗅𝗌(q)A𝗌𝖼𝗁q(R)}. When A={𝐚} is a set of a single attribute, we will opt to write 𝗋𝖾𝗅𝗌q(𝐚) in place of 𝗋𝖾𝗅𝗌q({𝐚}).

Instances

A tuple 𝒕 over a finite set of attributes A𝐚𝐭𝐭𝐬 is a total function from A to 𝐝𝐨𝐦. When we want to emphasize the fact that a tuple 𝒕 is defined over a set A, we will say that 𝒕 is an A-tuple. For an A-tuple 𝒕 and a set BA, we write 𝒕[B] to denote the B-tuple with 𝒕[B](𝐚)=𝒕(𝐚) for every 𝐚B in which case we say that 𝒕 is an extension of 𝒕[B]. By convention, we consider every tuple an extension of itself and of the empty tuple. We say that an A-tuple 𝒕 and a B-tuple 𝒖 are consistent if 𝒕[AB]=𝒖[AB].

A finite set of tuples over the same set A of attributes is called a relation instance over A. A (database) instance 𝒟:=(𝒟) for a query q is a mapping 𝒟 associating every relation name R𝗋𝖾𝗅𝗌(q) with a relation instance R𝒟 over 𝗌𝖼𝗁q(R), where we write |𝒟|:=R𝗋𝖾𝗅𝗌(q)|R𝒟| to denote the total number of tuples in 𝒟. An instance is said to be a fragment of 𝒟 if RR𝒟 for every relation R 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 q that is defined as Δ:𝗋𝖾𝗅𝗌(q)[0,1]. Henceforth, we use the term default size reduction, denoted Δ0, to refer to the mapping that assigns 0 to every relation of q. We define (where the value for v will be set accordingly when needed):

Definition 1.

Let q be a query and an instance that is a fragment of an instance 𝒟. We say that is compatible with a size reduction Δ for q and a positive value v if |R||𝒟|/vΔ(R) for every relation R𝗋𝖾𝗅𝗌(q).

Given an instance 𝒟 for a query q and a tuple 𝒕 over A𝖺𝗍𝗍𝗌(q), we use 𝒟[𝒕] to refer to the instance with R𝒟[𝒕]={𝒖R𝒟𝒖 is consistent with 𝒕} for every R𝗋𝖾𝗅𝗌(q); 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 R𝗋𝖾𝗅𝗌(q), R𝒟[𝒕] is nonempty. We denote the set of all A-tuples consistent with 𝒟 as 𝗃𝗈𝗂𝗇𝗌𝒟(A):={𝒕𝒕 is an A-tuple consistent with 𝒟}. The output of a query q over an instance 𝒟, denoted q𝒟, is defined as q𝒟:=𝗃𝗈𝗂𝗇𝗌𝒟(𝖺𝗍𝗍𝗌(q)).

Query transformations

Given a query q, a set of relations, and a set A of attributes, we use 𝗌𝗎𝖻q(,A) to denote the subquery q of q that is defined with 𝗋𝖾𝗅𝗌(q):=𝗋𝖾𝗅𝗌(q)() and with 𝗌𝖼𝗁q(R):=𝗌𝖼𝗁q(R)A for R𝗋𝖾𝗅𝗌(q) where is the set {R𝗋𝖾𝗅𝗌(q)𝗌𝖼𝗁q(R)A} of relations. That is, q is obtained from q by removing the relations of along with the relations whose attributes are exclusively from A, and by removing all the attributes of A from the remaining relations. Note that when the set is empty then q is the residual query of q (w.r.t. A); in which case, we will sometimes write qA in place of 𝗌𝗎𝖻q(,A).

For two distinct relations R1,R2𝗋𝖾𝗅𝗌(q), we say that R1 is reducible into R2 when 𝗌𝖼𝗁q(R1)𝗌𝖼𝗁q(R2). We say that q is reduced if it has no reducible relations. We also say that a query q is not clean if there are two distinct relations R1,R2𝗋𝖾𝗅𝗌(q) with 𝗌𝖼𝗁q(R1)=𝗌𝖼𝗁q(R2); otherwise, the query q is said to be clean. A query q 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 q the unique clean and reduced query derived from q 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 q which are functions f:𝖺𝗍𝗍𝗌(q)[0,1] associating nonnegative rational weight f(𝐚)[0,1] to every attribute 𝐚𝖺𝗍𝗍𝗌(q). For simplicity of notation, we often write f(A) with a set of attribute A𝖺𝗍𝗍𝗌(q) to denote the sum 𝐚Af(𝐚) of the individual weights. The weight of f is then defined to be the value of f(𝖺𝗍𝗍𝗌(q)).

A relation R of q is said to be covered by a weight mapping f w.r.t. a given size reduction Δ if f(𝗌𝖼𝗁q(R))1Δ(R). We then call f an edge-weighted fractional vertex cover for q w.r.t. Δ if f covers every relation of q w.r.t. Δ. Consistent with the literature, we call f a fractional vertex cover for q if f is an edge-weighted fractional vertex cover for q w.r.t. Δ0. Observe that the minimum weight taken over all fractional vertex covers for q defines the query-related quantity τ(q) which is the fractional vertex covering number of q.

Two other query-related quantities are important: the edge quasi-packing number (ψ(q)) and the fractional vertex packing number (ρ(q)). The value of ψ(q) is defined to be the maximum fractional vertex covering number taken over all the residual queries of q; that is, ψ(q):=max{τ(q)q is the query qA for a set A of attributes}. On the other hand, ρ(q) is defined to be the maximum weight of a weight mapping f:𝖺𝗍𝗍𝗌(q)[0,1] such that the sum of weights assigned to the attributes of every relation is 1.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) Hypergraph of the query qa, which is 6×6 grid query with τ=ρ=6.
(b) Hypergraph of the query qb, which is a boat query with τ=4 and ρ=2.
(c) Hypergraph of the query qc, which is a semi-binary query with τ=7 and ρ=5.
Figure 1: Examples of different degree-two queries that we will use throughout the paper. To avoid clutter, in all depictions, we represent hyperedges by straight lines such that all the nodes connected by a straight line form a hyperedge (i.e., a relation). The color of the nodes will be meaningful later.

A query is linear if every two relations have at most one attribute in common. A degree-two query is a query q whose all attributes belong to exactly two relations, that is, |𝗋𝖾𝗅𝗌q(𝐚)|=2 for every attribute 𝐚. Given a query q, a sequence of n+1 relations R1,R2,,Rn,R1 from 𝗋𝖾𝗅𝗌(q), with the relations R1,,Rn 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 n. A cycle of length n3 is said to be odd-like if n is even and n/2 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 q is said to be semi-binary if it is a semi-grid and every attribute belongs to at least one binary relation of q.

As for grid queries, for convenience, we will only define them in some canonical form. An 𝚛×𝚌 grid query, with integers 𝚛,𝚌2, is composed of two disjoint sets of relations 𝚛={R(i,)i[𝚛]} and 𝚌={R(,j)j[𝚌]}. The former are called row relations while the latter are called column relations. Each row relation R(i,) has the set of {𝐚(i,j)j[𝚌]} as its attributes. Similarly, each column relation R(,j) has {𝐚(i,j)i[𝚛]}. Thus, the set of attributes of q is {𝐚(i,j)i[𝚛],j[𝚌]}. Notice that every attribute 𝐚(i,j) belongs to exactly two relations: the row relation R(i,) and the column relation R(,j). The query qa 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 q be an arbitrary 𝚛×𝚌 grid query with 𝚛,𝚌2. Then, we have τ(q)=max{𝚛,𝚌}, ρ(q)=min{𝚛,𝚌}, and ψ(q)=𝚛+𝚌2.

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 min{𝚛,𝚌}=2. From that observation and by Proposition 2, we directly obtain:

Lemma 4.

Every boat query q has τ(q)=ψ(q).

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 m/p1/, with a number based on the structure of the considered query q, with m the size of the relations in the database instance, and with p the considered number of servers. Depending on the different results [5], some restrictions may apply to m and p. 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 Ω(m/p1/) is considered a correct worst-case load. To be precise, for a query q, we write q𝖫𝖡[] to mean that for every m and every p evaluating q requires a load Ω(m/p1/) on some instance 𝒟 with relations of size m using p servers. From the literature, we have τ(q) and ρ(q) as common values for ; in which case, we are simply going to write q𝖫𝖡[τ] or q𝖫𝖡[ρ] to mean the classes 𝖫𝖡[τ(q)] and 𝖫𝖡[ρ(q)] respectively.

The following results are known to hold [10, 5]:

  • for every query q, q𝖫𝖡[ρ]. Notice that all queries of Figure 1 belong to this category;

  • for every query q that belongs to a strict subset of semi-grid queries (including boat queries), q𝖫𝖡[τ]. Note that, from Figure 1, only qa and qb belong to this category where for qb 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 qa and qc from Figures 1(a) and 1(c), respectively. The best-known lower bound for qa is based on either τ or ρ as they are equal, hence, we have no knowledge that qa𝖫𝖡[] for >6. As for qc, its best-known lower bound is based on ρ although for this query τ=7>ρ=5. For each of the two queries, take qa and qc to be the subqueries of qa and qc obtained by removing all the black-colored attributes from Figures 1(a) and 1(c) respectively. We will be able to verify that qa𝖫𝖡[a] for a>6 and qc𝖫𝖡[c] for c>5.

In this section, we argue that best-known lower bounds for qa and qc are not tight enough. To establish this, we show that the worst-case load for qa and qc cannot be higher than the worst-case load for the original queries.

We formulate this idea as follows:

Theorem 6.

Let q be a query and q be a reduced subquery of q with the same set of relations. Then, for MPC join algorithms running in constant number of rounds, the worst-case load for q is at least the worst-case load for q; that is, if q𝖫𝖡[] for some , then q𝖫𝖡[].

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 q and integer m, there is a family of instances 𝒟 with relation instances of size m such that the load required to compute q𝒟 over p servers is Ω(m/p1/max{τ,τ+ρ4}) 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 𝚌4, the maximum between {𝚛,𝚛+𝚌4} is simply 𝚛=τ which is the best-known bound. For this reason, we continue the argument for grids with 𝚌5, 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 qa from the query qa as per Example 3.

Proposition 8.

For every 𝚛×𝚌 grid query q with 𝚛𝚌5, there is a reduced and clean subquery q of q with 𝗋𝖾𝗅𝗌(q)=𝗋𝖾𝗅𝗌(q) and q𝖫𝖡[𝚛+𝚌4].

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 qc 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 q𝖫𝖡[τ] holds for every semi-binary query q with τ(q)=|𝖺𝗍𝗍𝗌(q)|/2. Then, for every semi-grid query q and integer m, there is a family of instances 𝒟 of relation instances of size m such that the load required to compute q𝒟 over p servers is Ω(m/p1/τ) 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 q with τ(q)=|𝖺𝗍𝗍𝗌(q)|/2 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 q with τ=k/2 and without odd-like cycles, q𝖫𝖡[τ].

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 q1 and q2 be two distinct queries with disjoint sets of attributes such that q1𝖫𝖡[τ] and q2𝖫𝖡[ρ]. Suppose that q is the Cartesian product query q1×q2. Then, q𝖫𝖡[τ(q1)+ρ(q2)].

By Proposition 3, Theorem 9 easily follows from the next proposition and Theorem 6.

Proposition 12.

Let q be a semi-grid. Then, there is a (possibly empty) set A of attributes for which qA is reduced and with 𝗋𝖾𝗅𝗌(q)=𝗋𝖾𝗅𝗌(qA) such that one of the following holds:

  • τ(q)=ρ(qA);

  • τ(q)=τ(qA) and qA is a semi-binary query with τ(qA)=|𝖺𝗍𝗍𝗌(qA)|/2; or

  • qA is the Cartesian product of two queries q1 and q2 such that τ(q)=τ(q1)+ρ(q2) where q1 is a semi-binary query with τ(q1)=|𝖺𝗍𝗍𝗌(q1)|/2.

From Example 3, note that qc is a subquery of the third form as in Proposition 3 with q1 being a 4×2 grid query (i.e., boat query) of q1𝖫𝖡[τ] and q2 being a query of 3 singleton duplicated relations of q2𝖫𝖡[ρ] and τ(q)=7=τ(q1)+ρ(q2)=4+3. Thus, by Proposition 3, we can deduce qc of Figure 1(c) has the property qc𝖫𝖡[τ]. Thus,

Corollary 13.

There exist semi-grid queries q with q𝖫𝖡[τ] 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 r0=0,r1,,rk=1 of rationals from [0,1] for k1.

For a particular choice of 𝗋, we know the following (where γ𝗋(q) is the guarantee we can algorithmically obtain for a query q given 𝗋 and it will be defined later):

Theorem 14 (Theorem 8 of [1]).

Let q be a query and 𝒟 an instance. Then, the PAC algorithm computes q𝒟 in three rounds using p servers with load 𝒪~(|𝒟|/p1/γ𝗋) 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 𝗋=0,1 is a valid spectrum):

Theorem 15 (Theorem 18 of [1]).

Let q 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 0/𝗌,1/𝗌,,(𝗌1)/𝗌,𝗌/𝗌 of rationals (that is, ri=i/𝗌 for i[𝗌]0). 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 1 into 𝗌+1 discrete sequence of ranges: 𝗋𝗇𝗀(0),,𝗋𝗇𝗀(𝗌) such that the degrees in 𝗋𝗇𝗀(i) are lighter (i.e., lower) than degrees in 𝗋𝗇𝗀(j) for all j<i, 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 A of attributes from 𝗂𝗇𝗌(q), all the A-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 q and spectrum indicator 𝗌 is a total mapping 𝒞:𝗂𝗇𝗌(q)[𝗌]0. Note that the value assigned to a set A of attributes by a configuration 𝒞, say 𝒞(A)=i, means that the degrees of all A-tuples in the corresponding fragment are in the ith range (that is, 𝗋𝗇𝗀(i)). 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 𝗂𝗇𝗌(q) to [𝗌]0 are equally meaningful. For this, we define the notion of valid configuration.

Definition 16.

A configuration 𝒞 of q and 𝗌 is valid if 𝒞(B)𝒞(A) for every pair of sets A,B𝗂𝗇𝗌(q) with BA, and, if 𝒞(A)=𝗌 for every full set A𝗂𝗇𝗌(q). The set of all valid configurations of q and 𝗌 is denoted by 𝖼𝗈𝗇𝖿𝗌(q).

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 𝒞, q= 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, γ𝗌:=max𝖼𝗈𝗌𝗍(). For a particular fragment , this 𝖼𝗈𝗌𝗍 measure intuitively means that there is a way with which the algorithm runs over the fragment with load 𝒪~(|𝒟|/p1/γ𝗌) using at most p𝖼𝗈𝗌𝗍()/γ𝗌p servers.

Naturally, the query q 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 q over is simply determined by the most efficient solution where 𝖼𝗈𝗌𝗍():=min𝒮𝖼𝗈𝗌𝗍(𝒮) 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 A𝗂𝗇𝗌(q) such that A is light in (i.e., 𝒞(A)=𝗌);

  • 𝗁𝖾𝖺𝗏𝗒() to refer to the set of 𝗂𝗇𝗌(q)𝗅𝗂𝗀𝗁𝗍(); i.e., all the heavy sets of attributes; and

  • 𝗁𝖾𝖺𝗏𝗒-𝗋𝖾𝗅():={R𝗋𝖾𝗅𝗌(q)𝐚𝗌𝖼𝗁q(R):{𝐚}𝗁𝖾𝖺𝗏𝗒()}.

To define what 𝒮 is, it is more intuitive to introduce its components from the computation of q over a fragment . Thereto, to compute q, the following phases will be followed:

Broadcast phase:

broadcast all relations in 𝗁𝖾𝖺𝗏𝗒-𝗋𝖾𝗅() to all servers. Now, the query q can be simplified to the query q:=𝗌𝗎𝖻q(,) 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 A, choose a set BA𝗅𝗂𝗀𝗁𝗍() of attributes with ABA. Henceforth, we use the terms of patches and anchors to mean the sets 𝒫:= and 𝒜:={(BA,A)A}, respectively. Let 𝒜 be the set A𝗋𝖾𝗅𝗌q(BA) of relations from 𝗋𝖾𝗅𝗌(q) and be the union 𝒜.

The query q is decomposed into a set 𝒬 of subqueries: for each anchor (BA,A)𝒜, the relations of 𝗋𝖾𝗅𝗌q(BA) make one subquery; all the remaining relations in q make one last subquery, which is 𝗌𝗎𝖻q(𝒜,)=𝗌𝗎𝖻q(,) in this case.

Partitioning phase:

for each tuple 𝒉 in over 𝖾𝗅𝖾𝗆(), we assign a group of p𝒉 servers to compute the residual query of q, obtained by removing the attributes from 𝖾𝗅𝖾𝗆(), over the sub-fragment [𝒉]. Let q′′:=q𝖾𝗅𝖾𝗆()=𝗌𝗎𝖻q(,𝖾𝗅𝖾𝗆()).

Semi-join phase:

over each group of p𝒉 servers, we apply semi-joins to simplify the query q′′ from all the redundancies to obtain the query q′′′:=q′′=𝗌𝗎𝖻q(,𝖾𝗅𝖾𝗆()).

Final join phase:

over each group of p𝒉 servers, we compute the join of all relations of q′′′ over the instance [𝒉]. In this phase, the remaining relations in q′′′ relevant for each subquery of 𝒬 are handled separately. In which case, the relations of the subquery 𝗌𝗎𝖻q′′′(𝒜,) are joined using HyperCube algorithm parameterized by a weight assignment f. Henceforth, we use qf to refer to the subquery 𝗌𝗎𝖻q′′′(𝒜,).

With this procedure in mind, 𝒮 is defined as 𝒮:=(𝒫,𝒜,f) [1]. For each such solution 𝒮, the 𝖼𝗈𝗌𝗍 is defined as

𝖼𝗈𝗌𝗍(𝒮):=((A𝒫𝒞(A))+|𝒫|)/𝗌𝖼𝗈𝗌𝗍(𝒫)+|𝒜|𝖼𝗈𝗌𝗍(𝒜)+f(𝖺𝗍𝗍𝗌(qf))𝖼𝗈𝗌𝗍(f).

We remark that the load induced by some choices of 𝒮 cannot be bounded, as there are conditions that f needs to satisfy to have a compatible solution. According to [1], a solution 𝒮 to a fragment corresponding to a configuration 𝒞𝖼𝗈𝗇𝖿𝗌(q) is said to be compatible if f is a frac. vertex cover for qf of weight 1 with f(A)𝒞(A)/𝗌 for every heavy set A.777The condition of f(A)𝒞(A)/𝗌 for all heavy sets A guarantees that applying HyperCube with the shares of f 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 q is computable using p servers with load 𝒪~(|𝒟|/p1/𝖼𝗈𝗌𝗍(𝒮)) w.h.p.

Limitation

The requirement that f has to be a fractional vertex cover for qf is not necessary and it can be made tighter in some cases. Thereto, for a given configuration 𝒞𝖼𝗈𝗇𝖿𝗌(q) and an A-tuple 𝒕, we define the size-reduction induced by 𝐭, denoted Δ𝒞,𝒕, to be the size reduction of q with, for every R𝗋𝖾𝗅𝗌(q), Δ𝒞,𝒕(R):=𝒞(AR)/𝗌 such that AR is the set A𝗌𝖼𝗁q(R).

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 𝒮:=(𝒫,𝒜,f) to corresponding to a configuration 𝒞 is said to be reduced if f is an edge-weighted frac. vertex cover for qf and the size reduction Δ𝒞,𝒉, of weight 1 and, with f(A)+Δ𝒞,𝒉(R)𝒞(A)/𝗌 for every heavy set A and every R𝗋𝖾𝗅𝗌qf(A). We show:

Theorem 18.

Let 𝒮 be a reduced solution for a fragment of 𝒟. Then q is computable using p servers with load 𝒪~(|𝒟|/p1/𝖼𝗈𝗌𝗍(𝒮)) 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 q over any instance 𝒟 using p servers is asymptotically upper bounded by |𝒟|/p1/, 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 q, we set =k/2 where k=|𝖺𝗍𝗍𝗌(q)| and we choose 𝗌=2. We next show

Proposition 19.

Every fragment corresponding to a configuration 𝒞 has 𝖼𝗈𝗌𝗍()k/2.

Thereto, let 𝒞 be an arbitrary configuration from 𝖼𝗈𝗇𝖿𝗌(q) and let be the corresponding fragment to 𝒞. The image of 𝒞 in this case is {0,1,2} where 0 corresponds to heavy, 1 corresponds to semi-heavy, and 2 corresponds to light.

Notice that we only consider relations of q with at least one attribute 𝐚 with 𝒞({𝐚})=𝗌=2. 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 f such that f(𝐚)=1 for every light attribute (i.e., all the attributes) and f(𝐚)=0 for every other attribute. It is easy to see that 𝒮 is a compatible solution.

Observe that, in this case, 𝖼𝗈𝗌𝗍(𝒮)=𝖼𝗈𝗌𝗍(f)=||. To complete the argument for this case, we need to show that ||k/2, 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 q is of size k/2.

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 2||.

Now, take 𝒫 to be the set {{𝐚}𝐚 is heavy and does not appear in 𝒜}. Observe that, since each set of attributes in 𝒫 is heavy, we have 𝖼𝗈𝗌𝗍(𝒫)=|𝒫|/2 and the set of attributes in 𝒫 is of size |𝒫|.

Finally, take f to be the weight mapping with f(𝐚)=1/2 for every remaining attribute that is either semi-heavy or light but non-isolated. It is easy to see that 𝖼𝗈𝗌𝗍(f) is equal to half the attributes it assigns weight to. Hence, overall, each attribute contributes to the solution with a cost of at most 1/2. Thus, 𝖼𝗈𝗌𝗍(𝒫)+𝖼𝗈𝗌𝗍(𝒜)+𝖼𝗈𝗌𝗍(f)k/2 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 q and instance 𝒟, q𝒟 is computable over p servers with load 𝒪~(|𝒟|/p1/min{ψ,k/2}) w.h.p.

As a direct consequence of the previous theorem and Theorem 10, we obtain:

Corollary 23.

For every semi-binary query q with τ=k/2 and without odd-like cycles and instance 𝒟, q𝒟 is computable over p servers with load 𝒪~(|𝒟|/p1/τ) 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 q and every instance 𝒟, q𝒟 is computable over p servers with load 𝒪~(|𝒟|/p1/max{τ,τ+ρ3}) 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 𝒪~(|𝒟|/p1/max{𝚛,𝚛+𝚌3}) instead. To establish Theorem 24, we set =max{𝚛,𝚛+𝚌3}. We continue our analysis by distinguishing two cases based on grid dimensions.

First, consider the case of grids with 𝚌=2. This is precisely the case when q is a boat query. By Lemma 2 and Theorem 15, we obtain the desired result by setting 𝗌=1 since =max{𝚛,𝚛+𝚌3}=𝚛=τ=ψ.

Now, consider grids with 𝚌3. 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 𝚛=3 and 𝚛4 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 𝚛=3, we use a spectrum defined by the indicator 𝗌=6, and we utilize multiple solution strategies in which case none uses anchors. On the other hand, for 𝚛4, we find that a spectrum indicator of 𝗌=1 is sufficient to obtain the upper bound we claim, and all solution strategies, we use, involve anchors.

As a result of Theorem 7 and Theorem 24, we directly obtain:

Corollary 25.

For every 𝚛×𝚌 grid query q with min{𝚛,𝚌}3 and every instance 𝒟, q𝒟 is computable over p servers with load 𝒪~(|𝒟|/p1/τ) 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 q be an 𝚛×𝚌 grid query with 𝚛,𝚌2. Let A be a set of attributes from 𝖺𝗍𝗍𝗌(q). Suppose there exist integers i and j with i[𝚛] and j[𝚌] such that every attribute 𝐚 of the residual query qA either belongs to the ith row relation (i.e., 𝐚 is of the form 𝐚(i,w)) or belongs to the jth column relation (i.e., 𝐚 is of the form 𝐚(w,j)). Now, let B(i,) and B(,j) be the set of attributes of qA belonging to the ith row relation and the jth column relation, respectively. Now, if either B(i,){𝐚(i,j)} or B(,j){𝐚(i,j)} is empty, then take B to be the set of attributes defined as B:=B(i,)B(,j). Otherwise, take B to be the set with B:=(B(i,)B(,j)){𝐚(i,j)}. Then, τ(qA)=|B|𝚛+𝚌2.

Proof.

Without loss of generality, assume that both i and j are equal to 1; hence, the row relation and the column relation of the statement are R(1,) and R(,1). Accordingly, we know that A{𝐚(u,v)2u𝚛,2v𝚌}. Moreover, notice that the set of attributes B(,1){𝐚(u,1)1u𝚛} and that B(1,){𝐚(1,v)1v𝚌}.

Since both sets form the entire set of attributes in qA, it is trivial to argue that

τ(qA)|B(1,)B(,1)| (1)

Now, observe that every attribute 𝐚(u,1) (with u2) in the first set (B(,1)) is the only remaining attribute in the row relation R(u,); similarly, every attribute 𝐚(1,v) (with v2) in the second set (B(1,)) is the only remaining attribute in the column relation R(,v). Accordingly, any valid fractional vertex cover f for qA in this case must assign a weight of 1 to each such attribute. Thus,

τ(qA)|B{𝐚(1,1)}| (2)

If 𝐚(1,1)A and hence it is not an attribute in qA, then B{𝐚(1,1)}=B=B(1,)B(,1). From Equations (1) and (2), we direction obtain that τ(qA)=|B|. Notice that in this case, the maximal possible set for B occurs when B(,1)={𝐚(u,1)2u𝚛} and B(1,)={𝐚(1,v)2v𝚌} which are sets of size 𝚛1 and 𝚌1 respectively. Thus, |B|(𝚛1)+(𝚌1)=𝚛+𝚌2 as desired.

Now, suppose that 𝐚(1,1)A, and hence, 𝐚(1,1)B(1,)B(,1). When both B(1,) and B(,1) have other attributes, then the aforementioned weight assignment f is already a valid fractional vertex cover for qA since both R(1,) and R(,1) are covered by at least one other attribute from B(1,) and B(,1) respectively. Notice that in this case B=B{𝐚(1,1)}. Hence, τ(qA)=|B|. The argument that |B|𝚛+𝚌2 is similar to that of the previous case.

On the other hand, when either B(1,) or B(,1) does not contain any other attribute, the previous weight assignment f cannot be a valid fractional vertex cover as there is either R(1,) or R(,1) that is not covered and the only remaining attribute in either relation is the attribute 𝐚(1,1). Thus, f must also assign a weight of 1 to 𝐚(1,1), which is minimal in this case. Accordingly, we obtain that τ(qA)=|B(,1)B(1,)|. Notice that by construction B=B(1,)B(,1)B{𝐚(1,1)}. Moreover, the maximal size of B is either 𝚛 (when B(,1)={𝐚(1,1)}) or 𝚌 (when B(1,)={𝐚(1,1)}). In both cases, |B|max{𝚛,𝚌}𝚛+𝚌2 as 𝚛,𝚌2 by definition.

Secondly:

Lemma 27.

Let q be an 𝚛×𝚌 grid query with 𝚛,𝚌2. Let A be a set of attributes from 𝖺𝗍𝗍𝗌(q) such that the residual query qA does not satisfy the conditions of Lemma A.1. Then, τ(qA)max{𝚛,𝚌,𝚛+𝚌3}.

Proof.

We prove the lemma by case distinction.

First, we consider the case that the residual query qA contains a set B of three attributes with {𝐚(i1,j1),𝐚(i2,j2),𝐚(i3,j3)} such that i1i2i3 and j1j2j3. Take f to be the weight mapping with f(𝐚)=1 for 𝐚B. So far f covers 3 different row relations and 3 different column relations. Let q be the query qA after removing the 6 covered relations. Notice that |𝗋𝖾𝗅𝗌(q)|𝚛+𝚌6 in this case. To cover the rest of the relations of qA we then need a weight mapping with total weight of at most 𝚛+𝚌6. Thus, the total weight mapping for the entire qA is 𝚛+𝚌6+3=𝚛+𝚌3 as desired.

Now, we continue with the assumption that qA contains no set B of three attributes with {𝐚(i1,j1),𝐚(i2,j2),𝐚(i3,j3)} such that i1i2i3 and j1j2j3. Furthermore recall that qA does not satisfy the conditions of Lemma A.1. We obtain that the attributes of qA 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 1 to be the set of indices of column relations having an attribute at the first row and similarly take 2 to be the set of indices of column relations having an attribute at the second row. As mentioned above, each of the two sets 1 and 2 is of size 2. Let 𝐚(i1,j1) and 𝐚(i2,j2) be two attributes from qA such that i1i2 and j1j2. Observe that such two attributes must exist by the aforementioned conditions. Take f to be the weight mapping with f(𝐚)=1 for every 𝐚{𝐚(i1,j)j1,jj2}{𝐚(i2,j)j21}. Notice that this assignment covers all the column relations of qA. Moreover, since the attributes {𝐚(i1,j1),𝐚(i2,j2)} are assigned 1 by f. Then, this assignment also covers each of the two row relations remaining in qA. This shows that τ(qA)|12|𝚌 as desired.

The analogous argument for the second form will result in τ(qA)𝚛 as desired.

Now, we are in position to prove Proposition 2.

(a) The orange-colored attributes form an optimal vertex cover, while the grey-highlighted relations form an optimal edge packing.
(b) The orange-colored attributes form an optimal vertex packing, while the grey-highlighted relations form an optimal edge cover.
(c) The black-colored attributes form a possible set A of attributes, for which τ(qA) is equal to ψ(q).
(d) The residual query qA. Note that each square in the depiction represents a singleton relation.
Figure 2: Illustrations for τ, ρ, and ψ on the 5×3 grid query.
Proposition 2.

Let q be an arbitrary 𝚛×𝚌 grid query with 𝚛,𝚌2. Then, we have τ(q)=max{𝚛,𝚌}, ρ(q)=min{𝚛,𝚌}, and ψ(q)=𝚛+𝚌2.

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 f to be the weight mapping with f(𝐚)=1 for 𝐚{𝐚(i,i)1i𝚌}{𝐚(i,1)𝚌<i𝚛} and all other attributes have f()=0. Note that f assigns a weight of 1 to exactly one attribute per row relation and at least one attribute per column relation. Hence, f is a valid vertex cover for q 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 f and hence τ=𝚛 as desired.

Second, we show that ρ=𝚌. For this, take f to be the weight mapping with f(𝐚)=1 for 𝐚{𝐚(i,i)1i𝚌} and all other attributes has f()=0. Note that f is a valid vertex packing in this case with weight equal to 𝚌 in which case it assigns 1 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 f, we remark that the set 𝚌 of column relations form a valid edge cover whose size is equal to 𝚌 as well. Hence, f is optimal and ρ=𝚌 as desired.

Finally, we show the last property of ψ=𝚛+𝚌2. We begin by showing that ψ𝚛+𝚌2. For this, take A to be the set {𝐚(1,1)}{𝐚(i,j)2i𝚛,2j𝚌} of attributes. The residual query qA consists of 𝚛+𝚌2 attributes in this case; those are formed by the two sets of {𝐚(i,1)2i𝚛} and {𝐚(1,j)2j𝚌}. Notice that our choice for A (and hence, the query qA) satisfies the conditions of Lemma A.1 with |B|=𝚛+𝚌2. Thus, we obtain that τ(qA)=𝚛+𝚌2 as desired.

The other direction (ψ𝚛+𝚌2) follows straightforwardly from Lemma A.1 and Lemma A.1 and the fact that max{𝚛,𝚌,𝚛+𝚌3}𝚛+𝚌2 (recall 𝚛,𝚌2).

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 𝖼𝗈𝗇𝖿𝗌(q) and :=𝖿𝗋𝖺𝗀𝗆𝖾𝗇𝗍(𝒞). The fragment is said to be difficult if there is a row relation R(i,)𝚛 and a column relation R(,j)𝚌 such that:

  • every R(i,) attribute 𝐚(i,w) with wj is light;

  • every R(,j) attribute 𝐚(w,j) with wi is light; and

  • every attribute 𝐚(u,v) with ui and vj 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 H is the set 𝖾𝗅𝖾𝗆(𝗁𝖾𝖺𝗏𝗒()) of attributes. Then, τ(qH)>𝚛+𝚌3 if and only if is a difficult fragment.

The proof of the lemma follows from the discussion about the value of ψ for grids of Proposition 2, which can be found in Appendix A.1.