Abstract 1 Introduction 2 Definitions 3 Precedence Graphs and Canonical Schedules 4 Time Complexity 5 Instance Optimal Scheduling 6 Worst-Case Optimal Scheduling 7 Related Work 8 Discussion References Appendix A Enumeration Scheduling Appendix B Missing Proofs for Section 3 Appendix C Missing Proofs for Section 4

Bounding the Makespan of Transaction Schedules

Tim Baccaert ORCID Software Languages Lab, Vrije Universiteit Brussel, Belgium Brecht Vandevoort ORCID UHasselt, Data Science Institute, ACSL, Diepenbeek, Belgium Bas Ketsman ORCID Software Languages Lab, Vrije Universiteit Brussel, Belgium
Abstract

The performance of transactional database systems is typically evaluated by measuring the amount of transactions they can commit to the database per second. However, fairly measuring this for the same workload on different systems is not trivial. It is therefore relevant to formalize schedule efficiency, investigate the space of all possible efficient schedules, and identify whether there is any room for improvement. Prior transaction theory largely centers on decision problems relating to safety, such as the serializability, robustness, and allocation problems. Most pertinently, these problems take already scheduled transactions as input, and do not directly consider the efficiency of those schedules.

In this work, we define schedules as assignments of operations on objects to discrete points in time. This allows us to quantify efficiency as the elapsed duration between the schedule’s beginning and end, more commonly known as the makespan in the scheduling literature. We establish that, given some set of transactions and a desired makespan, it is NP-complete to decide if there exists a conflict serializable schedule which is bounded by that makespan. We additionally provide an instance optimal algorithm for scheduling transaction sets with a single contention point, that is, exactly one object may appear in conflicting operations. Lastly, we give worst-case optimal bounds on the makespan, meaning that schedules can never exceed this bound, and for the worst transaction sets, the bound is optimal.

Keywords and phrases:
Transactions, Scheduling, Discrete Optimization, Complexity
Copyright and License:
[Uncaptioned image] © Tim Baccaert, Brecht Vandevoort, and Bas Ketsman; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Discrete optimization
; Information systems Database transaction processing
Funding:
This work is partly funded by FWO-grant G019921N.
Editors:
Balder ten Cate and Maurice Funk

1 Introduction

Transaction processing is a core aspect of every database system. In most systems it is implemented through concurrency control, a set of principled protocols which orchestrate access to resources shared by multiple threads of execution. In the database systems literature, this aspect of the system is evaluated by measuring its throughput, or the amount of transactions it can commit to the database per second, on various predetermined workloads such as YCSB [7] or TPC-C [8]. Reliably executing the same workload on different systems is not always evident, as is demonstrated by numerous papers attempting to make this evaluation method less biased [1, 10, 26, 33, 34]. As database theorists, it is therefore pertinent for us to consider a formal theory of schedule efficiency, to investigate the space of all possible efficient schedules, and to identify whether there is room for improvement.

The current theory about transactions largely centers around safety properties [18, 23], and we elaborate on this work’s relation to this literature in Section 7. In its most elementary form, safety is about deciding if a given schedule is valid according to a definition of validity, the gold standard being conflict serializability. In other words, the main purpose is to delineate the space of schedules that is valid. In this work, we are concerned with identifying the space of optimal schedules within that space of valid ones.

Concretely, we formalize schedules as assignments of all operations in a set of transactions to positive integers, intuitively representing their point of execution in time. This enables us to explicitly reason about operations that run in parallel, rather than observing the total order of operations after execution has taken place. Moreover, it lets us quantify efficiency as the elapsed duration between a schedule’s beginning and end, a quantity better known in the scheduling literature as the makespan [4, 25].

Contributions

We focus on two central questions, the first being: “What is the complexity of finding a conflict serializable schedule of minimal makespan?”. To this extent, we contribute the following results.

  1. 1.

    In Section 3, we show that the schedules with minimal makespan are among those constructed from a total order on the transactions. Hence, we can find a minimal makespan schedule in factorial time by enumerating all total orders on the given transactions.

  2. 2.

    Next, in Section 4, we show that for a set of transactions and a positive integer k, it is NP-complete to decide if there exists a schedule with a makespan less than or equal to k.

  3. 3.

    In Section 5, we give a polynomial time instance optimal scheduling algorithm for transaction sets with at most one object on which operations are allowed to be conflicting.

Second, we handle a complementary question: “Is there a bound on the optimal makespan?”. To this end, we provide the following contribution.

  1. 4.

    In Section 6, we derive worst-case optimal bounds on the makespan. That is, the makespan can never exceed this bound, and for the worst transaction sets, the bound is optimal. The upper bounds (excluding Proposition 27) imply algorithms that can generate schedules with a makespan matching this bound.

To enable this analysis, we group transaction sets into a class 𝕋,m,n based on the maximal number of operations in each transaction, the maximal number m of contention points (i.e., objects on which operations are allowed to be conflicting), and the maximal number n of transactions in the set. The derived bounds are given in Table 1.

Table 1: Summary of all worst-case optimal bounds for 𝕋,m,n in this work, with m. Bounds marked ( red) or ( green) are, upper (resp. lower) bounds without matching lower (resp. upper) bounds. For the bounds marked 𝐏 we have not given a tractable algorithm.

2 Definitions

For integers i and j, we write [i,j] as shorthand notation for {i,i+1,,j}, and write [i] as a shorthand for [1,i]. By 0 we denote the positive integers, including 0.

We fix an infinite set of objects 𝒪={a,b,c,}. A transaction T over 𝒪 is a sequence of operations T=o1o2o. We write |T| to mean the number of operations in T. To every operation oT we associate a type(o){R,W} and an obj(o)𝒪. We say that o is a read if type(o)=R and that it is a write if type(o)=W. Furthermore, we say that o is an operation on object obj(o).

For an integer i[], we write T[i] to denote the ith operation of T. That is, T[i]=oi. Slightly abusing notation, we will often treat transactions as sets of objects, allowing to write oT to mean that o is one of its operations. For two operations T[i],T[j] of T, we write T[i]TT[j] to mean ij, and T[i]<TT[j] to mean i<j. We will leave 𝒪 implicit when it can be derived from the context and say transaction T instead of transaction T over 𝒪.

When considering a set of transactions 𝒯, we will assume that every transaction has a unique id i, and we write Ti to make this id explicit. For notational convenience we assume that each transaction can read to each object at most once, and write to each object at most once. This is an assumption commonly made in other literature [18, 19, 30, 31], and the problems we consider become computationally more difficult if this is not the case. It also allows us to refer to a specific operation o in Ti𝒯, using the notation Ri[x] (resp., Wi[x]), with x=obj(o) and type(o)=R (resp., type(o)=W).

As usual, we say that two operations o and p occurring in transactions in 𝒯 are conflicting if they are from different transactions in 𝒯, and with obj(o)=obj(p) and W{type(o),type(p)}.

We define schedules as functions assigning integers to the operations of transactions, intuitively representing the timing of these operations.

Definition 1.

A schedule s for a set 𝒯 of transactions is a function s:Os0 that assigns a s(o)0 to all the operations oOs of transactions in 𝒯.

For notational convenience, we will sometimes represent a schedule for 𝒯 as a sequence of sets of operations A1A2Ak (with every operation of a transaction in 𝒯 occurring in precisely one of the sets Ai), which then should be interpreted as the schedule for 𝒯 with s(o)=i1 if oAi. In other words, the set Ai represents all operations that are executed at precisely time i.

