Abstract 1 Introduction 2 Preliminaries 3 Partition Constraints 4 The Hexagon Query 5 Partition Constraints for General Conjunctive Queries 6 Conclusions and Future Work References

Partition Constraints for Conjunctive Queries: Bounds and Worst-Case Optimal Joins

Kyle Deeds ORCID University of Washington, Seattle, WA, USA Timo Camillo Merkl ORCID TU Wien, Austria
Abstract

In the last decade, various works have used statistics on relations to improve both the theory and practice of conjunctive query execution. Starting with the AGM bound which took advantage of relation sizes, later works incorporated statistics like functional dependencies and degree constraints. Each new statistic prompted work along two lines; bounding the size of conjunctive query outputs and worst-case optimal join algorithms. In this work, we continue in this vein by introducing a new statistic called a partition constraint. This statistic captures latent structure within relations by partitioning them into sub-relations which each have much tighter degree constraints. We show that this approach can both refine existing cardinality bounds and improve existing worst-case optimal join algorithms.

Keywords and phrases:
Worst-Case Optimal Joins, Cardinality Bounds, Degeneracy, Degree Constraints, Partition Constraints
Funding:
Kyle Deeds: Was supported by the NSF SHF 2312195 and NSF IIS 2314527 grants.
Timo Camillo Merkl: Was supported by the Vienna Science and Technology Fund (WWTF) [10.47379/ICT2201, 10.47379/VRG18013].
Copyright and License:
[Uncaptioned image] © Kyle Deeds and Timo Camillo Merkl; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Database theory
Related Version:
Full Version: https://arxiv.org/abs/2501.04190 [8]
Acknowledgements:
Part of this work was done when the authors were visiting the Simons Institute for the Theory of Computing.
Editors:
Sudeepa Roy and Ahmet Kara

1 Introduction

Efficient query execution is the cornerstone of modern database systems, where the speed at which information is retrieved often determines the effectiveness and user satisfaction of applications. In theoretical work, this problem is often restricted to the enumeration of conjunctive queries (CQs). One of the primary goals of database theory has been to classify the hardness of different queries and provide algorithms that enumerate them in optimal time. Most of these classical guarantees were described relative to the size, N, of the largest table in the database. In practical work, there has been a parallel effort to hone query optimizers which automatically generate an algorithm for query evaluation based on the particular properties of the data, finely tailoring the execution to the dataset at hand.

Recently, these lines of work have begun to meaningfully converge in the form of worst-case optimal join (WCOJ) algorithms. As a new paradigm in database theory, these methods provide data-dependent guarantees on query execution that take into account statistics s(D) about the dataset being queried D. Concretely, WCOJ algorithms aim to only require time proportionate to (a bound on) the maximum join size over all databases D with the same statistics as D, i.e., an optimal runtime on the worst-case instance. Crucially, the statistics that are used directly impact the kinds of guarantees that can be provided; more granular statistics allow for tighter worst-case analyses.

In a sequence of papers, increasingly more detailed statistics were incorporated into theoretical analyses. The foundational work in this direction by Grohe et al. used the size of each table in the database, often called cardinality constraints (CC)s, to produce bounds on the output size [2, 15]. This eventually led to a multitude of exciting WCOJ algorithms for CCs, e.g., Generic Join [22], Leapfrog Triejoin [24], and NPRR [21]. Instead of processing one join at a time, these algorithms processed one attribute at a time, asymptotically improving on traditional join plans. They have even seen significant uptake in the systems community with a variety of efficient implementations [1, 12, 25].

In later work, researchers incorporated functional dependencies (FDs) into cardinality bounds and then generalized CCs and FDs to degree constraints (DCs) [14, 18]. This work culminated in the development of the PANDA algorithm which leveraged information theory and proof-theoretic techniques to provide worst-case optimality relative to the polymatroid bound, modulo an additional poly-logarithmic factor [19].

A DC for a relation R on the attributes Y and a subset XY asserts that for each fixed instantiation x of X there are only a limited number of completions to the whole set of attributes Y. Thus, X functions like a weak version of a key. However, DCs are a brittle statistic; a single high frequency value per attribute can dramatically loosen a relation’s DCs even if all other values only occur once. In the graph setting, where this corresponds to bounded (in- or out-)degree graphs, this has long been viewed as an overly restrictive condition because graphs often have highly skewed degree distributions. To overcome this, the graph theory community identified degeneracy as a natural graph invariant that allows for graphs of unbounded degree while permitting fast algorithms. For example, pattern counting on low degeneracy graphs has recently received considerable attention [3, 4, 5, 6, 7, 13].

In this work, we propose partition constraints (PCs), a declarative version of graph degeneracy for higher-arity data. PCs naturally extend DCs in the sense that every DC can be expressed as PC, but not the other way around. Informally, for a PC to hold over a relation R, we require it to be possible to split R such that each partition satisfies at least one DC. Again, for a binary edge relation R=E of a directed graph G=(V,E), this means that we can partition the edges into two sets E1,E2, such that the subgraph G1:=(V,E1) has bounded out-degree while G2:=(V,E2) has bounded in-degree.

We aim to provide a thorough analysis of the effect of PCs on conjunctive query answering. To that end, we show that PCs can provide asymptotic improvements to query bounds and evaluation, and we demonstrate how they can gracefully incorporate work on cardinality bounds and WCOJ algorithms for DCs. Further, we provide both exact and approximate algorithms for computing PCs and inspect to what extent PCs are present in well-known benchmark datasets.

Summary of results.

  • We introduce PCs as a generalization of DCs and provide two algorithms to determine PCs in polynomial time as well as to partition the data to witness these constraints. One is exact and runs in quadratic time, while the second runs in linear time and provides a constant factor approximation.

  • We develop new bounds on the output size of a join query. These bounds use DC-based bounds as a black box and naturally extend them to incorporate PCs. We show that these bounds are asymptotically tighter than bounds that rely on DCs alone. Further, we show that if the DC-based bounds are tight, then the PC-based bounds built on top of them will be tight as well.

  • Using WCOJ algorithms for DCs as a black box, we provide improved join algorithms that are worst-case-optimal relative to the tighter PC-based bound. Notably, if an algorithm were proposed that is worst-case optimal relative to a tight DC-based bound, then this would immediately result in a WCOJ algorithm relative to a tight PC-based bound.

Structure of the paper.

In Section 5, we provide some basic definitions and background. We formally introduce and discuss PCs in Section 3 and compute them on common benchmark data. In Section 4, we illustrate the benefits of the PC framework by thoroughly analyzing a concrete example. The developed techniques are then extended in Section 5 and applied to arbitrary CQs. We conclude and give some outlook to future work in Section 6. Full proofs of some results are deferred to the technical report [8], and we instead focus on providing intuition in the main body.

2 Preliminaries

Conjunctive queries.

We assume the reader is familiar with relational algebra, in particular with joins, projections, and selection, which will respectively be denoted by ,π, and σ. In the context of the present paper, a (conjunctive) query (CQ), denoted using relational algebra, is an expression of the form

Q(𝐙)R1(𝐙1)Rk(𝐙k).

