- Replacing basic algorithms with their .darkblue[QC counterparts in query optimizations for speeding up databases]
- .darkblue[What should be the properties of a quantum computer] (e.g. #qubits, latencies of gates) to achieve certain speedups.darkblue[?]
- .darkblue[How to combine classical and quantum computing algorithms to achieve good speedups with few qubits?]
.darkgray[(...for running database optimizations on current available quantum computers...)]
- .darkblue[What other (database) domains] besides query and transaction schedule optimizations benefit from quantum computers.darkblue[?]
.darkgray[(In short: those based on mathematical optimization problems, but also other...?)]
---
.darkblue[QC4DB: .small-font36[Accelerating Relational Database Management Systems via Quantum Computing]]
.more-more-condensed[
Name: |
.darkblue[QC4DB]: Accelerating Relational Database Management Systems via Quantum Computing |
Proj. Web: |
Project Website@Quantentechnologien |
Funded by: |
BMBF, Fördermaßnahme .darkblue[Anwendungsnetzwerk] für das Quantencomputing |
Duration: |
3 years |
Volume: |
1.8M Euros |
Topics: |
.darkblue[Optimizing] an open source relational .darkblue[database] management system - .darkblue[Queries]
- .darkblue[Transaction Schedules]
|
Partners: |
(Coord.) |
 |
Expertises: |
Hardware-Acceleration of Databases |
Room Temperature Diamond Quantum Accelerators/qbOS |
Website: |
https://www.ifis.uni-luebeck.de/~groppe/ |
https://quantumbrilliance.com/ |
]
---
# .darkblue[Hybrid Multi-Model Multi-Platform (HM3P) Database]
.reference[S. Groppe, J. Groppe, Hybrid Multi-Model Multi-Platform (HM3P) Databases, DATA 2020.]
.more-condensed[
+ full and uniform .darkgreen[data integration] at database level
+ .darkgreen[performance]: fully optimized across different data models
+ transparent .darkgreen[fault-tolerance]
+ SQL .darkgreen[standards]: .small-font22[relational ('87), XML ('03), temporal ('11), JSON ('16), Multi-dimensional Arrays ('19), schemaless ('19), streams ('20?), property graphs ('21?)]
+ .darkgreen[features of different] types of .darkgreen[databases running on different platforms] can be used
]
---
# Using .darkblue[Hardware Accelerator] for optimizing Transaction Schedules
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
---
# .small-font32.bold[.darkblue[2 Phase Locking (2PL)] versus .darkblue[Strict Conservative 2PL]]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]

.more-condensed[
- .darkblue[required locks] to be determined by
- .darkblue[static analysis] of transaction, .darkgray[or if static analysis is not possible:]
- an .darkblue[additional phase at runtime] before transaction processing
-
A. Thomson et al., "Calvin: Fast distributed transactions for partitioned database systems", SIGMOD 2012.
]
---
# .em[Optimizing] .darkblue[Transaction Schedules]
.reference[$^*$ M.R. Garey, D.S. Johnson and R. Sethi, The Complexity of Flowshop and Jobshop Scheduling, 1(2):117-129, 1976]
.more-more-condensed[
- Variant of job shop schedule problem (JSSP):
- Multi-Core CPU
- Process whole
job (here transaction) on core X
- .darkblue[Schedule: $\forall$ cores: Sequence of jobs] to be processed
- What is the .darkblue[optimal schedule] for minimal overall processing time?
- .darkgray[Additionally to JSSP:]
.darkblue[Blocking transactions not] to be processed .darkblue[in parallel]
- Example:
 Black: Blocking transactions |
|
 Transaction schedule |
.more-more-condensed[
- JSSP is among the .darkblue[hardest combinatorial optimizing problems]$^*$
- $\Rightarrow$ .darkblue[Hardware accelerating] the optimization of transaction schedules
] |
]
---
#

.darkblue[Quantum] versus .darkblue[Simulated Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.no-margin.no-padding.more-more-condensed[
.more-more-condensed[
- .darkblue[Transaction Model]
- T: .darkblue[set of transactions] with |T| = n
- M: .darkblue[set of machines] with |M| = k
- $O \subseteq T \times T$: set of .darkblue[blocking] transactions
- li: .darkblue[length of transaction] i
- R: .darkblue[maximum execution time]
- .darkblue[upper bound] ri = R − li .darkblue[for start time of transaction] i
]
|
.more-more-condensed[
- Example
- T = {t1, t2, t3}, n=3
- M = {m1, m2}, k=2
- $O$ = {(t2, t3)}
- l1 = 2, l2 = 1, l3 = 1
- R = 2
- r1 = 0, r2 = 1, r3 = 1
]
|
- .darkblue[Quadratic unconstrained binary optimization (QUBO)] problems (solving is NP-hard)
- A QUBO-problem is defined by N weighted binary variables $X_1, ..., X_N\in\{0, 1\}$, either as linear or quadratic term .darkblue[to be minimized]:

]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
- Multi-Core CPU
- Process whole transaction on core X
- Solution formulated as set of binary variables
- X
i,j,s is 1 iff transaction t
i is started at time s on machine m
j, otherwise 0
- Example:
 Black: Blocking transactions |
|
 Transaction schedule |
.more-more-condensed[
- Solution: X1,1,0, X3,1,2, X4,2,0, X7,2,1, X6,2,3, X5,2,6, X2,3,0, X8,3,5
] |
]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
- .darkblue[Valid] Solution
- A: each
transaction starts exactly once

]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
- .darkblue[Valid] Solution
- B:
transactions cannot be executed at the same time on the same machine

]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
- .darkblue[Valid] Solution
- C:
transactions that block each other cannot be executed at the same time

]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
- .darkblue[Optimal] Solution
- D:
minimizing the maximum execution time