Henceforth, we will only consider schedules having the next two additional properties:

  1. 1.

    for operations {o,p}T with o<Tp, we have s(o)<s(p);

  2. 2.

    for conflicting operations {o,p}Os we have s(o)<s(p) or s(p)<s(o).

Property (1) expresses that s must preserve the order in which operations occur in the transaction they belong to. Property (2) guarantees that conflicting operations are not executed at precisely the same time.

We call a schedule s dense if for every operation oOs, either s(o)=0 or there is an operation pOs with s(o)=s(p)+1 and either p conflicts with o or it is from the same transaction as o. In other words, a schedule is dense if none of its operations can be moved one time unit to the left without invalidating Property (1) or Property (2).

Example 2.

We define a set of transactions 𝒯={T1,T2,T3,T4}, where
T1=W1[a]R1[b];T2=W2[b]R2[d]W2[e];T3=W3[c]R3[d]W3[f]; and T4=W4[a]W4[b]W4[c].

We remark that usage of blind writes, or a write to an object without first reading to it within the same transaction, is not common in real-world transaction workloads. However, we use them to keep examples concise. One can always replace each write operation with a read followed by a write.

A possible schedule s1 for 𝒯 is:

s1(W4[a])=0s1(W4[b])=1s1(W4[c])=2s1(W1[a])=1s1(R1[b])=2s1(W2[b])=3
s1(R2[d])=4s1(W2[e])=5s1(W3[c])=3s1(R3[d])=4s1(W3[f])=5

We can represent schedules using a Gantt-chart, as seen in Figures 1(a) and 1(b).

(a) A schedule s1 for 𝒯.
(b) A schedule s2 for 𝒯.
Figure 1: Two different schedules for the same transaction set 𝒯. Time advances from left to right and is denoted at the top, and each row is a transaction. The operations oj within each transaction Ti𝒯 are denoted by rectangles colored according to their object.

We remark that this definition of schedules differs from most literature111[32] has a definition based on partial orders, but does not use them to reason about schedule efficiency., e.g. [11, 18, 19, 30, 31], which typically defines schedules as total orders on operations. We deviate from this because we need to reason about the specific length of a schedule s. Two operations o and p in Os that execute in parallel, that is s(o)=s(p) in our model, are usually reduced to a freely chosen order on {o,p} in the total order definition. Since the length of a schedule matters in our setting, we make this parallelism more explicit.

We are interested in precisely those schedules that maximally execute operations in parallel, while simultaneously exhibiting the same outcome as a schedule that executes each transaction one by one. We first define the latter condition, and then discuss what it means to maximally parallelize operations.

If a schedule s for 𝒯 executes transactions one by one we say it is serial. Formally, a schedule s is serial if it has no concurrent operations (i.e., for every pair of different operations o, p in Os, we either have s(o)<s(p) or s(p)<s(o)) and it is non-interleaving (i.e., for every pair of different transactions Ti, Tj in 𝒯, and every pair of different operations o,p in Ti, with s(o)<s(p) there is no qTj with s(o)<s(q)<s(p)).

If o conflicts with p and s(o)<s(p), then p depends on o in s, which is written as osp. We now define conflict serializable schedules, which formalizes one notion of what it means for a schedule to have the same outcome as a serial schedule.

Definition 3 (Papadimitriou [23]).

Let 𝒯 be a set of transactions and let s1 and s2 be schedules for 𝒯. Then, s1 is conflict equivalent to s2 if os1p implies os2p and vice versa, for all conflicting operations o and p in 𝒯. Furthermore, s1 is conflict serializable if there exists a serial schedule s3 for 𝒯 such that s1 is conflict equivalent to s3.

We can test whether a schedule s is serializable by creating a conflict graph for s, which is a directed graph CG(s)=(𝒯,E), where (Ti,Tj)E if there exists osp with oTi and pTj for distinct {Ti,Tj}𝒯. We can then apply the next textbook result to obtain a decision procedure.

Theorem 4 (Papadimitriou [23]).

A schedule s is conflict serializable if, and only if, CG(s) is a directed acyclic graph.

To be able to compare the efficiency of schedules, we associate every schedule with a cost that equals its makespan. The makespan of a schedule s is defined as

span(s)=max{s(o)+1oT,T𝒯}.

Intuitively, span(s) can be thought of as the completion time of the final operation in the given schedule.

Example 5.

Both the schedule s1 for 𝒯 from Example 2 and the schedule s2 for 𝒯 defined in Figure 1(b) are serializable. Namely, s1 is equivalent to a serial schedule which first executes T4, then T1 and T2, and finally T3. For s2 a possible equivalent serial schedule, is T2 followed by T3, then T4 and finally T1. The makespan of s1 is 6, while the makespan of s2 is 3. Hence, the more efficient schedule is s2.

3 Precedence Graphs and Canonical Schedules

We define the precedence graph Ps of a schedule s for some set 𝒯 of transactions as the directed graph Ps=(V,E) with V=Os and

E={(T[j],T[j+1])T𝒯,j[|T|1]}{(o,p)Os×Ososp}.

Further on in this paper, we will refer to the precedence graph PΣ. This is notation for the precedence graph of the unique dense serializable schedule for 𝒯 originating from a total order Σ=(𝒯,𝒯) on 𝒯. More formally one replaces {(o,p)Os×Ososp} in the above definition by all (o,p) such that oT, pT with {T,T}𝒯, TT and T𝒯T.

The following property follows directly from Theorem 4:

Corollary 6.

For a serializable schedule s for some set 𝒯 of transactions, the precedence graph Ps is acyclic and there is an order Σ=(𝒯,𝒯) such that Ps=PΣ.

Note that for schedules that are not serializable, the precedence graph must be cyclic.

Let us now denote for an acyclic directed graph G by max-path(G) the maximum number of nodes occurring in any directed path of G. Then, max-path(PΣ) for a totally ordered set of transactions Σ=(𝒯,𝒯) corresponds to the makespan of a particular schedule for 𝒯.

Definition 7.

The canonical schedule for Σ=(𝒯,𝒯) is defined as the schedule canonical(Σ)=A1A2Ak over 𝒯 with k=max-path(PΣ), and

Ai={p(o,p)E,oAj<i,pAj<i},

where Aj<i=j<iAj, and E is the set of directed edges in PΣ.

It is straightforward to verify that canonical schedules are dense by construction.

Next we will show that a minimal cost schedule can be found among the canonical schedules. For this, let cost(𝒯)=min{span(s)s is a serializable schedule for 𝒯}. The following corollary is immediate.

Proposition 8.

Let 𝒯 be a set of transactions.

  • For every serializable schedule s for 𝒯, we have that max-path(Ps)span(s). If s is dense, then span(s)=max-path(Ps).

  • There exists a total order Σ=(𝒯,𝒯) such that max-path(PΣ)=cost(𝒯).

  • There exists a total order Σ=(𝒯,𝒯) such that span(canonical(Σ))=cost(𝒯).

Notice that this implies cost(𝒯)=min{span(canonical(Σ))Σ is a total order for 𝒯}.

Example 9.

Let 𝒯 be the set of transactions from Example 2. Then, PΣ with Σ=(𝒯,{(Ti,Tj)ij}) is the precedence graph depicted in Figure 2. The longest path consists of edges (W4[a],W4[b])(W4[b],W4[c])(W4[c],W3[c])(W3[c],R3[d])(R3[d],W3[f]) and hence max-path(PΣ)=6. The canonical schedule for Σ equals schedule s1 from Example 2.