In this expression, each Ri(𝐙i) is a relation over the set of variables 𝐙i, and Q(𝐙) is the output of the query where 𝐙=i𝐙i. Thus, we only consider full conjunctive query. When clear from the context, we omit the reference to the set of variables and simply write Ri and Q. We also use Q to refer to the whole CQ. A database instance I for Q is comprised of a concrete instance for each Ri, i.e., a set of tuples (also denoted by Ri) where each tuple zi contains a value for each variable in 𝐙i. The set of values appearing in I is referred to as dom, the domain of I. Furthermore, let dom(Z) be the values assigned to ZZ by some relation Ri and, for YZ, dom(Y):=×YYdom(Y). For a particular database instance I, we denote the answers to a CQ, i.e., the join of the Ri, as a relation QI(𝐙). Lastly, a join algorithm 𝒜 is any algorithm that receives a query Q and a database instance I as input and outputs the relation QI(𝐙).

Degree constraints and bounds.

In recent years, there has been a series of novel approaches to bound the size of QI(𝐙) based on the structure of the query Q and a set of statistics about the database instance I. For full conjunctive queries, this recent round of work began with the AGM bound [2]. This bound takes the size of each input relation as the statistics and connects the size of the result to a weighted edge covering of the hypergraph induced by Q. Later bounds extended this approach by considering more complex statistics about the input relations. Functional dependencies were investigated first in [14]. These were then generalized to degree constraints (DCs) in [18] and degree sequences (DSs) in [9, 10, 17]. Our work in this paper continues in this vein by generalizing degree constraints further to account for the benefits of partitioning relations. So, we begin by defining degree constraints below.

Definition 1.

Fix a particular relation R(𝐙). Given two sets of variables 𝐗,𝐘 where 𝐗𝐘𝐙, a degree constraint of the form DCR(𝐗,𝐘,d) implies the following,

max𝐱dom(𝐗)|π𝐘σ𝐗=𝐱R|d.

A database instance I satisfying a (set of) degree constraints 𝐃𝐂 is denoted by I𝐃𝐂. For convenience, we denote the minimal d such that DCR(𝐗,𝐘,d) holds by DCR(𝐗,𝐘). If 𝐘=𝐙 and 𝐗= the constraint simply bounds the cardinality of R and we write CCR(d). If clear from the context, we may omit R.

In addition to generalizing DCs, our work is able to refine any of the previous bounding methods for DCs by incorporating them into our framework. Therefore, we introduce a general notation for DC-based bounds.

Definition 2.

Given a conjunctive query Q and a set of degree constraints 𝐃𝐂, a cardinality bound CB(Q,𝐃𝐂) is any function where the following is true,

|QI(𝐙)|CB(Q,𝐃𝐂)I𝐃𝐂.

Throughout this work, we will make specific reference to the combinatorics bound which we describe below. While it is impractical, this bound is computable and tight which makes it useful for theoretical analyses.

Definition 3.

Given a conjunctive query Q and a set of degree constraints 𝐃𝐂, we define the combinatorics bound (for degree constraints) as

CBComb(Q,𝐃𝐂)=supI𝐃𝐂|QI(𝐙)|.

In this work, we make two minimal assumptions about bounds and statistics. First, we assume that cardinality bounds are finite by assuming that every variable in the query is covered by at least one cardinality constraint. Second, we assume that there is a bound on the growth of the bounds as our statistics increase. Formally, for a fixed query Q, we assume that every cardinality bound CB has a function fQ such that for any α+ and degree constraints DC we have CB(Q,αDC)fQ(α)CB(Q,DC). Usually, cardinality bounds are expressed in terms of power products of the degree constraints [2, 14, 17]. In that case, fQ=O(αc) for some constant c.

Lastly, we will also incorporate existing work on worst-case optimal join (WCOJ) algorithms. Each WCOJ algorithm is optimal relative to a particular cardinality bound, and we describe that relationship formally as follows:

Definition 4.

Denote the runtime of a join algorithm 𝒜 on a conjunctive query Q and database instance I as 𝒯(𝒜,Q,I). 𝒜 is worst-case optimal (WCO) relative to a cardinality bound CB𝒜 if the following is true for all queries Q,

𝒯(𝒜,Q,I)=O(|I|+CB𝒜(Q,𝐃𝐂)),𝐃𝐂,I𝐃𝐂.

Note that the hidden constant may only depend on the query Q and, importantly, neither on the set of degree constraints 𝐃𝐂 nor on the database instance I. When 𝒜 is optimal relative to CBComb, we simply call it worst-case optimal (relative to degree constraints).

Note that some algorithms fulfill a slightly looser definition of worst-case optimal by allowing additional poly-logarithmic factors [19]. These algorithms can still be incorporated into this framework, but we choose the stricter definition to emphasize that we do not induce additional factors of this sort.

Much of the recent work on WCOJ algorithms can be categorized as variable-at-a-time (VAAT) algorithms. Intuitively, a VAAT computes the answers to a join query by answering the query for an increasingly large number of variables. This idea is at the heart of Generic Join [22], Leapfrog Triejoin [24], and NPRR [21]. We define this category formally as follows. For an arbitrary query Q(Z)R1Rk, let Qi denote the sub-query

Qi(Z1,Zi)πZ1,,ZiR1πZ1,,ZiRk,

for an ordering Z1,,Zr=Z.

Definition 5.

A join algorithm 𝒜 that solves conjunctive queries Q(𝐙)R1(𝐙1)Rk(𝐙k) is a VAAT algorithm if there is some ordering Z1,,Zr=𝐙 such that 𝒜 takes time Ω(maxi|QiI|) for databases I. The choice of the ordering is allowed to depend on I.

3 Partition Constraints

Partition constraints (PCs) extend the concept of DCs by allowing for the partitioning of relations. For clarity, we start with the binary setting, revisiting the example from the introduction. To that end, let E(X,Y) be the edge relation of a directed graph G=(V,E). For a degree constraint to hold on E, either the in- or the out-degree of E must be bounded. However, this is a strong requirement and often may not be satisfied, e.g. on a highly skewed social network graph. In these cases, it makes sense to look for further latent structure in the data. We suggest partitioning E such that each part satisfies a (different) degree constraint. We are interested in the following quantity where the minimum is taken over all bi-partitions of E, i.e. E=EXEY (implicitly EXEY=),

minEXEY=Emax{DCEX(X,XY),DCEY(Y,XY)}. (1)

This corresponds to a splitting of the graph into two graphs. In one of them, GX=(V,EX), we attempt to minimize the maximum out-degree of the graph while in the other, GY=(V,EY), we attempt to minimize the maximum in-degree. It is important to note that both of these quantities can be arbitrarily lower than the maximum in-degree and out-degree of the original graph. This is where the benefit of considering partitions comes from.

An example of such a partitioning is depicted in Figure 2. There, the dashed blue edges represent EX while the solid red edges represent EY. The maximum out- and in-degree of the full graph is 5 while GX=(V,EX) has a maximum out-degree of 1 and GY=(V,EY) has a maximum in-degree of 1. In general, a class of graphs can have an unbounded out- and in-degree but always admit a bi-partitioning with an out- and in-degree of 1, respectively.