- Increasing weights: Weight of step n is larger than of
all preceding steps 1 to n-1 $\Rightarrow$
preferring
transactions ending earlier
- Weigths in A, B and C $\geq$ 1
$\Rightarrow$
first priority is validity, second priority is optimality

]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
- .darkblue[Overall] Solution
- Minimize $P = A + B + C + D$

]
---
# .em[Optimizing] .darkblue[Transaction Schedules] via .darkblue[Quantum Annealing]
.reference[
T. Bittner, S. Groppe, Avoiding Blocking by Scheduling Transactions using Quantum Annealing, IDEAS 2020]
.more-more-condensed[
.more-more-condensed[
- Experiments on real .darkblue[Quantum Annealer] (D-Wave 2000Q cloud service)
- first minute free (afterwards too much for our budget)
- Versus .darkblue[Simulated Annealing on CPU]
- .darkblue[Preprocessing time/Number of QuBits]: $O((n\cdot k\cdot R)^2)$
]
|
|
]
---
# .darkblue[Optimizing Transaction Schedules] via .darkred.bold[Quantum Computing]
.reference[
S. Groppe, J. Groppe: Optimizing Transaction Schedules on Universal Quantum Computers via Code Generation for Grover’s Search Algorithm. IDEAS'21]
---
# .darkblue[Grover]'s Search Algorithm
.more-more-condensed[
- .darkblue[Black box] function $f:${$0,...,2^b -1$} $\mapsto$ {$true, false$}
- Grover's search algorithm finds one $x \in${$0,...,2^b -1$},
such that $f(x)=true$
- if there is only .darkblue[one solution]: $\frac{\pi}{4}\cdot\sqrt{2^b}$ basic steps each of which calls $f$
Let $f'(b)$ be runtime complexity of $f$ for testing $x$ to be true:
.darkblue[$\Rightarrow O(\sqrt{2^b}\cdot f'(b))$]
- if there are .darkblue[$k$] possible .darkblue[solutions]: .darkblue[$O(\sqrt{\frac{2^b}{k}}\cdot f'(b))$]
]
---
# .darkblue[Motivation] - Quadratic Speedup
.reference[Grover' Search:
Original Paper Qiskit Textbook $k$ sol. in ArXiv Unknown Number of Solutions:
Randomized in ArXiv Deterministic]
.more-more-condensed.smaller-font[
$N$ | Linear Search $k=1$ | Grover $k=1$ | $k=\frac{5}{100}\cdot N$ | $k=5$ |
known $k$ | unknown $k$ | known $k$ | unknown $k$ |
randomized | deterministic | randomized | deterministic |
10 | 5 | 2.48 | 3.51 | 10.06 | 37.46 | 1.11 | 3.81 | 11.85 |
100 | 50 | 7.85 | 3.51 | 10.06 | 37.47 |
1000 | 500 | 24.84 | 11.11 | 31.82 | 118.48 |
1000 000 | 500 000 | 785.40 | 351.24 | 1006.23 | 3746.57 |
]
---
# .darkblue[Grover's Search for $k$ Solutions]
.reference[Grover' Search:
Original Paper Qiskit Textbook $k$ solutions in ArXiv]
---
# .darkblue[Grover's Search for Unknown Number of Solutions]
.reference[
Scott Aaronson. Introduction to Quantum Information Science Lecture Notes, 2021]
.more-more-condensed[
- If you apply .darkblue[Grover's search with $k\approx$ number of solutions $k'$, then] there is a .darkblue[high probability for success]
- .darkblue[Several ways for unknown $k$:]
- .darkblue[Successively applying Grover's search with $k=N, \frac{N}{2}, \frac{N}{4}, ..., \frac{N}{2^t}$] until solution is found
-
Runtime complexity: With sufficiently high probability, a marked entry will be found by iteration $t=\log_{2}(\frac{N}{k'})+c$ for some constant $c$
$\Rightarrow$ #iterations $\leq\frac{\pi}{4}\left(1+\sqrt{2}+\sqrt{4}+...+\sqrt{\frac{N}{k'\cdot 2^c}}\right)=O\left(\sqrt{\frac{N}{k'}}\right)$
- .darkblue[Next slide: .bold[Randomized] version with $\frac{9}{4}\sqrt{\frac{N}{k'}}$ iterations]...
- These .darkblue[methods need to be called several times] in case of not finding a solution in preceding calls
- The .darkblue[probability for success is] high, but .darkblue[never 100%]
]
---
# .darkblue[Grover's Search for Unknown Number of Solutions] - Silq code
.reference[Grover' Search:
Original Paper Qiskit Textbook $k$ sol. in ArXiv Unknown Number of Solutions:
Randomized in ArXiv]
.smaller-font[
```silq
// Popular Lehmer generator that uses the prime modulus 2^32−5
def random(state:!ℕ):(!ℕ)×(!ℚ) {
upperlimit := (2^32 - 5);
newstate := (state · 279470273) % upperlimit;
newstateQ := newstate as !ℚ; // for the following division to get a rational number
return (newstate, newstateQ / upperlimit);
}
// f oracle function, t oracle function as classical function for testing the result!
def grover_unknown_k[n:!ℕ](f: const uint[n] !→ lifted 𝔹, t: !ℕ !→ !𝔹, seed:!ℕ):(!ℤ)×(!ℕ) {
l := 6/5; // Any value of l strictly between 1 and 4/3 would do...
m := 1 as !ℝ;
state := seed; // work with seed to allow for repeated function calls with other results
while(true){
(zstate, z) := random(state);
state = zstate;
k := floor(z·m) coerce !ℕ;
result := grover_k[n,k](f);
if(t(result)){ // call of f would also work, but in this way hybrid approach is more visible
return (result, state) as (!ℤ)×(!ℕ);
}
if(m>=sqrt(2^n)){ return (-1, state) as (!ℤ)×(!ℕ); } // different from cited paper: restart!
m = min(l·m, sqrt(n));
}
}```]
---
# .darkblue[Applying Grover] - Finding .darkblue[Minimum]
.reference[adapted from:
C. Dürr, P. Høyer. A quantum algorithm for finding the minimum, 1996]
.more-more-condensed[
- Given function $f:\\{0,...,N-1\\} \mapsto ℝ$
- Algorithm to find minimal $f(x)$:
1. Choose randomly $x'\in N$
2. Threshold $t := f(x')$
3. while(true)
a) $r :=$ Grover's Search for unknown $k$ with oracle $f(x)\lt t$
b) if$\left(f(r)\lt t\right)$ $t:=f(r)$ else return $t$
- Runtime Complexity: $O\left(\frac{45}{4}\sqrt{N}+\frac{7}{10}lg^2(N)\right)$
]
---
# .darkblue[Applying Grover] - Finding .darkblue[Minimum]
.more-more-condensed[
- Variants:
- .darkblue[Application-oriented]:
-
Estimate good
initial threshold $t$, then continue original algorithm at 3. with threshold $t$
- Example (see also next lecture unit):
- Transactions $T_1,...,T_p$ to be distributed to $m$ cores of a CPU
- Total runtime $l=\sum_{i=1}^p |T_i|$ of transactions
- Threshold $t\geq\frac{l}{m}$ for max. runtime on all cores
- In some applications, the number $k$ of solutions of the oracle can be approximately estimated and used to speed up Grover's search
- .darkblue[Domain-oriented]:
I) If given domain $[start, end]$ is "small", then continue original algorithm at 3. with $t:=end$
II) $m:=\frac{end-start}{2}$
III) If Grover's search with oracle $f(x)\lt m$ finds a solution $r$, then continue at I) with domain $[start,r]$ else with $[m+1,end]$
]
---
# .darkblue[Overview] of Optimizing Transaction Schedules via Quantum Computing
---
# .darkblue[Encoding Scheme] .small-font36[of Transaction Schedules]
.more-more-condensed[
- $29 =$ .darkgreen[$000111$] .darkred[$01$] $_{binary} \equiv$ Core 0 .darkgreen[$[3,1]$] .darkred[$\mu_1=1$] .darkgreen[$[0,2]$] Core 1, some bits for .darkgreen[permutation] and some for .darkred[separators]
- $b = (m-1)\cdot \left \lceil log_2(n-1)\right \rceil + \left \lceil log_2(n!-1)\right \rceil$
]
---
# Generated .darkblue[Black Box] Function
.more-more-condensed[
- Quantum computation: .darkblue[circuit of quantum logic gates
$\Rightarrow$ circuit is generated] dependent on the concrete problem instance
- Sketch of algo:
.smaller-font[
1. Determine Separators and Permutation |
$O(m+n)$ |
2. Check Validity of Separators |
$O(m)$ |
3. $\forall i$: Determine lengths of $i$-th transaction in permutation |
$O(n\cdot log_2(n))$ with decision tree over transaction number |
4. Check: Which separator configuration? For current case: |
$O(n)$ |
4a. determine total runtime of core and check if it's below given limit |
$O(n)$ |
4a. determine start and end times of conflicting transactions |
$O(n\cdot log_2(min(n,c))+c)$ with decision tree over conflicting transactions (for $n>>c$) or transaction numbers (for $c>>n$) |
5. Check: Do conflicting transactions overlap? |
$O(c)$ |
|
.darkblue[$\sum:O(n\cdot log_2(n)+c)$] |
]]
---
# .darkblue[Complexity Analysis]
.more-more-condensed.smaller-font[
Approach |
CPU |
Quantum Computer |
Quantum Annealing |
Preprocessing |
$O(1)$ |
$O(n^2\cdot c)$ |
$O(m\cdot R^2\cdot(c\cdot m + n^2))$ |
Execution |
$O(\frac{(m+n-1)!}{(m-1)!}\cdot (n+c))$ |
$O(\sqrt{\frac{n!\cdot n^m}{k}}\cdot(n\cdot log_2(n)+c))$ |
$O(1)$ |
Space |
$O(n+m+c)$ |
$O((n+m)\cdot log_2(n))$ |
$O(m\cdot R^2\cdot(c\cdot m + n^2))$ |
Code |
$O(1)$ |
$O(n^2\cdot c)$ |
$O(m\cdot R^2\cdot(c\cdot m + n^2))$ |
.bold[$m$:] number of machines .bold[$n$:] number of transactions .bold[$c$:] number of conflicts .bold[$R$:] max. runtime .bold[$k$:] number of solutions
]
---
# .darkblue[Number of Solutions]
|
.more-more-condensed.smaller-font[
|
$m=2$ |
$m=4$ |
$N$ |
8,589,934,592 |
2,199,023,255,552 |
$k$ |
48,384,000 |
559,872 |
$k$ for $\leq 1.25\cdot R_{opt}$ |
1,472,567,040 |
2,047,306,752 |
]
|
---
# .darkblue[Summary & Conclusions]
.more-more-condensed[
- .darkblue[Scheduling transactions as variant of jobshop problem with] additionally considering .darkblue[blocking transactions]
- .darkblue[Hard combinatorial optimization problem $\Rightarrow$ hardware acceleration]
- .darkblue[Enumeration of all possible transaction schedules] for finding an optimal one
- .darkblue[Hardware acceleration via quantum .bold[annealing]]
- Formulating
transaction schedule problem as quadratic unconstrained binary optimization (
QUBO)
problem
-
Constant execution time in contrast to simulated annealing on classical computers
-
Preprocessing time increasing with larger problem sizes
- .darkblue[.bold[Grover]'s search]: $\approx$ .darkblue[quadratic speedup] on Universal Quantum Computers
-
Estimation of number of solutions for a further
speedup
- Estimation of speedup for suboptimal solutions being a guaranteed factor away from optimal solution
-
Code Generator available at
https://github.com/luposdate/OptimizingTransactionSchedulesWithSilq
]