Figure 2: A visual depiction of a precedence graph defined in Example 9. Edges indicating the relative order of operations of the same transaction are given by dashed arrows and those indicating the order of conflicting operations are given by solid lines. A longest path is highlighted by a bold outline.

4 Time Complexity

Unfortunately, it is unlikely that there are tractable algorithms that find an optimal serialization order for arbitrary sets of transactions. In this section, we consider a decision variant222There exists an analog definition of NP-completeness for optimization problems called NPO-complete. One possible way to show membership in this class is precisely by showing that the decision problem we consider, often called the threshold problem, is an NP-complete decision problem [9, 15, 21]. of our scheduling problem asking for a set 𝒯 of transactions and number k if a serializable schedule s for 𝒯 exists with span(s)k and show that it is NP-complete.

Schedulability input: a set of transactions 𝒯 and positive integer k0. output: true if a serializable schedule s for 𝒯 with span(s)k exists; false otherwise.

By Proposition 8, we can also give a total order Σ for 𝒯 with span(canonical(Σ))k.

Theorem 10.

Schedulability is NP-complete.

First, we argue that Schedulability is straightforwardly in NP, because, if for 𝒯 and k a schedule s exists with span(s)k, then s trivially serves as polynomial-sized witness.

To show that Schedulability is NP-hard, we make a reduction from a simpler problem called 2-Orientability. For its definition, let G=(V,E) be an undirected graph and let V be a total order on its nodes. Then by OG(G,V) we denote the orientation of G based on V, that is, the directed graph with nodes V and with the directed edges {(u,v){u,v}E,uVv}. Now, 2-Orientability asks for an undirected graph G if there exists a total order V on the nodes in G such that the length (number of edges) of every directed path in OG(G,V) is at most 2.

2-Orientability input: an undirected graph G=(V,E). output: true if a total order V on V exists such that the length of the longest path in OG(G,V) is at most 2; false otherwise.

The next result follows from the Gallai-Roy-Vitaver Theorem [5].

Proposition 11.

2-Orientability is NP-hard.

We now conclude the proof for Theorem 10 by showing there exists a polynomial-time reduction from this problem to Schedulability.

Proposition 12.

2-OrientabilityPSchedulability.

Given some graph G=(V,E) as input for 2-Orientability, we will explain the construction of a set 𝒯 of transactions and will then argue that:

G2-Orientability(𝒯,3|E|+3)Schedulability.

For the construction, we first fix an arbitrarily chosen order on the edges of E, which allows referring to them as e1, e2, …, e|E|. We also associate to every edge ei three different and unique objects xi, yi, and zi. Then, the set 𝒯 that we construct, will consist of precisely |V| transactions, such that there is one transaction for each node in V. We write Tv to denote the transaction associated to node vV. Every transaction Tv consists of precisely 3|E| operations, namely

W[χ1]W[χ|E|]W[γ1]W[γ|E|]W[ζ1]W[ζ|E|]

The objects these operations interact with are chosen as follows: if vei, then χi, γi and ζi are the earlier defined objects xi, yi, and zi, respectively. Otherwise, if vei, then χi, γi and ζi are (all different) unique objects not occurring anywhere else in our construction.

We remark that this construction is indeed polynomial. To conclude the proof of Proposition 12, we make use of Proposition 8 and the next result.

Lemma 13.

For any total order V on V, the longest path in OG(G,V) counts at most two edges if and only if max-path(PΣ)3|E|+3, with Σ=(𝒯,{(Tu,Tv)uVv}).

Some visual intuition for this lemma, in particular the construction of these longest paths through PΣ, can be seen in Figure 3.

Figure 3: A visualization of a longest path (marked bold) in an arbitrary PΣ, where the order Σ is defined as per Lemma 13. Each row represents a single transaction Th, Ti or Tj, sorted top-down consistent with V. Some cross-transaction edges are omitted for clarity of presentation. Waved lines denote one or more intermediate operations. We write χjg, γjg, and ζjg to denote Wg[χj], Wg[γj], and Wg[ζj], where g is the transaction identifier.

5 Instance Optimal Scheduling

We now turn our attention to instance optimal scheduling algorithms. That is, we will identify a restriction on transaction sets that will enable us to compute schedules with a minimal makespan, for any set adhering to this restriction, in polynomial time.

To this extent, we define the contention points of 𝒯 as a set of objects 𝒞(𝒯)𝒪 such that if o and p are conflicting operations in 𝒯, then obj(o)𝒞(𝒯). The converse does not necessarily have to hold, not every contention point must appear in a conflicting operation. We will refer to an element of 𝒞(𝒯) as a contention point, and say that a T𝒯 contends if T contains an operation on a contention point.

We now define 𝕋,m,n as a set of transaction sets with 𝒯𝕋,m,n if |T| for all T𝒯, |𝒞(𝒯)|m, and |𝒯|n. Exclusively in this section, we write 𝕋m instead of 𝕋,m,n, as all results can be phrased such that is the length of the longest transaction in our set, and we can let n=|𝒯|. We also define 𝕋m+ with 𝒯𝕋m+ if 𝒯𝕋m and T contends for all T𝒯.

Given 𝒯𝕋1+, we can see each T𝒯 as a sequence:

o1o2or1prefixW[a]or+1o1osuffix

where r is the position in T such that T[r]=W[a], and T consists of a (potentially empty) subsequence of operations, followed by a conflicting operation to the contention point a, and another (potentially empty) subsequence of operations. In the above sequence we can also replace W[a] by R[a] as long as it is a conflicting operation, we typically use W[a] throughout this section, this does not impact the generality of our results. We call the former subsequence the prefix of T; the latter is the suffix of T. We define pre(T) and suf(T) to be the number of operations before the first (respectively, after the last) contention point.

Definition 14.

Let k0. An allocation of 𝒯𝕋1+ to [0,k] is an injective function αk, which maps transactions T𝒯 to a αk(T)[0,k] such that pre(T)αk(T) and suf(T)kαk(T). We call αk(T) the bin of T.

We will also denote the inverse of αk by αk1. Notice that, [0,k] means there are k+1 bins in total, as we start counting from 0.

For any allocation of a 𝒯𝕋1+ to [0,k], we can use the allocation as an ordering on the transactions. Indeed, if αk(Ti)αk(Tj) for {Ti,Tj}𝒯, then we define an order ord(αk)=(𝒯,αk) such that TiαkTj. Conversely, we can define an allocation alloc(Σ,k) to [0,k] based on a total order Σ with span(canonical(Σ))k+1. Let this total order be T1,T2,,Tn. Then for each Ti, with i[n], we define alloc(Σ,k)(Ti)=j such that j[0,k] is the minimal bin with pre(Ti)j, suf(Ti)kj, and alloc(Σ,k)(Th)<j for all h<i. We then have the following result.

Proposition 15.

There exists an allocation αk of 𝒯𝕋1+ to [0,k], if, and only if, there exists a total order Σ of 𝒯 such that span(canonical(Σ))k+1. Moreover, if αk exists then Σ=ord(αk). And, if Σ exists then αk=alloc(Σ,k).

The former characterization gives us a tool for constructing an optimal order, provided we have an algorithm for allocations. To that end, we define an algorithm Allocate(𝒯,k).

Algorithm 1 Allocate(transaction set 𝒯𝕋1+, threshold k0) : αk or .

It is clear that Allocate(𝒯,k) is sound by construction. That is, if it does not terminate with , it terminates with a valid allocation of 𝒯 to [0,k]. Showing completeness, that is, termination with implies there exists no valid allocation from 𝒯 to [0,k], requires slightly more argumentation. The following lemma is a useful tool.