Figure 1: Graph Example.
Access
PersonID RoomID
Ava Beacon Hall
Ben Beacon Hall
Cole Delta Hall
Dan Delta Hall
Emma Gala Hall
Finn Jade Hall
Porter Beacon Hall
Porter Delta Hall
Porter Gala Hall
Porter Jade Hall
AccessPersonID
PersonID RoomID
Ava Beacon Hall
Ben Beacon Hall
Cole Delta Hall
Dan Delta Hall
Emma Gala Hall
Finn Jade Hall
AccessRoomID
PersonID RoomID
Porter Beacon Hall
Porter Delta Hall
Porter Gala Hall
Porter Jade Hall
Figure 2: Access Example.

This approach is originally motivated by the graph property degeneracy. Intuitively, this property tries to allocate each edge of an undirected graph to one of its incident vertices such that no vertex is “responsible” for too many edges. Each partition E=EXEY can be seen as a possible allocation where the edges in EX are allocated to the X part of the tuples while the edges in EY are allocated to the Y part of the tuples. Thus, in general, if the undirected version of a graph class 𝒢 has bounded degeneracy, the Quantity 1 must also be bounded for 𝒢. In fact, the converse is true as well if the domain of the X and Y attributes are disjoint.

Formally, we define a PC on a relation R as below. Note, we say a collection of subrelations (R1,,Rk) partition R when they are pairwise disjoint and jRj=R.

Definition 6.

Fix a particular relation R(𝐙), a subset 𝐘𝐙, and let 𝒳={𝐗1,,𝐗|𝒳|}2𝐘 be a set of sets of variables. Then, a partition constraint of the form PCR(𝒳,𝐘,d) implies,

min(R𝐗)𝐗𝒳 partition Rmax{DCR𝐗(𝐗,𝐘)𝐗𝒳}d.

Again, a database instance I satisfying a (set of) partition constraints 𝐏𝐂 is denoted by I𝐏𝐂. We denote the minimal d such that PCR(𝒳,𝐘,d) holds by PCR(𝒳,𝐘) and we omit R if clear from the context.

This definition says that one can split the relation R into disjoint subsets RjR,jRj=R and associate each Rj with a degree constraint over a set of variables Xj𝒳 such that the maximum of these constraints is then bounded by d. From an algorithmic point of view, each part Rj should be handled differently to make use of its unique, tighter DC. The core of this work is in describing how these partitions can be computed and how to make use of the new constraints on each part. Broadly, we show how these new constraints produce tighter bounds on the join size and how algorithms can meet these bounds. Note PCs are a strict generalization of DCs since we can define an arbitrary degree constraint DC(𝐗,𝐘,d) as PC({𝐗},𝐘,d). For simplicity, when we discuss a collection of PCs, we assume that there is at most one PCs per (𝒳,Y) pair, i.e., there are never two PCR(𝒳,𝐘,d),PCR(𝒳,𝐘,d),dd, as it suffices to keep the stronger constraint.

Next, we present an example of how relations with small PCs might arise in applications.

Example 7.

Consider a relation Access(PersonID, RoomID) that records who has access to which room at a university. This could be used to control the key card access of all faculty members, students, security, and cleaning personnel. Most people (faculty members and students) only need access to a limited number of rooms (lecture halls and offices). On the other hand, porters and other caretaker personnel need access to many different rooms, possibly all of them. However, each room only needs a small number of people taking care of it. Thus, it makes sense to partition Access into AccessPersonIDAccessRoomID with the former tracking the access restrictions of the faculty members and students, and the latter tracking the access restrictions of the caretaker personnel. With this partition, both DCAccessPersonID(PersonID,RoomID) and DCAccessRoomID(RoomID,PersonID) should be small. Thus, PCAccess({PersonID,RoomID},PersonID RoomID) should be small as well.

Figure 2 depicts a small example instance of the situation. There, the students each only need access to a single lecture hall to attend their courses, and all the rooms are taken care of by a single porter. Thus, following the suggested splitting, the respective DC for both subrelations AccessPersonID and AccessRoomID is 1 and, therefore, also the PC for the whole relation Access is 1.

To see how these statistics manifest in real world data, we calculated the PC of relations from some standard benchmarks which are displayed in Figure 4 [23, 16, 20]. We computed the PC using Algorithm 3 from Section 5. To model the interesting case of many-to-many joins, we first removed any attributes which are primary keys from each relation. Specifically, we computed the partition constraint PC({XX𝐘},𝐘) where 𝐘 is the set of non-key attributes. We compare this with the minimum and maximum degree of these attributes before partitioning. Naively, by partitioning the data randomly, one would expect a PC roughly equal to the maximum DC divided by |𝒳|. Alternatively, by placing all tuples in the partition corresponding to the minimum DC, one can achieve a PC equal to the minimum DC. However, the computed PC is often much lower than both of these quantities. This implies that the partitioning is uncovering useful structure in the data rather than simply distributing high-degree values over multiple partitions.

Dataset Max DC Min DC PC |𝒳|
aids 11 11 3 2
yeast 154 119 9 2
dblp 321 113 34 2
wordnet 526 284 3 2
Stats/badges 899 456 8 2
Stats/comments 134887 45 15 3
Stats/post_links 10186 13 2 4
Stats/post_history 91976 32 3 4
Stats/votes 326320 427 33 4
IMDB/keywords 72496 540 71 2
IMDB/companies 1334883 94 13 4
IMDB/info 13398741 2937 123 4
IMDB/cast 25459763 1741 52 6
Figure 3: Example PCs.
Figure 4: The Query Q.

3.1 Further Partitioning

At this point, one might wonder if further partitioning the data can meaningfully reduce a PC. That is, whether for a given relation R(Z) and a particular set of degree constraints {DCR(X,Y)X𝒳}, is it possible to decrease the maximum DC significantly by partitioning R into more than |𝒳| parts? We show that this is not the case; neither pre-partitioning nor post-partitioning the data into k parts can reduce the PC by more than a factor of k. We prove the former first.

Proposition 8.

Given a relation R(𝐙), a subset 𝐘𝐙, variable sets 𝒳2𝐘, and subrelations (R1,,Rk) that partition R. Then,

maxi=1,,kPCRi(𝒳,𝐘)PCR(𝒳,𝐘)/k.

Proof.

For the sake of contradiction, we assume that there exists a partitioning (R1,,Rk) of R such that,

maxi=1,,kPCRi(𝒳,𝐘)<PCR(𝒳,𝐘)/k.

Then, we can partition each Ri to witness PCRi(𝒳,𝐘). Let X𝒳Ri,X=Ri be such that DCRi,X(X,Y)PCRi(𝒳,𝐘) holds for each part Ri,X. For each fixed X𝒳, we can combine the sub-relations R1,X,,Rk,X into a single relation RX. These relations, (RX)X𝒳, form a partition of R. The DC for each RX is at most the sum of the DCs of R1,X,,Rk,X. Further, this sum must be less than our initial PC by our assumption,

DCRX(X,Y)kPCRi(𝒳,𝐘)<PCR(𝒳,𝐘).

This directly implies that

max𝐗𝒳DCR𝐗(𝐗,Y)<PCR(𝒳,𝐘).

Because the PC is defined as the minimum value of this maximum DC over all possible partitions of R into |𝒳| parts, this is a contradiction. Next, we show that post-partitioning cannot super-linearly reduce the degree either.

Proposition 9.

Let (R1,,Rk) partition a relation R(𝐙), and let 𝐗𝐘𝐙 be two subsets of variables. Then,

maxi=1,,kDCRi(𝐗,𝐘)DCR(𝐗,𝐘)/k.

Proof.

Let 𝐱 be the value of 𝐗 within R that occurs in tuples with d=DCR(𝐗,𝐘) unique values y of 𝐘. For each of these values 𝐲, a tuple containing 𝐲 must be associated with one partition Ri. By the pigeonhole principle and the fact that there are DCR(𝐗,𝐘) of these tuples, it follows that some partition must contain at least DCR(𝐗,𝐘)/k of these tuples. Therefore, for some i{1,,k}, we have DCPi(𝐗,𝐘)DCR(𝐗,𝐘)/k.

Theorems 8 and 9 together show that for a given relation R(Y) and a particular set of degree constraints {DCR(X,Z)X𝒳} deemed relevant, we only have to consider partitionings of R into at most |𝒳| pieces. Thus, if the query size is viewed as a constant, then the number of useful partitions is also a constant.

4 The Hexagon Query

In this section, we show the benefits of the PC framework by demonstrating how it can lead to asymptotic improvements for both cardinality bounds and conjunctive query evaluation. Concretely, there is an example query and class of database instances where bounds based on PC are asymptotically tighter than those based on DC. Further, all VAAT algorithms (See Definition 5) are asymptotically slower than a PC-aware algorithm on this query and instance class. Formally, our aim is to show the following:

Theorem 10.

There exists a query Q and a set of partition constraints 𝐏𝐂 with the degree constraint subset 𝐃𝐂𝐏𝐂 such that the following are true:

  1. 1.

    Bounds based on degree constraints are asymptotically sub-optimal, i.e.

    supI𝐏𝐂|QI(𝐙)|=o(CBComb(Q,𝐃𝐂))=o(supI𝐃𝐂|QI(𝐙)|).
  2. 2.

    There is an algorithm that enumerates QI for instances I𝐏𝐂 in time O(supI𝐏𝐂|QI(𝐙)|).

  3. 3.

    No VAAT algorithms can enumerate QI for instances I𝐏𝐂 in time O(supI𝐏𝐂|QI(𝐙)|).

To prove these claims, we consider the hexagon query (also depicted in Figure 4)

Q(A,B,C,U,V,W)R1(A,W,B)R2(B,U,C)R3(C,V,A)R4(U,V,W)

and impose the following set of PCs on the relations:

DCR1(AW,AWB,1), DCR1(WB,AWB,1), CCR1(n),CCR2(n)
DCR2(BU,BUC,1), DCR2(UC,BUC,1), CCR3(n),CCR4(n),
DCR3(CV,CVA,1), DCR3(VA,CVA,1), PCR4({U,V,W},UVW,1).

We denote the whole set as PC and the subset of DCs as DC. We now prove the theorem’s first claim. That is, the combinatorics bound on Q is super linear when only considering DC, while there are only a linear number of answers to Q over any database satisfying PC. We begin by providing a lower bound on the combinatorics bound of Q.

Lemma 11.

The combinatorics bound of Q based on 𝐃𝐂 is in Ω(n43).

Proof Sketch..

It suffices to provide a collection of databases such that IDC and |QI|=Ω(n43) for I. To accomplish this, we introduce a new relation RX,Y,Z(X,Y,Z) with |dom(X)|=|dom(Z)|=n23 and |dom(Y)|=n13. Intuitively, think of RX,Y,Z as a bipartite graph from the domain of X to the domain of Z where Y identifies the edge for a given xdom(X) or zdom(Z). Thus, every xdom(X) is connected to n13 neighbors in dom(Z) and, due to symmetry, also the other way around.

Therefore, the constraints DC(XY,XYZ,1), DC(YZ,XYZ,1), and CC(n) are satisfied over RX,Y,Z. Thus, we can use a relation of this type for R1,R2,R3. Concretely, we use this relation in the following way: R1=RA,W,B,R2=RB,U,C,R3=RC,V,A. Thus, for each (n23 many) adom(A) there are n13 many matching bdom(B) and possibly up to n13 many matching cdom(C). Thus, in total, there may be up to n43 answers to R1R2R3. To accomplish this also for Q, we only have to make sure that the variables U,V,W also join in R4. For that, we simply set R4=dom(U)×dom(V)×dom(W). This relation then satisfies its cardinality constraint. (Note that it does not satisfy its PC.)

We now provide an algorithm (Algorithm 1) that enumerates Q in linear time for databases with the PC on R4. This proves that the output size is linear, simultaneously completing our proof of claim 1 and claim 2. Algorithm 1 first decomposes R4 into three parts with one DC on each part. For this, we apply a linear time greedy partitioning algorithm (for more details see Algorithm 2) and show that it results in partitions whose constraints are within a factor of 3 from the optimal PC. Then, for each part, a variable order is selected to take advantage of all DCs. As an example, for the part R4W(U,V,W), there are at most 3 matching (u,v)dom(U,V) pair for each value of wdom(W). Thus, starting with a tuple (a,w,b) of R1, we can use this fact to determine these values for u,v and then combine this with DCR2(BU,BUC,1) to determine the unique value for c. By this reasoning, all of the inner for-loops iterate over a single element or 3 pairs of elements. Thus, the nested loops are linear in their total runtime. We defer the formal proof to the technical report [8].

Algorithm 1 Linear Hexagon Algorithm.
1:R4U,R4V,R4Wdecompose(R4,{U,V,W},UVW)
2: DCR4U(U,UVW,3),DCR4V(V,UVW,3),DCR4W(W,UVW,3)
3:for (a,w,b)R1 do
4:  for (u,v)πU,VσW=wR4W do
5:   for c(πCσB=bU=uR2πCσA=aV=vR3) do
6:     output (a,b,c,u,v,w)      
7:for (b,u,c)R2 do
8:  for (v,w)πV,WσU=uR4U do
9:   for a(πAσB=bW=wR1πAσC=cV=vR3) do
10:     output (a,b,c,u,v,w)      
11:for (c,v,a)R3 do
12:  for (u,w)πU,WσV=vR4V do
13:   for b(πBσA=aW=wR1πBσC=cU=uR2) do
14:     output (a,b,c,u,v,w)      
Lemma 12.

Algorithm 1 enumerates QI in time O(n) for databases I𝐏𝐂.