Lemma 16.

Let 𝒯𝕋1+. For every 𝒯𝒯, and every allocation of 𝒯 on [0,k], we have that |𝒯|+i+j1k.

Completeness follows from assuming a smaller allocation exists despite the algorithm yielding , and then showing it contradicts Lemma 16. Proposition 15 ensures no order exists either.

Theorem 17.

For any 𝒯𝕋1+ and k0, the algorithm Allocate(𝒯,k) runs in O(knlog(n)) time and returns an allocation of 𝒯 to [0,k] if it exists and otherwise.

We can repeat the algorithm with a k that starts at the length of the largest transaction, incrementing whenever it yields . We terminate when the first allocation is returned. We remark that k is at most T𝒯|T|, hence k depends entirely on the transaction set, and therefore its time complexity is polynomial and entirely dependent on 𝒯.

Until now, we have considered transactions from 𝕋1+, but this restriction can be easily relaxed to any 𝒯𝕋1 by only considering the transactions in 𝒯 which contend. To obtain an ordering for the full 𝒯 we can append the remaining transactions arbitrarily onto the allocation order. The corollary then readily follows from Proposition 15 and Theorem 17.

Corollary 18.

If 𝒯𝕋1 and k0, then (𝒯,k)Schedulability is decidable in O(knlog(n)) time.

The algorithm in this section resembles an instance optimal algorithm for the Job Shop Scheduling problem called Johnson’s Rule [16]. We illustrate it is subtly different.

Example 19.

Job shop problem inputs consist of jobs (analogous to our transactions), containing a sequence of operations lasting a duration x{1,2,} on machines (analogous to our objects). Johnson’s rule is applicable when all jobs have two operations on two machines in a single order, hence we represent jobs as pairs (x,y) where x and y are the durations spent on the first and second operation.

Consider the job shop instance 𝒥={A=(1,3),B=(1,2),C=(2,1)}. Johnson’s rule repeatedly picks the operation with the shortest duration and places it in the first free position starting from the front of the schedule if that duration is for the first machine, and places it in the first free position starting from the end of the schedule if it is for the last machine, while breaking ties arbitrarily. A valid schedule would be B,A,C.

If we now create transactions TJ𝒯 for each job (x,y)𝒥 such that pre(TJ)=x and suf(Tj)=y, then the allocation for 𝒯 matching the order B,A,C is α5(TB)=1, α5(TA)=2, and α5(TC)=3. However, an allocation α4 for 𝒯 is given by our algorithm, namely, α4(TA)=1, α4(TB)=2, α4(TC)=3. Hence, Johnson’s rule does not give an optimal schedule for the transaction scheduling problem.

6 Worst-Case Optimal Scheduling

We now look at the transaction scheduling problem from the perspective of worst-case analysis. More specifically, we derive a worst-case optimal bound on the makespan for any transaction set, and in doing so, construct algorithms for any transaction set which yield schedules with a makespan that never exceeds this bound. Additionally, on the worst-behaving transaction sets, the resulting schedules must be optimal.

We define the worst-case optimal cost for 𝕋,m,n as

wco-cost(𝕋,m,n)=max{cost(𝒯)𝒯𝕋,m,n}.

Since we are concerned with a worst-case scenario, we will consider transactions to be long enough for them to contain operations on each contention point, that is, m. Alongside this, we always have n1 and m0.

For 𝕋,m,1, 𝕋,0,n, and 𝕋,1,n, this cost is trivial to determine. Indeed, if n=1 the makespan of all schedules is simply . Similarly, if m=0 we can always execute all transactions entirely in parallel, hence wco-cost(𝕋,0,n)=wco-cost(𝕋,m,1)=. Lastly, if m=1, the lone operation on the contention point occurs in the same position in every transaction T in all instances 𝒯 for which cost(𝒯) is maximal. An optimal schedule will shift each operation in each consecutive transaction forwards by one time unit, hence wco-cost(𝕋,1,n)=+n1 given n2. Determining the worst-case optimal makespan for m2 and n2 is non-trivial, and concerns the rest of this section.

6.1 Extra Notation

We first introduce some notation. Let 𝐱=x1x2xk be a finite sequence of distinct objects. We will write 𝐱(i) to denote the ith object in 𝐱. For a transaction T in a transaction set 𝒯, we will let T represent the sequence of contention points ordered in the way T accesses them. We write cpos(T,i)[|T|] to refer to the position of the operation on the contention point T(i) in some transaction T. Lastly, we define 𝒯𝐱 as {TT𝒯,T=𝐱}.

Next, let 𝐱 and 𝐲 be two length m sequences of distinct objects. We define the maximal overlap between 𝐱 and 𝐲, denoted max-ovl(𝐱,𝐲), as the maximal number k[1,m1] such that for all j[k] and all i[j+mk,m] we have 𝐱(i)𝐲(j); if no such k exists, then max-ovl(𝐱,𝐲)=0. Given a totally ordered finite set of same-length distinct object sequences (K,K), its total overlap tot-ovl(K,K) is defined as the sum i[|K|1]max-ovl(𝐱i,𝐱i+1), where all 𝐱1,𝐱2,,𝐱|K| are ordered as per Σ. The maximal total overlap for K is max-tot-ovl(K)=max{tot-ovl(K,K)with (K,K) a total order on K}.

Finally, for any two disjoint ordered sets (𝒯1,1) and (𝒯2,2), we define the concatenation of 𝒯1 and 𝒯2 as 𝒯1𝒯2=(𝒯1𝒯2,cat) where TicatTj is either Ti1Tj with {Ti,Tj}𝒯1, or Ti2Tj with {Ti,Tj}𝒯2, or Ti𝒯1 and Tj𝒯2. Notice that this operation is associative, so we will write 𝒯1𝒯2𝒯3 for (𝒯1𝒯2)𝒯3.

6.2 Two Contention Points or Transactions

Transaction sets containing two transactions or two points of contention (or both) have the following worst-case optimal bound on their makespan.

Theorem 20.

We have that wco-cost(𝕋,m,2)=2 where m2 and m, and wco-cost(𝕋,2,n)=2+n2 where n3 and 2.

If n=2 and m2, then a trivial upper bound is 2 as there are maximally that many operations in 𝒯. A matching lower bound can be constructed by taking the set {T,T} where T={W[a],,W[z]} and T={W[z],,W[a]}, where the dots “” represent read operations on unique objects, and with both transactions of length m. Intuitively, T flips the first and last operations in T. Indeed, both total orders on {T,T} lead to a schedule with an optimal makespan of 2 as it is impossible for the transactions to be concurrently scheduled, that is, max-ovl(T,T)=0.

For the upper bound when n3 and m=2, we give the construction of an order for 𝒯𝕋,2,n. Let T𝒯. We have either T=ab or T=ba. In the former case, we will define ab on 𝒯ab such that transactions T with the largest distance between the first and second contention point, that is (cpos(T,2)cpos(T,1)), appear first. And, in the latter case, let ba on 𝒯ba such that transactions T with the smallest (cpos(T,2)cpos(T,1)) appear first. Lastly, we get an order Σ2=𝒯ab𝒯ba. We give a visualization of PΣ2 in Figure 4, which gives intuition for the next result.

Proposition 21.

For 𝒯𝕋,2,n with n3 and 2: span(canonical(Σ2))2+n2.

Figure 4: A longest path (bold line) in PΣ2. Waved lines represent one or multiple intermediate operations.