Lemma 11 and Lemma 12 together prove the first two claims of Theorem 10. This shows that PCs have an asymptotic effect on query bounds and that we can take advantage of PCs to design new WCOJ algorithms to meet these bounds. Nevertheless, one might wonder whether the variable elimination idea of established WCOJ algorithms can already meet the improved bound and, in fact, achieve optimal runtimes. Proving the third claim in Theorem 10, we show that they cannot and, thus, the new techniques have to be employed. Specifically, we show that VAAT algorithms (Definition 5) require time Ω(n1.5) to compute Q on database instances satisfying the PCs.

Lemma 13.

VAAT algorithms require time Ω(n1.5) to enumerate QI for databases I𝐏𝐂.

Proof Sketch..

It suffices to provide a collection of databases such that IPC and maxi|QiI|=Ω(n1.5) for databases I and arbitrary ordering of the variables. To that end, we introduce two relations, a relation CX,Y,Z(X,Y,Z) and a set of disjoint paths PX,Y,Z(X,Y,Z). For PX,Y,Z(X,Y,Z), the domains of X,Y,Z are of size Θ(n) and PX,Y,Z simply matches X to Y and Z such that each ddom(X)dom(Y)dom(Z) appears in exactly one tuple of PX,Y,Z. On the other hand, think of CX,Y,Z as a complete bipartite graph from the domain of X to the domain of Y and Z uniquely identifies the edges. Thus, |dom(X)|=|dom(Y)|=Θ(n) while |dom(Z)|=Θ(n). Notice that for both relations, DC(XY,XYZ,1),DC(Z,XYZ,1) hold. I.e., any pair of variables determine the last variable and there is a variable that determines the whole tuple on its own.

Consequently, the disjoint union of relations C and P multiple times (with permutated versions of C), e.g.,

R(X,Y,Z)=CX,Y,Z(X,Y,Z)CY,Z,X(Y,Z,X)PX,Y,Z(X,Y,Z),

satisfies PCR({X,Y,Z},XYZ,1) and DC(S1S2,XYZ,1) for any S1S2XYZ.

Thus, we can set R1,R2,R3,R4 to be the disjoint union of P and all permutations of the relation C. Now, let X1,,X6 be an arbitrary variable order for Q. Then, a VAAT algorithm based on this variable order at least needs to compute the sets:

iπX1Ri,iπX1X2Ri,iπX1X3Ri,iπX1X4Ri,iπX1X5Ri,iπX1X6Ri.

Let us consider the set iπX1X4Ri. There are two cases:

Case 1:

X5 and X6 appear conjointly in a relation. Due to the symmetry of the query and the database, we can assume w.l.o.g, X5X6=UV and iπX1X4Ri=iπABCWRi. Furthermore, πABWCA,B,WπABWR1, πBCCB,C,UπBCR2, πACCA,C,VπACR3,πWPU,V,WπWR4. Thus, intuitively, for at least Ω(n) elements adom(A) there are Ω(n) elements bdom(B) and Ω(n) elements cdom(C) that all join, and for each pair a,b there is an element wdom(W) that fits. In total, |iπABCWRi|=Ω(n1.5).

Case 2:

X5 and X6 do not appear conjointly in a relation. Due to the symmetry of the query and the database, we can assume w.l.o.g, X5X6=AU and iπX1X4Ri =iπBCVWRi. Furthermore, πBWCB,W,AπBWR1, πBCCB,C,UπBCR2, πCVCC,V,AπCVR3,πVWCV,W,UπVWR4. Thus, intuitively, for at least Ω(n) elements bdom(B) there are Ω(n) elements wdom(W), Ω(n) elements vdom(V) and, Ω(n) elements cdom(C) that all join. In total, |iπBCVWRi|=Ω(n2).

5 Partition Constraints for General Conjunctive Queries

In the following, we extend the ideas of Section 4 to an arbitrary full conjunctive queries Q(𝐙)R1(𝐙1)Rk(𝐙k) and an arbitrary set of partition constraints 𝐏𝐂={PCP1(𝒳1,𝐘1,d1),,PCPl(𝒳l,𝐘l,dl)}. Recall, Algorithm 1 proceeds by decomposing R4 in accordance with the PC and then, executes a VAAT style WCOJ algorithm over the decomposed instances. We proceed in the same way and start by concentrating on decomposing relations. After partitioning the relations, we show how to lift DC-based techniques for bounding and enumerating conjunctive queries to PCs.

5.1 Computing Constraints and Partitions

To take advantage of PCs, we need to be able to decompose an arbitrary relation R(Z) according to a given partition constraint PC(𝒳,Y,d). For this task, we propose two poly-time algorithms; a linear approximate algorithm and a quadratic exact algorithm. Crucially, these algorithms do not need d to be computed beforehand, so these algorithms can also be used to compute PC constraints themselves, i.e. to compute the value of PC(𝒳,Y). We start with the faster approximation algorithm before describing the exact algorithm.

Concretely, Algorithm 2 partitions a relation R(Z) by distributing the tuples from the relation to partitions in a greedy fashion. At each point, it selects the set of variables X𝒳 and particular value xπXR which occurs in the fewest tuples in the relation R. It then adds those tuples to the partition R𝐗 and deletes them from the relation R. Intuitively, high degree pair (X,x) will be distributed to partitions late in this process. At this point, most of the matching tuples will already have been placed in different partitions. Formally, we claim the following runtime and approximation guarantee for Algorithm 2.

Algorithm 2 Approximate Decomposition Algorithm.
1:decompose(R,𝒳,Y)
2:for X𝒳 do
3:  RX
4:while R is not empty do
5:  X,xargminX𝒳,xπXR|πYσX=xR|
6:  RXRXσX=xR
7:  RRσX=xR
8:return (RX)X𝒳,maxX𝒳DCRX(X,Y)
Theorem 14.

For a relation R(𝐙) and subsets 𝐘𝐙,𝒳2𝐘, Algorithm 2 computes a partitioning 𝐗𝒳R𝐗=R in time O(|R|) (data complexity) such that

DCR𝐗(𝐗,𝐘,|𝒳|d)

holds for every 𝐗𝒳 where d=PC(𝒳,𝐘).

Proof Sketch..

We start by providing intuition for the linear runtime. Each iteration of the while loop (line 4) places a set of tuples in a partition (line 6) and removes them from the original relation (line 7). Both of these operations can be done in constant time per tuple, so we simply need to show that we can identify the lowest degree attribute/value pair in constant time each iteration. This is done by creating a priority queue structure for each 𝐗𝒳 where priority is equal to degree, and we begin by adding each tuple in R to each priority queue. Because the maximum degree is less than |R|, we can construct these queues in linear time using bucket sort. We will then decrement these queues by 1 each time a tuple is removed from R. While arbitrarily changing an element’s priority typically requires O(log(|R|)) in a priority queue, we are merely decrementing by 1 which is a local operation that can be done in constant time. So, construction and maintenance of these structures is linear w.r.t. data size. We can then use these queues to look up the lowest degree attribute/value pair in constant time.

Next, we prove the approximation guarantee by contradiction. If the algorithm produces a partition R𝐗 with DCR𝐗(𝐗,𝐘)>|𝒳|d, then there must be some value 𝐱π𝐗R𝐗 where |π𝐘σ𝐗=𝐱R𝐗|>|𝒳|d. At the moment before this value was inserted into R𝐗 and deleted from R, all attribute/value pairs must have had degree at least |𝒳|d in the current state of R which we denote R𝒜. Through some algebraic manipulation, we show that this implies |R𝒜|>𝐗𝒳|π𝐗R𝒜|d. On the other hand, we know that R𝒜 respects the original partition constraint because R𝒜R, and we show that this implies the converse |R𝒜|𝐗𝒳|π𝐗R𝒜|d. This is a contradiction, so our algorithm must not produce a poor approximation in the first place.

Next, we describe an exact algorithm that requires quadratic time. Intuitively, Algorithm 3 also computes a decomposition of R in a greedy fashion by iteratively allocating (groups of) tuples y0 of πYR to partitions RX, preferring allocations to partitions where the maximum over the relevant degree constraints, i.e., maxXDCRX(X,Y), does not increase. However, decisions greedily made at the start may be sub-optimal and may not lead to a decomposition that minimizes maxXDCRX(X,Y). To overcome this, instead of simply allocating y0 to a partition, the algorithm also checks whether it is possible to achieve a better overall decomposition by reallocating some other tuples in a cascading manner. To that end, we look for elements y1πYRX1,,ymπYRXm and a further Xm+1 such that for all yi,i=1,,m, the tuples matching yi can be moved from RXi to RXi+1 and the tuples matching y0 can be added to RX1, all without increasing maxXDCRX(X,Y). To achieve this, yi is selected such that it matches yi1 on the variables Xi. Thus, for each RXi, the value of DCRXi(X,Y) is the same before and after the update. There only has to be space for ym in the final relation RXm+1.

The sequence (y1,,ym,X1,,Xm+1) constitutes an augmenting path which was first introduced by [11] and used for matroids. Adapted to the present setting, we define an augmenting path as below. By slight abuse of notation, we write σX=yR even though y fixes more variables than specified in X. Naturally, this is meant to select those tuples of R that agree with y on the variables X.

Definition 15.

Let (R𝐗)𝐗𝒳 be pairwise disjoint subsets of some relation R(𝐙) with 𝐘𝐙,𝒳2𝐘, and let 𝐲0π𝐘Rπ𝐘𝐗𝒳R𝐗 be a new tuple. An augmenting path (𝐲1,,𝐲m,𝐗1,,𝐗m+1) satisfies the following properties:

  1. 1.

    For all i{1,,m+1}:𝐗i𝒳.

  2. 2.

    For all i{1,,m}:𝐲iπ𝐘R𝐗i.

  3. 3.

    For all i{1,,m}:𝐲i agrees with 𝐲i1 on 𝐗i.

  4. 4.

    |π𝐘σ𝐗m+1=𝐲mR𝐗m+1|<max𝐗DCR𝐗(𝐗,𝐘).

We omit the references to (R𝐗)𝐗𝒳, 𝐘, and 𝐲0 when they are clear from the context.

The next theorem shows that Algorithm 3 correctly computes an optimal decomposition.

Algorithm 3 Exact Decomposition Algorithm.
1:decompose(R,𝒳,Y)
2:d0
3:for X𝒳 do
4:  RX
5:for y0πYR do
6:  if there exists a shortest augmenting path (y1,,ym,X1,,Xm+1)  then
7:   for i=m,,1 do
8:     RXi+1RXi+1σY=yiRXi
9:     RXiRXiσY=yiRXi    
10:   RX1RX1σY=y0R
11:  else
12:   dd+1
13:   RXRXσY=y0R X𝒳 can be selected arbitrarily here.   
14:  RRσY=y0R
15:return (RX)X𝒳,d

Theorem 16.

For a relation R(𝐙) and subsets 𝐘𝐙,𝒳2𝐘, Algorithm 3 computes a partitioning 𝐗𝒳R𝐗=R in O(|R|2) time (data complexity) such that

DCR𝐗(𝐗,𝐘,d)

holds for every 𝐗𝒳 where d=PC(𝒳,𝐘).

Proof Sketch..

The intuition for the algorithm’s quadratic runtime boils down to ensuring that the search for an augmenting path is linear in |R|. To show that this is the case, we model the search for an augmenting path as a breadth-first search over a bipartite graph whose nodes correspond to full tuples 𝐲π𝐘R and the partial tuples 𝐱π𝐗R for all 𝐗𝒳. An edge exists between a tuple 𝐲 and a partial tuple 𝐱 if they agree on their shared attributes. This search starts from the new tuple 𝐲0 and completes when it finds a tuple 𝐲m that can be placed in one of the relations R𝐗 without increasing its DC. The number of edges and vertices in this graph is linear in the input data, so the breadth-first search is linear as well.

We now provide intuition for the algorithm’s correctness. Suppose that we are partway through the algorithm and are now at the iteration where we add 𝐲0 to a partition. Further, let R𝒜 be the set of tuples which have been added so far, including 𝐲0. Because there exists an optimal partitioning of R𝒜, we should be able to place 𝐲0 in the partition where it exists in the optimal partitioning. If we cannot, then a tuple in that partition with the same X-value must not be in its optimal partition. We identify one of these tuples and move it to its optimal partition. We continue this process inductively of shifting one tuple at a time to its optimal partition until one of these shifts no longer violates the PC. The sequence of shifts that we have performed constitutes an augmenting path by definition, and its existence implies that we would not violate the PC in this iteration by incrementing d past it. This construction process must end in a finite number of moves because each step increases the number of tuples placed in their optimal partitioning. If all tuples are in their optimal partition, the final shift must not have violated the PC due to the optimal partition’s definition.

5.2 Lifting DC-Based Bounds and Algorithms to PCs

We now apply the developed decomposition algorithms to the general case and show how to use WCOJ algorithms as a black box to carry over guarantees for DCs to the general case of PCs. First, we extend the definition of an arbitrary cardinality bound CB defined over sets of DCs to sets of PCs.

Definition 17.

Let CB be a cardinality bound. Then, we extend CB to PCs by setting

CB(Q,𝐏𝐂) :=𝐗1𝒳1,,𝐗l𝒳lCB(Q,{DCP1(𝐗1,𝐘1,d1),,DCPl(𝐗l,𝐘l,dl)}),

where 𝐏𝐂={PCPi(𝒳i,𝐘i,di)i} is an arbitrary set of partition constraints.

Note that the bound in Definition 17 is well-defined: If 𝐏𝐂 is simply a set of DCs, the extended version of the cardinality bound CB coincides with its original definition. If 𝐏𝐂 is an arbitrary set of PCs, then it remains a valid bound on the size of the join.

Proposition 18.

Let CB(Q,𝐏𝐂) be an extended cardinality bound. Then,

|QI|CB(Q,𝐏𝐂)I𝐏𝐂.

Proof.