Lastly, for the lower bound, we construct a transaction set 𝒯2𝕋,2,n with n>2 and 2. We will populate the set 𝒯2 to reach n transactions by adding k1 copies of the transaction Ti=Wi[a]o1o2o2Wi[b], and k2 copies of Tj=Wj[b]p1p2p2Wj[a], such that n=k1+k2. A precedence graph for any order on 𝒯2, along with a longest path in this graph, is given in Figure 5.

Proposition 22.

cost(𝒯2)=2+n2.

Proof.

Let Σ=(𝒯2,𝒯2) be a total order, and refer to 𝒯2’s elements by T1,T2,,Tn, reflecting this order. Because PΣ must respect each transaction’s order of operations, there exists a path of nodes between each Wi[a] and Wi[b] for i[n]. And, because the directed edges in PΣ must respect Σ for conflicting operations, there exists a path W1[a]W2[a]Wn[a] and a path W1[b]W2[b]Wn[b] in PΣ that both have n nodes. Since there are k1 transactions T with T=ab and k2 transactions T with T=ba, there exists a path Wi[a]Wi[b]Wi+1[b]Wi+1[a] in PΣ of length 2 for some i[n]. If we outline these paths such as in Figure 5, we see a grid-like pattern with 2 columns and n rows.

Clearly, the longest path starts in W1[a], passes through Wi[b] for all 1in, and ends in Wn[a]. Hence, max-path(PΣ)=2+n2. The desired result follows by Proposition 8.

Figure 5: A longest path (bold line) in a precedence graph PΣ for any total order Σ=(𝒯2,𝒯2). Waved lines denote one or more intermediate operations.

Theorem 20 follows as a corollary of Proposition 21 and Proposition 22. Additionally, we remark that canonical(Σ2) can be trivially computed in polynomial time.

6.3 Three Contention Points

First, we concern ourselves with the case where 2<n6. The following insight is key.

Proposition 23.

Every K{abc,acb,bac,bca,cab,cba} with |K|3 satisfies max-tot-ovl(K)=|K|1.

We can use the above result for all T in each transaction T𝒯 to obtain a transaction order in which the total overlap between transactions is n1. This results in an upper bound of n(n1)=nn+1. For the lower bound, 𝒯 consists of n transactions T of the shape {W[T(1)],,W[T(2)],W[T(3)]}, where each T is unique in 𝒯 ordered as per the above result, and with “” being reads on unique objects.

Theorem 24.

Let 3 and 2<n6, then wco-cost(𝕋,3,n)=nn+1.

Once we allow n7, the new subproblem that arises is one of optimally scheduling all 𝒯𝐱, since |𝒯𝐱|2 for some 𝐱=T and T𝒯. Notice that each T𝒯𝐱 is of the form:

T=δ1W[𝐱(1)]δ2W[𝐱(2)]δ3W[𝐱(3)]δ4;

where, for all j[4], the dots “” represent δj[0,3] read operations on unique objects, such that δ1+δ2+δ3+δ4=3. We write these transactions as tuples (δ1,δ2,δ3,δ4) if the 𝐱 is irrelevant. To find a lower bound, we need assignments for all δj in all T𝒯𝐱, such that cost(𝒯𝐱) is maximal. We now give our best estimates. If |𝒯𝐱|=2, then 𝒯2={(0,0,3,0),(0,3,0,0)}. If |𝒯𝐱|=3, then this is 𝒯3={(0,3/2,0,3/2)}𝒯2. And finally, when |𝒯𝐱|=4 then 𝒯4={(0,4,1,0),(0,1,4,0)}𝒯2. To go beyond this, we can repeat any T𝒯4 until |𝒯𝐱|=n. Figure 6 shows the worst optimal schedules we could find for these sets.

(a) Schedule for 𝒯2.
(b) Schedule for 𝒯3.
(c) Schedule for 𝒯4.
Figure 6: Schedules for 𝒯𝐱 such that cost(𝒯𝐱) is maximized, for |𝒯𝐱|{2,3,4}. Gray boxes with numbers denote there are that amount of read operations on unique objects.

The above 𝒯𝐱 are concatenated with a maximal total overlap of n1 (c.f., Theorem 24). Hence, the first 5 orders 𝐱 each add 2+|𝒯𝐱| to the makespan, the final order 𝐲 adds cost(𝒯𝐲). This leads to the following lower bound.

Proposition 25.

There exist 𝒯𝕋,3,n with 3, such that