Let I be a database satisfying PC={PCPi(𝒳i,𝐘i,di)i=1,,l} and QR1(Z1)Rk(Zk). Thus, for each Pi there is a partitioning Pi=j=1|𝒳i|Pij with DCPij(Xij,Yi,di) and 𝒳i={Xij|j=1,,|𝒳i|}. Now, let us now fix some j1{1,, |𝒳1|},, jl{1,,|𝒳l|}. Furthermore, for each i{1,,l} let s(i){1,,k} be the relation Rs(i)=Pi. Set Rsj1jl=i:s=s(i)Piji for all s{1,,k}. Then consider Qj1jl=R1j1jlRkj1jl. We claim two things:

  1. 1.

    Qj1jl partitions QI, i.e., QI=j1=1|𝒳1|jl=1|𝒳l|Qj1jl, and

  2. 2.

    |Qj1jl|CB(Q,{DCP1(X1j1,𝐘1,d1),,DCPl(Xljl,𝐘l,dl)}).

For the first bullet point, let tQI. Clearly, for each i{1,,l} there exists exactly one ji such that t agrees with an element in Piji(Zs(i)) on the variables Zs(i). Thus, tQj1jl.

For the second bullet point, consider the relations Piji. These are supersets of the relations Rs(i)j1jl and, therefore, we can assert DCRs(i)j1jl(Xiji,Yi,di). Viewed as a query, Qj1jl has the same form as Q. Hence, |Qj1jl|CB(Q,{DCP1(X1j1,𝐘1,d1),,DCPl(Xljl,𝐘l,dl)}).

Crucially, this upper bound is not loose; it preserves the tightness of any underlying DC-based bound. Specifically, the extended version of the combinatorics bound CBComb is asymptotically close to the actual worst-case size of the join, with the constant depending on the query. For example, the extended version of combinatorics bound is O(n) for the query Q (see Section 4) when using all PCs while the combinatorics bound based on the DCs alone was Ω(n43).

Proposition 19.

Let CBComb(Q,𝐏𝐂) be the extended version of the combinatorics bound CBComb. Then,

CBComb(Q,𝐏𝐂)=O(maxI𝐏𝐂|QI|).

Proof.

Let X1𝒳1,,Xl𝒳l be such that CBComb(Q,DC) is maximized where DC:={DCP1(X1, 𝐘1,d1),, DCPl(Xl,𝐘l,dl)}. Thus, there exists a database I such that IDC and |QI|=CBComb(Q,DC). Furthermore, I must then also trivially satisfy PC by definition. For each PC on Pi the witnessing partitioning is simply Pi=Pi. Therefore,

CBComb(Q,𝐏𝐂)|𝒳1||𝒳l||QI|=O(maxD𝐏𝐂|QI|).

For the last equality, note that |𝒳1||𝒳l| is a query-dependent constant as we assume all PCs to be on different variables 𝒳i.

Next, we show how algorithms that are worst-case optimal relative to a cardinality bound can likewise be adapted and become worst-case optimal relative to the extended bound. In this way, progress on WCOJ algorithms based on DCs immediately leads to improved algorithms that take advantage of PCs.

Theorem 20.

Given a cardinality bound CB𝒜. If there exists a join enumeration algorithm 𝒜 which is worst-case optimal relative to CB𝒜, then there exists an algorithm 𝒜 which is worst-case optimal relative to the extended version of the cardinality bound. I.e., for fixed query Q, 𝒜 runs in time O(|I|+CB𝒜(Q,𝐏𝐂)) for arbitrary 𝐏𝐂 and database I𝐏𝐂.

Proof.

Suppose we have a query QR1(Z1)Rk(Zk), a set of partition constraints 𝐏𝐂={PCP1(𝒳1,𝐘1,d1),,PCPl(𝒳l,𝐘l,dl)}, and a database IPC. We can follow the same idea already used in the proof of Proposition 18. Concretely, we partition each Pi into (Pij)j=1,,|𝒳i|. For this, we use Algorithm 2 and Theorem 14. Thus, we get DCPij(Xij,Yi,|𝒳i|di). Let α:=maxi|𝒳i|.

We can now continue following the idea of proof of Proposition 18 up to the two claims where we only need the first. Now, instead of bounding the size of Qj1,,jl, we now want to compute each subquery using 𝒜. Thus, note that DCRs(i)j1jl(Xiji,Yi,αdi). This implies that 𝒜 runs in time O(|I|+CB𝒜(Q,{DCPi(Xiji,Yi,αdi)i})). The constant α can be hidden in the O-notation while summing up the time required for each Qj1,,jl results in an overall runtime of O(|I|+X1𝒳1Xl𝒳lCB𝒜(Q,{DCPi(Xiji,Yi,di)i})=O(|I|+CB𝒜(Q,PC)).

For example, PANDA is a WCOJ algorithm relative to the polymatroid bound, and we can use this approach to translate it to an optimal algorithm for the extended polymatroid bound. While it is an open problem to produce a WCOJ algorithm relative to CBComb(Q,𝐃𝐂), any such algorithm now immediately results in a WCOJ algorithm relative to CBComb(Q,𝐏𝐂). Combined with Proposition 19 this implies that such an algorithm then only takes time relative to the worst-case join size of instances that satisfy the same set of PCs.

Corollary 21.

If there exists a WCOJ algorithm relative to CBComb(Q,𝐃𝐂), then there exists an WCOJ algorithm relative to CBComb(Q,𝐏𝐂).

6 Conclusions and Future Work

In this work, we introduced PCs as a generalization of DCs, uncovering a latent structure within relations and that is present in standard benchmarks. PCs enable a more refined approach to query processing, offering asymptotic improvements to both cardinality bounds and join algorithms. We presented algorithms to compute PCs and identify the corresponding partitioning that witness these constraints. To harness this structure, we then developed techniques to lift both cardinality bounds and WCOJ algorithms from the DC framework to the PC framework. Crucially, our use of DC-based bounds and algorithms as black boxes allows future advances in the DC setting to be seamlessly integrated into the PC framework.

On the practical side, future research should explore when and where it is beneficial to leverage the additional structure provided by PCs. In particular, finding ways to minimize the constant factor overhead by only considering a useful subset of PCs or sharing work across evaluations on different partitions could yield significant practical improvements in query performance. On the other hand, further theoretical work should try to incorporate additional statistics into this partitioning framework, e.g., lp-norms of degree sequences. Ultimately, the goal of this line of work is to capture the inherent complexity of join instances through both the structure of the query and the data.

References

  • [1] Christopher R. Aberger, Andrew Lamb, Susan Tu, Andres Nötzli, Kunle Olukotun, and Christopher Ré. Emptyheaded: A relational engine for graph processing. ACM Trans. Database Syst., 42(4):20:1–20:44, 2017. doi:10.1145/3129246.
  • [2] Albert Atserias, Martin Grohe, and Dániel Marx. Size bounds and query plans for relational joins. SIAM Journal on Computing, 42(4):1737–1767, 2013. doi:10.1137/110859440.
  • [3] Suman K. Bera, Lior Gishboliner, Yevgeny Levanzov, C. Seshadhri, and Asaf Shapira. Counting subgraphs in degenerate graphs. J. ACM, 69(3):23:1–23:21, 2022. doi:10.1145/3520240.
  • [4] Suman K. Bera, Noujan Pashanasangi, and C. Seshadhri. Linear time subgraph counting, graph degeneracy, and the chasm at size six. In Thomas Vidick, editor, 11th Innovations in Theoretical Computer Science Conference, ITCS 2020, January 12-14, 2020, Seattle, Washington, USA, volume 151 of LIPIcs, pages 38:1–38:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPICS.ITCS.2020.38.
  • [5] Suman K. Bera, Noujan Pashanasangi, and C. Seshadhri. Near-linear time homomorphism counting in bounded degeneracy graphs: The barrier of long induced cycles. In Dániel Marx, editor, Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021, Virtual Conference, January 10 - 13, 2021, pages 2315–2332. SIAM, 2021. doi:10.1137/1.9781611976465.138.
  • [6] Suman K. Bera and C. Seshadhri. How the degeneracy helps for triangle counting in graph streams. In Dan Suciu, Yufei Tao, and Zhewei Wei, editors, Proceedings of the 39th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 2020, Portland, OR, USA, June 14-19, 2020, pages 457–467. ACM, 2020. doi:10.1145/3375395.3387665.
  • [7] Marco Bressan and Marc Roth. Exact and approximate pattern counting in degenerate graphs: New algorithms, hardness results, and complexity dichotomies. In 62nd IEEE Annual Symposium on Foundations of Computer Science, FOCS 2021, Denver, CO, USA, February 7-10, 2022, pages 276–285. IEEE, 2021. doi:10.1109/FOCS52979.2021.00036.
  • [8] Kyle Deeds and Timo Camillo Merkl. Partition constraints for conjunctive queries: Bounds and worst-case optimal joins [technical report], 2025. arXiv:2501.04190.
  • [9] Kyle Deeds, Dan Suciu, Magda Balazinska, and Walter Cai. Degree sequence bound for join cardinality estimation. In Floris Geerts and Brecht Vandevoort, editors, 26th International Conference on Database Theory, ICDT 2023, March 28-31, 2023, Ioannina, Greece, volume 255 of LIPIcs, pages 8:1–8:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.ICDT.2023.8.
  • [10] Kyle B. Deeds, Dan Suciu, and Magdalena Balazinska. Safebound: A practical system for generating cardinality bounds. Proc. ACM Manag. Data, 1(1):53:1–53:26, 2023. doi:10.1145/3588907.
  • [11] Jack Edmonds. Minimum partition of a matroid into independent subsets. J. Res. Nat. Bur. Standards Sect. B, 69:67–72, 1965.
  • [12] Michael J. Freitag, Maximilian Bandle, Tobias Schmidt, Alfons Kemper, and Thomas Neumann. Adopting worst-case optimal joins in relational database systems. Proc. VLDB Endow., 13(11):1891–1904, 2020. URL: http://www.vldb.org/pvldb/vol13/p1891-freitag.pdf.
  • [13] Lior Gishboliner, Yevgeny Levanzov, Asaf Shapira, and Raphael Yuster. Counting homomorphic cycles in degenerate graphs. ACM Trans. Algorithms, 19(1):2:1–2:22, 2023. doi:10.1145/3560820.
  • [14] Georg Gottlob, Stephanie Tien Lee, Gregory Valiant, and Paul Valiant. Size and treewidth bounds for conjunctive queries. J. ACM, 59(3):16:1–16:35, 2012. doi:10.1145/2220357.2220363.
  • [15] Martin Grohe and Dániel Marx. Constraint solving via fractional edge covers. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, January 22-26, 2006, pages 289–298. ACM Press, 2006. URL: http://dl.acm.org/citation.cfm?id=1109557.1109590.
  • [16] Yuxing Han, Ziniu Wu, Peizhi Wu, Rong Zhu, Jingyi Yang, Liang Wei Tan, Kai Zeng, Gao Cong, Yanzhao Qin, Andreas Pfadler, Zhengping Qian, Jingren Zhou, Jiangneng Li, and Bin Cui. Cardinality estimation in DBMS: A comprehensive benchmark evaluation. Proc. VLDB Endow., 15(4):752–765, 2021. doi:10.14778/3503585.3503586.
  • [17] Mahmoud Abo Khamis, Vasileios Nakos, Dan Olteanu, and Dan Suciu. Join size bounds using lp-norms on degree sequences. Proc. ACM Manag. Data, 2(2):96, 2024. doi:10.1145/3651597.
  • [18] Mahmoud Abo Khamis, Hung Q. Ngo, and Dan Suciu. Computing join queries with functional dependencies. In Tova Milo and Wang-Chiew Tan, editors, Proceedings of the 35th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 2016, San Francisco, CA, USA, June 26 - July 01, 2016, pages 327–342. ACM, 2016. doi:10.1145/2902251.2902289.
  • [19] Mahmoud Abo Khamis, Hung Q. Ngo, and Dan Suciu. What do shannon-type inequalities, submodular width, and disjunctive datalog have to do with one another? 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 429–444. ACM, 2017. doi:10.1145/3034786.3056105.
  • [20] Viktor Leis, Andrey Gubichev, Atanas Mirchev, Peter A. Boncz, Alfons Kemper, and Thomas Neumann. How good are query optimizers, really? Proc. VLDB Endow., 9(3):204–215, 2015. doi:10.14778/2850583.2850594.
  • [21] Hung Q. Ngo, Ely Porat, Christopher Ré, and Atri Rudra. Worst-case optimal join algorithms: [extended abstract]. In Michael Benedikt, Markus Krötzsch, and Maurizio Lenzerini, editors, Proceedings of the 31st ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2012, Scottsdale, AZ, USA, May 20-24, 2012, pages 37–48. ACM, 2012. doi:10.1145/2213556.2213565.
  • [22] Hung Q. Ngo, Christopher Ré, and Atri Rudra. Skew strikes back: new developments in the theory of join algorithms. SIGMOD Rec., 42(4):5–16, 2013. doi:10.1145/2590989.2590991.
  • [23] Shixuan Sun and Qiong Luo. In-memory subgraph matching: An in-depth study. In David Maier, Rachel Pottinger, AnHai Doan, Wang-Chiew Tan, Abdussalam Alawini, and Hung Q. Ngo, editors, Proceedings of the 2020 International Conference on Management of Data, SIGMOD Conference 2020, online conference [Portland, OR, USA], June 14-19, 2020, pages 1083–1098. ACM, 2020. doi:10.1145/3318464.3380581.
  • [24] Todd L. Veldhuizen. Triejoin: A simple, worst-case optimal join algorithm. In Nicole Schweikardt, Vassilis Christophides, and Vincent Leroy, editors, Proc. 17th International Conference on Database Theory (ICDT), Athens, Greece, March 24-28, 2014, pages 96–106. OpenProceedings.org, 2014. doi:10.5441/002/ICDT.2014.13.
  • [25] Yisu Remy Wang, Max Willsey, and Dan Suciu. Free join: Unifying worst-case optimal and traditional joins. Proc. ACM Manag. Data, 1(2):150:1–150:23, 2023. doi:10.1145/3589295.