cost(𝒯)={6+n117n176+32+n1118n237+n1524n.

For the upper bound, we construct an order for 𝒯𝕋,3,n with n7. First, define a total order (𝒯abc,abc) such that the T with the greatest (cpos(T,2)cpos(T,1)) are placed first. And, we define another total order (𝒯cab,cab) such that the T with the smallest (cpos(T,3)cpos(T,2)) are placed first. For all remaining 𝒯𝐱 with 𝐱abc and 𝐱cab we choose any total order (𝒯𝐱,𝐱). We then define a total order Σ3=𝒯abc𝒯bca𝒯cba𝒯bac𝒯acb𝒯cab for 𝒯. PΣ3 is illustrated in Figure 7.

Proposition 26.

For 𝒯𝕋,3,n with 3 and n7: span(canonical(Σ3))7+n14.

Figure 7: A longest path (bold line) in PΣ3. Waved lines represent one or multiple intermediate operations. Edges between conflicting operations that do not contribute to the longest path are omitted for clarity.

6.4 Any Number of Contention Points

First, we notice that the upper bound for three contention points also holds for more than three contention points.

Proposition 27.

If m4, m, and 3n<m!, then for all 𝒯𝕋,m,n it is the case that cost(𝒯)nn+1.

This is not a worst-case optimal bound, and it is not constructive. A better upper or lower bound requires a generalization of Proposition 23 for arbitrary m. It is possible to reduce the hamiltonian path problem–known to be NP-complete–to this problem, and it is therefore difficult to prove constructive results for.

Whenever we have m! transactions or more, we can make use of an interesting observation relating to object sequences. To this extent, we define the following concept.

Definition 28.

Let 𝐱 and 𝐲 be equal-length sequences of z1 unique objects, then 𝐲 is an adjacent transposition of 𝐱 if 𝐲=𝐱(1)𝐱(2)𝐱(i+1)𝐱(i)𝐱(z) for i[z1].

The notation 𝐱𝐲 denotes that 𝐲 is an adjacent transposition of 𝐱. Intuitively, 𝐲 swaps precisely two adjacent elements in 𝐱. We will write 𝐱𝐲𝐳 to mean that both 𝐱𝐲 and 𝐲𝐳. Additionally, we call seq(m)=𝐱1,𝐱2,,𝐱m! where each sequence has m operations an adjacent transposition sequence for m if 𝐱1𝐱2𝐱m!. Adjacent transpositions have the following property.

Lemma 29.

If 𝐱 and 𝐲 are equal-length sequences of m3 unique objects, and 𝐱𝐲, then max-ovl(𝐱,𝐲)=m2.

The next insight follows from the above lemma and the Steinhaus-Johnson-Trotter algorithm, which for a permutation of m objects, generates an adjacent transposition sequence for m [17, 28, 29]. This algorithm does not run in polynomial time, as it generates all possible sequences of m objects.

Lemma 30.

If m4, m, nm!, and 𝒯𝕋,m,n with K={TT𝒯} containing all equal-length sequences of m distinct objects, then max-tot-ovl(K)=(n1)(m2).

The above results imply we can construct a transposition sequence seq(m)=𝐱1,𝐱2,,𝐱m! such that 𝒯𝐱1𝒯𝐱2𝒯𝐱m!=𝒯. From this, we construct a total order for any 𝒯𝕋,m,n, with n>m! and m. For 𝒯𝐱1 we define the total order (𝒯𝐱1,𝐱1) such that a transaction T𝒯𝐱1 appears earlier in 𝐱1 if (cpos(T,2)cpos(T,1)) is larger. And, for 𝒯𝐱m! we define the total order (𝒯𝐱m!,𝐱m!) such that that T𝒯𝐱m! appears earlier in 𝐱m! if (cpos(T,m)cpos(T,m1)) is smaller. For all other 𝒯𝐱i with i[2,m!1], we choose an arbitrary total order (𝒯𝐱i,𝐱i). Lastly, we define Σm=𝒯𝐱1𝒯𝐱2𝒯𝐱m! to be a total order on 𝒯. This then gives the next bounds.

Theorem 31.

If m4, m, and n=m!, then wco-cost(𝕋,m,n)=n(n1)(m2).

If n>m! then the above scheduling method gives us the following upper bound.

Theorem 32.

If m4, m, and n>m!, then for all 𝒯𝕋,m,n we have that span(canonical(Σm))(m!+m2)+n(m1)(m!+m2).

Table 1 summarizes the results given in this section.

7 Related Work

For years, serializability has been the gold standard for ensuring data consistency. In brief, a transaction schedule is serializable if it is equivalent (for some notion of equivalence) to some serial execution of these transactions. One straightforward notion of equivalence is view equivalence, which states that two schedules are equivalent if all read operations observe the same values and the final database state is the same for both schedules. A famous result by Papadimitriou [24] states that view serializability is NP-complete. Although view serializability is a natural notion of serializability, this negative result has led to the adoption of conflict serializability as the de facto standard for serializability in practice, and is frequently simply referred to as “serializability”. Contrasting view equivalence, conflict equivalence puts a more direct restriction on the order of operations. In particular, all pairs of conflicting operations must be ordered the same in both schedules. It is well known that conflict serializability of a schedule can be decided in polynomial time, and that every conflict serializable schedule is view serializable as well [23]. The serializability problem is orthogonal to the scheduling problem, as the former is concerned with deciding serializability for a given schedule, while the latter is concerned with finding the most efficient serializable schedule for a given set of transactions.

To the best of our knowledge, the only prior results on scheduling are also from Papadimitriou [24], who established that a scheduler which allows precisely all view serializable schedules will likely be inefficient unless P=NP. This result is to be expected, given the NP-completeness of deciding view serializability. Contrasting these results by Papadimitriou, we restrict the search space of schedules to those that are conflict serializable, a property which can be tested in polynomial time. Our NP-completeness result therefore strengthens this earlier work, and shows that a tractable notion of serializability does not necessarily lead to tractable scheduling algorithms.

Orthogonal to finding more efficient schedules that guarantee (conflict) serializability, database systems frequently offer lower levels of isolation, such as read committed or snapshot isolation. In fact, many commercial database systems offer these lower isolation levels by default, and some do not even support conflict serializability [3]. The relaxed consistency guarantees of these lower isolation levels allow for more concurrency, and therefore higher throughput. This performance increase comes at a cost, however, as these lower isolation levels no longer guarantee serializability. Recent work from the database theory community has looked into the transactional robustness problem [11, 18, 19, 30]. The robustness problem is concerned with the following question: given a set of transactions and a specific isolation level, is every allowed schedule (i.e., consistent with the isolation level) a serializable schedule? This robustness property guarantees that the set of transactions can be safely executed under the lower isolation level, thereby increasing performance, while still ensuring serializability. The allocation problem [11, 31] extends upon this problem by considering a setting where isolation levels can be mixed (i.e., different transactions are allocated to different isolation levels), and tries to identify the optimal allocation that still guarantees serializability for the given workload. We emphasize that this line of work relies on an existing scheduler. A key assumption is that, although this scheduler is guaranteed to produce a schedule in line with the chosen isolation levels, the produced output schedule cannot be chosen. Instead, robustness involves verifying serializability of every possible output schedule. The robustness and allocation problems are orthogonal to the scheduling problem, as they rely on an existing scheduler to execute transactions, rather than directly constructing an efficient serializable schedule over the provided workload.

Outside of the database literature, the job shop scheduling problem [4, 25] is the closest relative to the transaction scheduling problem. Indeed, one can see objects as machines, transactions as jobs, and operations as always lasting a single unit of time. The associated decision problem is similarly known to be NP-complete, even when limited to 3 machines [27], known to be approximable only if the operations are unit-time [20, 22], and has a polynomial time approximation scheme (PTAS) if the maximal job length and the number of machines is fixed [13]. However, the results do not carry over. The job shop scheduling problem is distinct because its resulting schedules are not conflict serializable.

The only systems doing explicit scheduling based on makespan in practice, to the best of our knowledge, are the system from Cheng et al. [6] and a prototype system discussed in a workshop article [2]. The former system [6] relies on a heuristic that clusters transactions based on the most frequently occuring contention point, and has seen promising performance. This demonstrates the viability of scheduling algorithms for transactions, and of utilizing contention points to perform workload analysis.

8 Discussion

We return to our central questions. First, “What is the complexity of finding a conflict serializable schedule of minimal makespan?”. We have shown there is a factorial time algorithm for this problem; that the decision variant is NP-complete; and lastly, that there is an instance optimal algorithm for single contention point transaction sets.

Secondly, “Is there a bound on the optimal makespan?”. Our bounds in Table 1 indicate that if the number of transactions is low, then worst-case optimal schedules are close to serial. This gets progressively better once nm!, as the increased number of transactions enables more parallellism. Moreover, the most sensitive parameter is m. Hence, workloads with many contention points are likely to make all transaction scheduling approaches struggle.

Open Problems

Many interesting problems remain open. There is still a gap between the number of contention points needed in the construction used for Theorem 10, and those needed for the algorithm in Section 5. A possibility would be extending techniques for job shop scheduling’s proofs. Given that the problem is known to be NP-hard for 3 machines, it may lead to similar results.

Furthermore, there are missing worst-case optimal bounds for the sets 𝕋,3,n with 7n, and 𝕋,m,n in case nm! and 3n. We suspect that the upper bounds can be lower than the ones provided. Moreover, the upper bound provided in the case of 3n<m! for arbitrary m is not constructive.

The work around bounds is necessary to investigate the approximation complexity of transaction scheduling. This domain has many interesting results for job shop scheduling (c.f., Mastrolilli et al. [22] and Fishkin et al. [12, 13]). It involves constructing approximation-preserving reductions (e.g., L-reductions [9, 15]) from existing problems in discrete optimization, which enable us to decide membership in the class of approximable optimization problems (APX), or the class that admits a polynomial time approximation scheme (PTAS). The former would show there are tractable algorithms for which the output schedule has a makespan within a constant factor of its optimal makespan. The latter implies that we can find a tractable algorithm that gets arbitrarily close to the optimal makespan.

Lastly, the algorithms provided in this work require knowledge of the transaction set before execution. To bridge this gap, queuing theory may be an inspiration [14]. This means entry of transactions into the system becomes a stochastic process, increasing complexity.

References

  • [1] Dana Van Aken, Djellel Eddine Difallah, Andrew Pavlo, Carlo Curino, and Philippe Cudré-Mauroux. Benchpress: Dynamic workload control in the oltp-bench testbed. In Timos K. Sellis, Susan B. Davidson, and Zachary G. Ives, editors, Proceedings of the 2015 ACM SIGMOD International Conference on Management of Data, Melbourne, Victoria, Australia, May 31 - June 4, 2015, pages 1069–1073. ACM, 2015. doi:10.1145/2723372.2735354.
  • [2] Tim Baccaert and Bas Ketsman. Cascade: Optimal transaction scheduling for high-contention workloads. In PhD Symposium of the 40th IEEE International Conference on Data Engineering, ICDE 2024, Utrecht, The Netherlands, May 13-16, 2024, pages 5634–5638. IEEE, 2024. doi:10.1109/ICDE60146.2024.00452.
  • [3] Peter Bailis, Aaron Davidson, Alan D. Fekete, Ali Ghodsi, Joseph M. Hellerstein, and Ion Stoica. Highly available transactions: Virtues and limitations. Proc. VLDB Endow., 7(3):181–192, 2013. doi:10.14778/2732232.2732237.
  • [4] Peter Brucker. Scheduling algorithms (4. ed.). Springer, 2004.
  • [5] Gerard J. Chang, Li-Da Tong, Jing-Ho Yan, and Hong-Gwa Yeh. A Note on The Gallai-Roy-Vitaver Theorem. Discret. Math., 256(1-2):441–444, 2002. doi:10.1016/S0012-365X(02)00386-2.
  • [6] Audrey Cheng, Aaron N. Kabcenell, Jason Chan, Xiao Shi, Peter D. Bailis, Natacha Crooks, and Ion Stoica. Towards optimal transaction scheduling. Proc. VLDB Endow., 17(11):2694–2707, 2024. doi:10.14778/3681954.3681956.
  • [7] Brian F. Cooper, Adam Silberstein, Erwin Tam, Raghu Ramakrishnan, and Russell Sears. Benchmarking cloud serving systems with YCSB. In Joseph M. Hellerstein, Surajit Chaudhuri, and Mendel Rosenblum, editors, Proceedings of the 1st ACM Symposium on Cloud Computing, SoCC 2010, Indianapolis, Indiana, USA, June 10-11, 2010, pages 143–154. ACM, 2010. doi:10.1145/1807128.1807152.
  • [8] Transaction Processing Performance Council. Tpc benchmark c standard specification revision 5.2, 2006.
  • [9] Pierluigi Crescenzi. A short guide to approximation preserving reductions. In Proceedings of the Twelfth Annual IEEE Conference on Computational Complexity, Ulm, Germany, June 24-27, 1997, pages 262–273. IEEE Computer Society, 1997. doi:10.1109/CCC.1997.612321.
  • [10] Djellel Eddine Difallah, Andrew Pavlo, Carlo Curino, and Philippe Cudré-Mauroux. Oltp-bench: An extensible testbed for benchmarking relational databases. Proc. VLDB Endow., 7(4):277–288, 2013. doi:10.14778/2732240.2732246.
  • [11] Alan D. Fekete. Allocating isolation levels to transactions. In Chen Li, editor, Proceedings of the Twenty-fourth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 13-15, 2005, Baltimore, Maryland, USA, pages 206–215. ACM, 2005. doi:10.1145/1065167.1065193.
  • [12] Aleksei V. Fishkin, Klaus Jansen, and Monaldo Mastrolilli. On minimizing average weighted completion time: A PTAS for the job shop problem with release dates. In Toshihide Ibaraki, Naoki Katoh, and Hirotaka Ono, editors, Algorithms and Computation, 14th International Symposium, ISAAC 2003, Kyoto, Japan, December 15-17, 2003, Proceedings, volume 2906 of Lecture Notes in Computer Science, pages 319–328. Springer, 2003. doi:10.1007/978-3-540-24587-2_34.
  • [13] Aleksei V. Fishkin, Klaus Jansen, and Monaldo Mastrolilli. Grouping techniques for scheduling problems: Simpler and faster. Algorithmica, 51(2):183–199, 2008. doi:10.1007/s00453-007-9086-6.
  • [14] Donald Gross, John F. Shortle, James M. Thompson, and Carl M. Harris. Fundamentals of Queueing Theory, Fourth Edition. Wiley Series in Probability and Statistics. Wiley, 2008. doi:10.1002/9781118625651.
  • [15] Juraj Hromkovic. Algorithmics for Hard Problems - Introduction to Combinatorial Optimization, Randomization, Approximation, and Heuristics. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2001. doi:10.1007/978-3-662-04616-6.
  • [16] S. M. Johnson. Optimal Two- and Three-stage Production Schedules with Setup Times Included. Naval Research Logistics Quarterly, 1(1):61–68, 1954.
  • [17] Selmer M. Johnson. Generation of permutations by adjacent transposition. Mathematics of Computation, 17(83):282–285, 1963.
  • [18] Bas Ketsman, Christoph Koch, Frank Neven, and Brecht Vandevoort. Concurrency control for database theorists. SIGMOD Rec., 51(4):6–17, 2022. doi:10.1145/3582302.3582304.
  • [19] Bas Ketsman, Christoph Koch, Frank Neven, and Brecht Vandevoort. Deciding robustness for lower SQL isolation levels. ACM Trans. Database Syst., 47(4):13:1–13:41, 2022. doi:10.1145/3561049.
  • [20] Frank Thomson Leighton, Bruce M. Maggs, and Andréa W. Richa. Fast algorithms for finding o(congestion + dilation) packet routing schedules. Comb., 19(3):375–401, 1999. doi:10.1007/s004930050061.
  • [21] J.K. Lenstra and A.H.G. Rinnooy Kan. Computational complexity of discrete optimization problems. In P.L. Hammer, E.L. Johnson, and B.H. Korte, editors, Discrete Optimization I, volume 4 of Annals of Discrete Mathematics, pages 121–140. Elsevier, 1979.
  • [22] Monaldo Mastrolilli and Ola Svensson. Hardness of approximating flow and job shop scheduling problems. J. ACM, 58(5):20:1–20:32, 2011. doi:10.1145/2027216.2027218.
  • [23] Christos Papadimitriou. The theory of database concurrency control. Computer Science Press, Inc., USA, 1986.
  • [24] Christos H. Papadimitriou. The serializability of concurrent database updates. J. ACM, 26(4):631–653, 1979. doi:10.1145/322154.322158.
  • [25] Michael L. Pinedo. Scheduling: Theory, Algorithms, and Systems. Springer, 2022.
  • [26] Luyi Qu, Yuming Li, Rong Zhang, Ting Chen, Ke Shu, Weining Qian, and Aoying Zhou. Application-oriented workload generation for transactional database performance evaluation. In 38th IEEE International Conference on Data Engineering, ICDE 2022, Kuala Lumpur, Malaysia, May 9-12, 2022, pages 420–432. IEEE, 2022. doi:10.1109/ICDE53745.2022.00036.
  • [27] Yuri N. Sotskov and Natalia V. Shakhlevich. Np-hardness of shop-scheduling problems with three jobs. Discret. Appl. Math., 59(3):237–266, 1995. doi:10.1016/0166-218X(95)80004-N.
  • [28] Hugo Steinhaus. One hundred problems in elementary mathematics. Basic Books, Inc., Publishers, New York, 1964.
  • [29] H. F. Trotter. Algorithm 115: Perm. Commun. ACM, 5(8):434–435, August 1962. doi:10.1145/368637.368660.
  • [30] Brecht Vandevoort. Optimizing Concurrency Control: Robustness Against Read Committed Revisited. PhD thesis, Hasselt University, Belgium, 2021. URL: https://hdl.handle.net/1942/35460.
  • [31] Brecht Vandevoort, Bas Ketsman, and Frank Neven. Allocating isolation levels to transactions in a multiversion setting. In Floris Geerts, Hung Q. Ngo, and Stavros Sintos, editors, Proceedings of the 42nd ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, PODS 2023, Seattle, WA, USA , June 18-23, 2023, pages 69–78. ACM, 2023. doi:10.1145/3584372.3588672.
  • [32] Gerhard Weikum and Gottfried Vossen. Transactional Information Systems: Theory, Algorithms, and the Practice of Concurrency Control and Recovery. Morgan Kaufmann, 2002.
  • [33] Siyang Weng, Qingshuai Wang, Luyi Qu, Rong Zhang, Peng Cai, Weining Qian, and Aoying Zhou. Lauca: A workload duplicator for benchmarking transactional database performance. IEEE Trans. Knowl. Data Eng., 36(7):3180–3194, 2024. doi:10.1109/TKDE.2024.3360116.
  • [34] Huidong Zhang, Luyi Qu, Qingshuai Wang, Rong Zhang, Peng Cai, Quanqing Xu, Zhifeng Yang, and Chuanhui Yang. Dike: A benchmark suite for distributed transactional databases. In Sudipto Das, Ippokratis Pandis, K. Selçuk Candan, and Sihem Amer-Yahia, editors, Companion of the 2023 International Conference on Management of Data, SIGMOD/PODS 2023, Seattle, WA, USA, June 18-23, 2023, pages 95–98. ACM, 2023. doi:10.1145/3555041.3589710.

Appendix A Enumeration Scheduling

To construct an optimal serializable schedule, we can enumerate all possible linear orders Σ=(𝒯,𝒯) for 𝒯 and pick one such order with a minimal max-path(PΣ). This is precisely the idea behind the enumerative scheduling algorithm EnumSchedule.

Algorithm 2 EnumSchedule(transaction set 𝒯) : schedule for 𝒯.
Proposition 33.

Let 𝒯 be a set of transactions, then EnumSchedule(𝒯) computes a serializable schedule of minimal makespan in O(|𝒯|!+(T𝒯|T|)2) time.

Proof.

First, observe that EnumSchedule(𝒯) is trivially serializable due to Proposition 8.

Furthermore, span(EnumSchedule(𝒯)) is minimal. Indeed, we consider all possible linear orders Σ=(𝒯,𝒯), hence, by Proposition 8 the order Σ for which span(Σ)=cost(𝒯) will be considered by the algorithm.

Finally, the time complexity follows from the fact that we consider all total orders on 𝒯, of which there are precisely |𝒯|!. For each order Σ, we compute the longest vertex path in its accompanying precedence graph PΣ=(V,E). Since PΣ is acyclic, we can compute this by doing a depth-first post-order traversal which has a time complexity of O(|V|+|E|). However, we know |E||V|(|V|1) hence this is equivalent to O(|V|2). Furthermore, |V| is equal to T𝒯|T|, which gives an overall bound of O(|𝒯|!+(T𝒯|T|)2).

Appendix B Missing Proofs for Section 3

B.1 Proof for Proposition 8

Proposition 34.

Let 𝒯 be a set of transactions. For every serializable schedule s for 𝒯, we have that max-path(Ps)span(s). If s is dense, then span(s)=max-path(Ps).

Proof.

Let s=A1,,Ak be some serializable schedule. By definition, span(s)=k. The equality span(s)max-path(Ps) follows from a simple inductive argument showing that for the longest directed path v1,vm in Ps, the set Ai cannot contain an operation vj with i<j, thus implying max-path(Ps)=mk=span(s).

By definition of dense schedule, for every oAi, with i>1, there is a pAi1 such that (p,o) is an edge in the precedence graph. The latter immediately implies that there is a directed path with k nodes in Ps, which means span(s)max-path(Ps).

Proposition 35.

Let 𝒯 be a set of transactions. There exists an ordering 𝒯 over 𝒯 such that max-path(PΣ)=cost(𝒯), with Σ=(𝒯,𝒯).

Proof.

Let s be some serializable schedule for 𝒯 with span(s)=cost(𝒯). We assume that s is dense. The latter is w.l.o.g., because otherwise we can repeatably pick a problematic operation and move it one step to the left, until the resulting schedule is dense. Clearly, the resulting schedule s is equivalent to s and thus remains conflict-serializable. We have span(s)span(s) and thus span(s)=span(s) by choice of s.

It now follows from Proposition 34 that cost(𝒯)=span(s)=max-path(Ps) and from Proposition 6 that max-path(Ps)=max-path(PΣ) for some Σ=(𝒯,𝒯).

Appendix C Missing Proofs for Section 4

C.1 Proof for Lemma 13

Lemma 36.

For any total order V on V, the longest path in OG(G,V) counts at most two edges if and only if max-path(PΣ)3|E|+3, with Σ=(𝒯,{(Tu,Tv)uVv}).

Proof.

To follow along with the proof, it will be helpful to have some visual intuition about the structure of PΣ. Therefore, we recall that the nodes of PΣ coincide with the operations of transactions in 𝒯 and that an edge (o,p) in PΣ either means that p is the direct successor of o in some transaction, or that o and p are conflicting operations from different transactions. More precisely, in the latter case it follows from the construction of Σ that oTv and pTu with vVu and with o=Tv[i] and p=Tu[i] for some integer i. We call the latter edge a cross transaction edge from Tv to Tu.

(If.)

The proof is by contraposition, i.e., we show that if max-path(PΣ)>3|E|+3 than there is a path 𝐩 in OG(G,V) with three edges. For this, first recall that max-path(PΣ)3|E|+3 implies existence of a directed path 𝐪 in PΣ with 3|E|+3 nodes, and hence with a length of 3|E|+2. Now, making use of the earlier developed intuition about PΣ, we observe that every path 𝐪 of length k contains at least k3.|E|1 cross transaction edges (since every individual transaction is represented in PΣ by precisely 3|E|1 edges, and by the fact that cross transaction edges are always from transactions Tv to Tu with vVu.). Since in our case k3|E|+2 it follows that there are at least three cross transaction edges. Hence, we can assume that there is an edge (o1,o2), (p1,p2) and (q1,q2) with o1Tv, o2,p1Tu, p2,q1Tw and q2Ts, which implies that a directed path (u,v)(v,w)(w,s) in G exists, which is clearly of length three.

(Only-if.)

This direction is by contraposition as well, hence, we show that if there exists a directed path in OG(G,V) of length 3 then there exists a directed path in PΣ of length 3|E|+2. For this, let 𝐩=(u,v)(v,w)(w,s) be such a path of precisely length three, with ej1={u,v}, ej2={v,w}, and ej3={w,s}. Then, we construct a directed path 𝐪 in PΣ as follows: first traverse the consecutive operations of transaction Tu up to (and including) its operation Wu[xj1]. Then traverse the cross transaction edge (Wu[xj1],Wv[xj1]), followed by the consecutive operations of transaction Tv consecutive to Wv[xj1] till (and including) operation Wv[yj2]. Then analogously as before, traverse the cross transaction edge (Wv[yj2],Ww[yj2]) followed by consecutive operations of Ww[yj2] in Tw till (and including) Ww[zj3] after which yet another cross transaction edge (Ww[zj3],Ws[zj3]) is traversed, followed by the remaining operations of Ts consecutive to Ws[zj3]. It can be verified that the constructed path has a length of precisely 3|E|+2, which concludes the proof.