18
Multiple Query Optimization using a Hybrid Approach of Classical and Quantum Computing Tobias Fankhauser 1 , Marc E. Solèr 1 , Rudolf M. Füchslin 1,2 , and Kurt Stockinger 1 1 Zurich University of Applied Sciences, Winterthur, Switzerland 2 European Centre for Living Technology (ECLT), Ca’ Bottacin, Dorsoduro 3911, 30123 - Venice, Italy Quantum computing promises to solve dif- ficult optimization problems in chemistry, physics and mathematics more efficiently than classical computers, but requires fault-tolerant quantum computers with millions of qubits. To overcome errors introduced by today’s quantum computers, hybrid algorithms com- bining classical and quantum computers are used. In this paper we tackle the multiple query optimization problem (MQO) which is an im- portant NP-hard problem in the area of data- intensive problems. We propose a novel hy- brid classical-quantum algorithm to solve the MQO on a gate-based quantum computer. We perform a detailed experimental evaluation of our algorithm and compare its performance against a competing approach that employs a quantum annealer – another type of quantum computer. Our experimental results demon- strate that our algorithm currently can only handle small problem sizes due to the lim- ited number of qubits available on a gate-based quantum computer compared to a quantum computer based on quantum annealing. How- ever, our algorithm shows a qubit efficiency of close to 99% which is almost a factor of 2 higher compared to the state of the art im- plementation. Finally, we analyze how our al- gorithm scales with larger problem sizes and conclude that our approach shows promising results for near-term quantum computers. 1 Introduction In database research, various optimization problems have been formulated since the seventies [35, 22, 37], with the query optimization problem being a typical NP-hard representative. These problems, although extensively examined, become even more difficult as data processing becomes more complex [40]. Recent approaches to the query optimization problem have Tobias Fankhauser: [email protected] Marc E. Solèr: [email protected] Rudolf M. Füchslin: [email protected] Kurt Stockinger: [email protected] also become increasingly sophisticated, now employ- ing deep learning methods [22, 28]. Simultaneously, progress in the construction of quantum computers has sparked new interest in applied quantum com- puting [6, 12, 4, 32], whereas previously, the quantum computing community was mainly concerned with more theoretical studies due to the lack of practical quantum devices [30]. It is hoped that quantum com- puters can one day solve complex problems more effi- ciently than classical computers [30]. Although quantum computers were first envisioned to simulate quantum systems [15], the first two fa- mous use cases were outside of physics. Namely, search in an unstructured list [19] and factoring large integers [38]. More recently, quantum computers are considered for mathematical optimization [12], or simulation of molecules for chemistry [32]. Current quantum com- puters are still in their infancy and are restricted by the capacity and fault-tolerance [30, 4, 43], making them more interesting for quantum research than for real-world application. This motivated the creation of hybrid classical-quantum algorithms like the Quan- tum Approximate Optimization Algorithm (QAOA) [12] that employ a quantum device to explore high- dimensional search space and classical routines to op- timize the search procedure. By only relaying parts of the computation to the quantum computers, these hy- brid classical-quantum-algorithms are more resistant to error [12], making them more suitable to near-term devices. The Multiple Query Optimization problem (MQO) is a generalization of the query optimization prob- lem [37]. MQO is known to be an NP-hard prob- lem [36]. It has been approached by classical meth- ods such as the shortest-path algorithms [37], genetic algorithms [5] and others. Recently, a quantum ap- proach was suggested for the MQO by Trummer and Koch [40], utilizing a D-Wave quantum annealer [10], a particular type of quantum computer designed to run special optimization problems [40]. Our work builds on Trummer and Koch’s approach, but utilizes a gate-based quantum computer, a more general type of quantum computer. Gate-based quantum comput- ers can, in principle, run every quantum algorithm [2, 24], while quantum annealers are restricted to spe- cific problems [40]. This advantage comes with the 1 arXiv:2107.10508v1 [cs.DB] 22 Jul 2021

Multiple Query Optimization using a Hybrid Approach of

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Multiple Query Optimization using a Hybrid Approach of

Multiple Query Optimization using a Hybrid Approach ofClassical and Quantum ComputingTobias Fankhauser1, Marc E. Solèr1, Rudolf M. Füchslin1,2, and Kurt Stockinger1

1Zurich University of Applied Sciences, Winterthur, Switzerland2European Centre for Living Technology (ECLT), Ca’ Bottacin, Dorsoduro 3911, 30123 - Venice, Italy

Quantum computing promises to solve dif-ficult optimization problems in chemistry,physics and mathematics more efficiently thanclassical computers, but requires fault-tolerantquantum computers with millions of qubits.To overcome errors introduced by today’squantum computers, hybrid algorithms com-bining classical and quantum computers areused.In this paper we tackle the multiple query

optimization problem (MQO) which is an im-portant NP-hard problem in the area of data-intensive problems. We propose a novel hy-brid classical-quantum algorithm to solve theMQO on a gate-based quantum computer. Weperform a detailed experimental evaluation ofour algorithm and compare its performanceagainst a competing approach that employs aquantum annealer – another type of quantumcomputer. Our experimental results demon-strate that our algorithm currently can onlyhandle small problem sizes due to the lim-ited number of qubits available on a gate-basedquantum computer compared to a quantumcomputer based on quantum annealing. How-ever, our algorithm shows a qubit efficiencyof close to 99% which is almost a factor of2 higher compared to the state of the art im-plementation. Finally, we analyze how our al-gorithm scales with larger problem sizes andconclude that our approach shows promisingresults for near-term quantum computers.

1 IntroductionIn database research, various optimization problemshave been formulated since the seventies [35, 22, 37],with the query optimization problem being a typicalNP-hard representative. These problems, althoughextensively examined, become even more difficult asdata processing becomes more complex [40]. Recentapproaches to the query optimization problem haveTobias Fankhauser: [email protected] E. Solèr: [email protected] M. Füchslin: [email protected] Stockinger: [email protected]

also become increasingly sophisticated, now employ-ing deep learning methods [22, 28]. Simultaneously,progress in the construction of quantum computershas sparked new interest in applied quantum com-puting [6, 12, 4, 32], whereas previously, the quantumcomputing community was mainly concerned withmore theoretical studies due to the lack of practicalquantum devices [30]. It is hoped that quantum com-puters can one day solve complex problems more effi-ciently than classical computers [30].

Although quantum computers were first envisionedto simulate quantum systems [15], the first two fa-mous use cases were outside of physics. Namely,search in an unstructured list [19] and factoring largeintegers [38].

More recently, quantum computers are consideredfor mathematical optimization [12], or simulation ofmolecules for chemistry [32]. Current quantum com-puters are still in their infancy and are restricted bythe capacity and fault-tolerance [30, 4, 43], makingthem more interesting for quantum research than forreal-world application. This motivated the creation ofhybrid classical-quantum algorithms like the Quan-tum Approximate Optimization Algorithm (QAOA)[12] that employ a quantum device to explore high-dimensional search space and classical routines to op-timize the search procedure. By only relaying parts ofthe computation to the quantum computers, these hy-brid classical-quantum-algorithms are more resistantto error [12], making them more suitable to near-termdevices.

The Multiple Query Optimization problem (MQO)is a generalization of the query optimization prob-lem [37]. MQO is known to be an NP-hard prob-lem [36]. It has been approached by classical meth-ods such as the shortest-path algorithms [37], geneticalgorithms [5] and others. Recently, a quantum ap-proach was suggested for the MQO by Trummer andKoch [40], utilizing a D-Wave quantum annealer [10],a particular type of quantum computer designed torun special optimization problems [40]. Our workbuilds on Trummer and Koch’s approach, but utilizesa gate-based quantum computer, a more general typeof quantum computer. Gate-based quantum comput-ers can, in principle, run every quantum algorithm[2, 24], while quantum annealers are restricted to spe-cific problems [40]. This advantage comes with the

1

arX

iv:2

107.

1050

8v1

[cs

.DB

] 2

2 Ju

l 202

1

Page 2: Multiple Query Optimization using a Hybrid Approach of

cost that gate-based quantum computers currentlyfeature significantly fewer qubits and are more error-prone than quantum annealers.

1.1 Multiple Query OptimizationMultiple query optimization (MQO) aims to minimizethe total cost of executing a series of queries againsta database by exploiting shared intermediate results[37].

Example 1 Consider a database with tablesA,B, . . . ,H of different sizes. On these ta-bles, queries can be formulated, such asσAuthor="D. Knuth"(A on B on C). To producethis query, there may exist multiple plans that varyin the order of joins, order of selections and otheraspects. For example, selections are usually done be-fore joining tables to reduce the number of operationsrequired for the join. Figure 1 shows two of thoseplans.

Our model considers a series of queries q1, . . . , qQ,where each query has a fixed number P of plans,uniquely identified as p1, . . . , pPQ. For every query,exactly one plan has to be selected. Each plan pihas associated a cost ci, which our model assumes asgiven. Finally, we denote savings (e.g. from sharedintermediate results) pairwise between plans pi andpj as si,j . Savings can be subtracted from the totalcost if both plans from the pair have been selected.In the below example, the pairs of plans p3, p4 havesavings as they can use an intermediate result fromsharing a common table B. The goal is to find aselection of plans for all the queries, such that theoverall cost is minimized.

A on B on C B on D · · · D on G on Hq1 q2 . . . qQ

p1, p2, p3 p4, p5, p6 . . . pPQ−2, pPQ−1, pPQs3,4 s6,PQ−2

The search space of this problem is significant asthere are P possibilities to choose from for everyquery, resulting in PQ possibilities overall1. Infor-mally, we can formulate the following rules to con-strain the search space:

R1 Plans with lower cost are preferred.

R2 Cost savings across any queries are taken intoconsideration.

R3 Exactly one plan is selected per query.

Example 2 We consider two queries q1, produced byplans p1 and p2 and q2, produced by plans p3 and p4.The cost for the plans p1, p2, p3, p4 are 3, 13, 21 and

1If no savings were given, the least-cost solution is triviallyobtained by selecting the least-cost plan of every query.

A ⨝ C ... ... ... ... ... ...

A ⨝ B ⨝ C ... ... ... ... ... ...

<latexit sha1_base64="5M1/cQ6LpbM5EZXthwqseWV2kRE=">AAAB7HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF/FUwbSFNpTNdtMu3eyG3Y0QQn+DFw+KePUHefPfuG1z0NYHA4/3ZpiZFyacaeO6305pbX1jc6u8XdnZ3ds/qB4etbVMFaE+kVyqbog15UxQ3zDDaTdRFMchp51wcjvzO09UaSbFo8kSGsR4JFjECDZW8vv3kolBtebW3TnQKvEKUoMCrUH1qz+UJI2pMIRjrXuem5ggx8owwum00k81TTCZ4BHtWSpwTHWQz4+dojOrDFEklS1h0Fz9PZHjWOssDm1njM1YL3sz8T+vl5roOsiZSFJDBVksilKOjESzz9GQKUoMzyzBRDF7KyJjrDAxNp+KDcFbfnmVtBt177LeeLioNW+KOMpwAqdwDh5cQRPuoAU+EGDwDK/w5gjnxXl3PhatJaeYOYY/cD5/ALOxjp8=</latexit>on

C ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

<latexit sha1_base64="5M1/cQ6LpbM5EZXthwqseWV2kRE=">AAAB7HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF/FUwbSFNpTNdtMu3eyG3Y0QQn+DFw+KePUHefPfuG1z0NYHA4/3ZpiZFyacaeO6305pbX1jc6u8XdnZ3ds/qB4etbVMFaE+kVyqbog15UxQ3zDDaTdRFMchp51wcjvzO09UaSbFo8kSGsR4JFjECDZW8vv3kolBtebW3TnQKvEKUoMCrUH1qz+UJI2pMIRjrXuem5ggx8owwum00k81TTCZ4BHtWSpwTHWQz4+dojOrDFEklS1h0Fz9PZHjWOssDm1njM1YL3sz8T+vl5roOsiZSFJDBVksilKOjESzz9GQKUoMzyzBRDF7KyJjrDAxNp+KDcFbfnmVtBt177LeeLioNW+KOMpwAqdwDh5cQRPuoAU+EGDwDK/w5gjnxXl3PhatJaeYOYY/cD5/ALOxjp8=</latexit>on

B ... ... ... ... ... ...

A ... ... ... ... ... … ... ... …

<latexit sha1_base64="iLgawdB2phkbPA6FPOHiNCn6IF0=">AAACCnicbZC7SgNBFIZn4y3GW9TSZkwQrMJuELUR4qUQbCKYC2SXMDuZJENmZ5eZs2JYtrbxVWwsFLH1Cex8GyeXQhN/GPj4zzmcOb8fCa7Btr+tzMLi0vJKdjW3tr6xuZXf3qnrMFaU1WgoQtX0iWaCS1YDDoI1I8VI4AvW8AeXo3rjninNQ3kHw4h5AelJ3uWUgLHa+X1X815A2okL7AGS8xj6oTorXJXwjTRcSNN2vmiX7LHwPDhTKKKpqu38l9sJaRwwCVQQrVuOHYGXEAWcCpbm3FiziNAB6bGWQUkCpr1kfEqKD4zTwd1QmScBj93fEwkJtB4GvukMCPT1bG1k/ldrxdA99RIuoxiYpJNF3VhgCPEoF9zhilEQQwOEKm7+immfKELBpJczITizJ89DvVxyjkvl26Ni5WIaRxbtoQI6RA46QRV0jaqohih6RM/oFb1ZT9aL9W59TFoz1nRmF/2R9fkD8lGaaQ==</latexit>�Author=”D. Knuth”

(a)

A ⨝ B ... ... ... ... ... ...

A ⨝ B ⨝ C ... ... ... ... ... ...

<latexit sha1_base64="5M1/cQ6LpbM5EZXthwqseWV2kRE=">AAAB7HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF/FUwbSFNpTNdtMu3eyG3Y0QQn+DFw+KePUHefPfuG1z0NYHA4/3ZpiZFyacaeO6305pbX1jc6u8XdnZ3ds/qB4etbVMFaE+kVyqbog15UxQ3zDDaTdRFMchp51wcjvzO09UaSbFo8kSGsR4JFjECDZW8vv3kolBtebW3TnQKvEKUoMCrUH1qz+UJI2pMIRjrXuem5ggx8owwum00k81TTCZ4BHtWSpwTHWQz4+dojOrDFEklS1h0Fz9PZHjWOssDm1njM1YL3sz8T+vl5roOsiZSFJDBVksilKOjESzz9GQKUoMzyzBRDF7KyJjrDAxNp+KDcFbfnmVtBt177LeeLioNW+KOMpwAqdwDh5cQRPuoAU+EGDwDK/w5gjnxXl3PhatJaeYOYY/cD5/ALOxjp8=</latexit>on

C ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

<latexit sha1_base64="5M1/cQ6LpbM5EZXthwqseWV2kRE=">AAAB7HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF/FUwbSFNpTNdtMu3eyG3Y0QQn+DFw+KePUHefPfuG1z0NYHA4/3ZpiZFyacaeO6305pbX1jc6u8XdnZ3ds/qB4etbVMFaE+kVyqbog15UxQ3zDDaTdRFMchp51wcjvzO09UaSbFo8kSGsR4JFjECDZW8vv3kolBtebW3TnQKvEKUoMCrUH1qz+UJI2pMIRjrXuem5ggx8owwum00k81TTCZ4BHtWSpwTHWQz4+dojOrDFEklS1h0Fz9PZHjWOssDm1njM1YL3sz8T+vl5roOsiZSFJDBVksilKOjESzz9GQKUoMzyzBRDF7KyJjrDAxNp+KDcFbfnmVtBt177LeeLioNW+KOMpwAqdwDh5cQRPuoAU+EGDwDK/w5gjnxXl3PhatJaeYOYY/cD5/ALOxjp8=</latexit>on

B ... ... ... ... ... ...

A ... ... ... ... ... … ... ... …

<latexit sha1_base64="iLgawdB2phkbPA6FPOHiNCn6IF0=">AAACCnicbZC7SgNBFIZn4y3GW9TSZkwQrMJuELUR4qUQbCKYC2SXMDuZJENmZ5eZs2JYtrbxVWwsFLH1Cex8GyeXQhN/GPj4zzmcOb8fCa7Btr+tzMLi0vJKdjW3tr6xuZXf3qnrMFaU1WgoQtX0iWaCS1YDDoI1I8VI4AvW8AeXo3rjninNQ3kHw4h5AelJ3uWUgLHa+X1X815A2okL7AGS8xj6oTorXJXwjTRcSNN2vmiX7LHwPDhTKKKpqu38l9sJaRwwCVQQrVuOHYGXEAWcCpbm3FiziNAB6bGWQUkCpr1kfEqKD4zTwd1QmScBj93fEwkJtB4GvukMCPT1bG1k/ldrxdA99RIuoxiYpJNF3VhgCPEoF9zhilEQQwOEKm7+immfKELBpJczITizJ89DvVxyjkvl26Ni5WIaRxbtoQI6RA46QRV0jaqohih6RM/oFb1ZT9aL9W59TFoz1nRmF/2R9fkD8lGaaQ==</latexit>�Author=”D. Knuth”

(b)

Figure 1: Optimizing queries against databases is an NP-hardproblem. This figure shows two different query plans, i.e.partial solutions of the combinatorial optimization problem.(a) shows a query plan where table C (largest table) is joinedwith A (medium table). Afterwards a selection on the author"D. Knuth" is applied on the intermediate result which is thenjoined with table B (smallest table). Because the selectionis done late, the join operation has to be applied on a largeresult set. (b) shows a more efficient query plan, where theselection is first done on table A (medium table) resultingin a smaller result set – prior to the join with B (smallesttable). The intermediate result is finally joined with table C(largest table).

1. When plans p2 and p3 are both selected, they savecosts of s2,3 = 14. To find the least-cost solution,we compute the cost of every admissible selectionas displayed below. That is, we only list solutionsthat feature exactly one plan per query. Obviously,selecting plans p1 and p4 is the least-cost solution.

q1 q2 Costp1, p2 p3, p4 13 + 1 = 14p1, p2 p3, p4 13 + 21− 14(Savings) = 20p1, p2 p3, p4 3 + 1 = 4p1, p2 p3, p4 3 + 21 = 24

1.2 Contributions of the PaperThe MQO scales exponentially with the number ofquery plans it contains [40]. While classical comput-ing typically approaches such problems by pruning thesearch space [40], quantum computers can explore the

2

Page 3: Multiple Query Optimization using a Hybrid Approach of

entire search space simultaneously [31, 30].In Section 2 we revise the most important founda-

tions of quantum computing that are important forsolving optimization problems such as multiple-queryoptimization.

In Section 3 we first show a classical brute-force ap-proach for the MQO that enumerates and then eval-uates every solution. We then provide an intuitionfor the quantum query optimization by characteriz-ing the optimal solution in a way that can later beused for a quantum circuit, which is the quantum-equivalent to classical machine language. Finally, weshow a high-level overview of our algorithm.

In Section 4, we first provide the necessary concep-tual groundwork for the Quantum Approximate Opti-mization Algorithm (QAOA), on which the algorithmis based on, and establish the relationship to quan-tum annealing. Next, we formulate the MQO math-ematically, translate it into a quantum circuit whilesimultaneously introducing the classic part of our al-gorithm. We conclude that section with a more re-fined low-level algorithm and a discussion about howthe algorithm is run.

Finally, in Section 5, we present experimental re-sults of our algorithm. As the algorithm’s perfor-mance relies heavily on the classical optimizationpart, we utilize novel optimization strategies that weanalyze. Furthermore, we compare our approach withthe quantum annealing approach to the MQO anddemonstrate that our approach shows more efficientusage of qubits which is an advantage for future, morepowerful gate-based quantum computers. We com-plete our results with a complexity analysis of ourapproach.

In summary, our contributions are the following:

1. We provide a novel hybrid classical-quantum al-gorithm to solve the multiple query optimization.The only previous quantum computing-based ap-proach tackling the multiple query optimizationused a quantum annealer architecture [40]. Tothe best of our knowledge, this is the first paperin the literature to address the multiple query op-timization problem with a gate-based quantumcomputer.

2. We conduct experiments with the algorithm withreal quantum hardware and simulators, and an-alyze how the algorithm scales with the problemsize.

3. We compare our work with a competing quantumquery optimization approach.

2 Quantum Computing FoundationsQuantum algorithms are known for speeding up cer-tain computations, such as integer factorization [31].In principle, these algorithms achieve the significant

speedup by not having to examine every branch in thesearch space sequentially, as by a classical brute forceapproach2. Instead, a quantum computer holds alarge number of branches during computation, whichis possible due to the fact that a quantum register canbe understood as a superposition of basis states.

Here, we must add a brief excursion. Certain typesof quantum systems, e.g. electrons or polarized pho-tons, are in quantum mechanics represented by a datastructure that is equivalent to a normalized vector ina two-dimensional complex vector space (i.e. a two-dimensional complex Hilbert space, to be precise).Such vectors, denoted by a so called ket |q〉, are thesuperposition of two basis vectors |0〉 and |1〉:

|q〉 = α |0〉+ β |1〉 (1)

whereby α, β ∈ C and

|q〉 = |α|2|β|2 = 1. (2)

The data structure |q〉 is called a qubit. With-out delving into mathematical and physical details:qubits can be combined and then form a so calledquantum register. If one has n coupled qubits, theresulting quantum register is again a normalized ele-ment of a complex Hilbert space, whereby this spacehas dimension 2n. A basis state of this Hilbert spacecan be understood as a bit sequence |x0x1...xn〉 withxi ∈ {0, 1}. The bit sequence of the basis state en-codes a natural number i, therefore the basis statesare often just written as |i〉 with i ∈ 0, ..., 2n − 1. Aquantum register |Q〉 is then a superposition of basisstates:

|Q〉 =2n∑i=0

ci |i〉 (3)

with2n∑i=0|ci|2 = 1 (4)

One aspect of superposition is so called quantumparallelism: One can understand an operation on aquantum register as the simultaneous operation onmany basis states. This interpretation is sensible,because quantum operations are (in a mathematicalsense) linear operations in a vector space that is builtup from basis states. Another aspect (not explicitlydiscussed in this paper but relevant for many theoret-ical features of quantum computing) is due to the factthat quantum registers represent entangled states. Aquantum computation is ended by some sort of quan-tum measurement. In brief, a quantum algorithm ma-nipulates quantum registers with the goal of amplify-ing the probability of measuring the basis state (bit

2The conception of a quantum computer evaluating the en-tire search space in parallel and selecting the best solution isan incorrect oversimplification [1].

3

Page 4: Multiple Query Optimization using a Hybrid Approach of

strings) that represents the solution to the problemunder investigation.

The time development of a quantum state is de-scribed by the Schrödinger equation:

i~∂

∂t|Q〉 = H |Q〉 . (5)

Thereby, H is an operator (here a 2n-dimensional ma-trix). The matrix H is called the Hamiltonian of thesystem and is related to the system’s energy. Mathe-matically, H is a so - called Hermitian matrix, whichmeans that its eigenvalues are all real numbers. Theseeigenvalues are the energies of the respective eigen-state: If |x〉 is an eigenstate of H and λx the eigen-value of |x〉, then the system carries energy λx if itis in state |x〉. The state with the lowest energy (thesmallest λx) is called the ground state.

The time evolution described by Equation 5 is notthe only process of relevance in quantum comput-ing. There are also so called measurements. For ourpurposes, it is sufficient to define a measurement asa stochastic, non-linear operation that transforms ageneral quantum register |Q〉 into one, randomly cho-sen basis state. Formally, a measurementM is definedby (we use the notation of Equation 3):

M |Q〉 = |i〉 with probability |ci|2. (6)

This means that a measurement destroys the infor-mation stored in a quantum register, at least to someextent. That is the reason, why many algorithms inquantum computing can be understood as amplifica-tion processes for the basis state that represents thesolution one is looking for (or geometrically speaking,rotate a general state towards the solution state byreducing the angle between a general state and thesolution).

Equation 5 describes the temporal development ofthe system under consideration. One can show thatthe fact that H is Hermitian leads to time evolutionthat preserves the length of the vector describing thestate of the system. An operation that preserves thelength of a vector is simply a rotation (though in high-dimensional vector space). An operator that mediatessuch a rotation is called unitary. The time evolutionof a quantum mechanical system is therefore a unitaryprocess. Process steps in quantum computing consistof unitary operations; one physical challenge one facesis to implement the Hamiltonian H that belongs to adesired unitary operation U .

Note well that the unitary time evolution given byEquation 5 is reversible, whereas a measurement byEquation 6 is an irreversible process.

Finally, we point out that even if the Hilbert spacethat describes a quantum register may be of high di-mension, it is still a finite dimensional space. Thatmeans that the mathematics one needs for quantumcomputing is (comparably) simple; linear algebra is

[0 0 0 0] [0 1 1 0][1 0 0 1] [0 1 1 0][1 0 0 1][1 1 1 1]<latexit sha1_base64="chIckpGyCWAaCSIeHXpGdIoAa+A=">AAAB8nicbVDLSgMxFL1TX7W+qi7dBIvgqswUUZdFQVxWsA+YDiWTZtrQTDIkGaEM/Qw3LhRx69e482/MtLPQ1gOBwzn3knNPmHCmjet+O6W19Y3NrfJ2ZWd3b/+genjU0TJVhLaJ5FL1QqwpZ4K2DTOc9hJFcRxy2g0nt7nffaJKMykezTShQYxHgkWMYGMlvx9jMyaYZ3ezQbXm1t050CrxClKDAq1B9as/lCSNqTCEY619z01MkGFlGOF0VumnmiaYTPCI+pYKHFMdZPPIM3RmlSGKpLJPGDRXf29kONZ6God2Mo+ol71c/M/zUxNdBxkTSWqoIIuPopQjI1F+PxoyRYnhU0swUcxmRWSMFSbGtlSxJXjLJ6+STqPuXdYbDxe15k1RRxlO4BTOwYMraMI9tKANBCQ8wyu8OcZ5cd6dj8VoySl2juEPnM8fejGRYw==</latexit>F

Figure 2: F gradually augments the probability that a desiredsolution is measured.

sufficient. The subtleties of linear functional analy-sis (colloquially linear algebra in infinite dimensionalspaces) are no barrier for understanding most algo-rithms in quantum computing.

3 Quantum Query Optimization: HighLevel OverviewLet us now discuss how to solve the problem ofmultiple-query optimization using the theory revisedin the previous section.

We define a black-box function F that encodes so-lutions in the sense that it alters a superposition ofbasis states in such a manner that those representingsolutions to a given problem are amplified. We callF a problem encoding function. An intuitive inter-pretation of the process to find an optimal solution isrendered in Figure 2.

There is a common misunderstanding about F .The existence of F does not imply that one "knowsthe answer to a problem in advance". If compared toa classical computer and a classical problem such asadding to numbers, a classical analogue for a problemencoding function is a hard-wired adder. The adder"knows" the answer to an addition in the sense thatit implements the logical processes necessary for anaddition. By no means, it contains the answer to allpossible additions in the sense of a table.

To encode solutions to the MQO, we choose bitstrings in the form [p1, p2, . . . , pPQ], where a 1 at thei-th position denotes that query plan pi has been se-lected for the solution, and a 0 otherwise. For in-stance, selection of plans p1 and p4 is then representedas [1, 0, 0, 1].

3.1 Classical Brute Force Query OptimizationA classical brute-force approach to find a least-costsolution for a MQO is characterized as follows:

1. Get bit strings that encode admissible solutions.

2. Evaluate the cost of each solution.

3. Return the solution with minimum cost.

A pseudocode-implementation of such a program isshown in Listing 1.

Listing 1: Program structure to find the optimal solution# 1.solutions = get_admissible_solutions ()

4

Page 5: Multiple Query Optimization using a Hybrid Approach of

# 2.for s in solutions :

solution_cost [i] = cost(s) - savings (s)# 3.min_idx = argmin ( solution_cost )return solutions [ min_idx ]

3.2 Intuition for Quantum Query OptimizationIn this section, we provide an intuition for the hybridquantum algorithm. The details will be discussed inSection 4. Therefore, we neglect theoretical rigor infavor of a better introduction to the algorithm.

We choose the number of qubits in the quantumregister equal to the number of plans of the MQO,as we want the quantum algorithm to operate withbit strings that encode solutions3. Initially, the quan-tum register can be prepared to contain a uniform su-perposition of all 2n possible basis states with equalprobability of being measured.

A classical computer, even when employing heuris-tics, must evaluate individual bit strings from thesearch space. The operator F acts on the entire quan-tum register and thus operates on 2n states simulta-neously, as rendered in Figure 3. According to its im-plementation, F augments the amplitude of certainstates, which are then more likely to be measured.The effect is insofar somewhat similar to that of a ge-netic algorithm: solutions with desired properties arepromoted, where others are disregarded. However,the process is completely deterministic and, as men-tioned, from a mathematical perspective nothing elsethan a rotation in a high dimensional vector space.

Internally, F is constructed from quantum gatesand encodes a particular problem. In case of theMQO, we have already defined the rules that describedesirable solutions (see Section 1 after Example 1).

The encoding rewards desired properties e.g. sav-ings, and penalizes undesired ones, e.g. high plancosts. Non-admissible solutions that encode no ormultiple plans for a query are non-negotiable andtherefore receive a dominant penalty. By combiningthese rewards and penalties in F , all necessary infor-mation to promote the optimal solution is encoded.The encoding is formally discussed in Section 4.

With F being at the core of the quantum algorithm,it requires two further components: the uniform su-perposition on which F operates and the measuringstep, which delivers, at least with a sufficiently highprobability, the basis state representing the solution.

Our quantum algorithm can thus be summarizedas succession of four steps: (1) Encode the problem.(2) Put every qubit in the quantum register into a su-perposition to acquire an uniform superposition. (3)Apply F on the quantum register. (4) Measure the

3In this section we are using the terms "bit string" and "so-lution" interchangeably, as bit strings encode solutions.

<latexit sha1_base64="1e2YKhEQ2T8xnhjGHaGpDF8SQ84=">AAAB6HicbVDLTgJBEOzFF+IL9ehlIjHxRHaJUY9ELxwhkUcCGzI79MLI7OxmZtaEEL7AiweN8eonefNvHGAPClbSSaWqO91dQSK4Nq777eQ2Nre2d/K7hb39g8Oj4vFJS8epYthksYhVJ6AaBZfYNNwI7CQKaRQIbAfj+7nffkKleSwfzCRBP6JDyUPOqLFSo9YvltyyuwBZJ15GSpCh3i9+9QYxSyOUhgmqdddzE+NPqTKcCZwVeqnGhLIxHWLXUkkj1P50ceiMXFhlQMJY2ZKGLNTfE1MaaT2JAtsZUTPSq95c/M/rpia89adcJqlByZaLwlQQE5P512TAFTIjJpZQpri9lbARVZQZm03BhuCtvrxOWpWyd12uNK5K1bssjjycwTlcggc3UIUa1KEJDBCe4RXenEfnxXl3PpatOSebOYU/cD5/AJ/DjNM=</latexit>

H<latexit sha1_base64="1e2YKhEQ2T8xnhjGHaGpDF8SQ84=">AAAB6HicbVDLTgJBEOzFF+IL9ehlIjHxRHaJUY9ELxwhkUcCGzI79MLI7OxmZtaEEL7AiweN8eonefNvHGAPClbSSaWqO91dQSK4Nq777eQ2Nre2d/K7hb39g8Oj4vFJS8epYthksYhVJ6AaBZfYNNwI7CQKaRQIbAfj+7nffkKleSwfzCRBP6JDyUPOqLFSo9YvltyyuwBZJ15GSpCh3i9+9QYxSyOUhgmqdddzE+NPqTKcCZwVeqnGhLIxHWLXUkkj1P50ceiM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NK5K1bssjjycwTlcggc3UIUa1KEJDBCe4RXenEfnxXl3PpatOSebOYU/cD5/AJ/DjNM=</latexit>

H

<latexit sha1_base64="ZRfkIX7JiyChM8tzc2EfU2Cp4yk=">AAAB6XicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF49V7Ae0oWy2m3bpZhN2J0IJ/QdePCji1X/kzX/jts1BWx8MPN6bYWZekEhh0HW/ncLa+sbmVnG7tLO7t39QPjxqmTjVjDdZLGPdCajhUijeRIGSdxLNaRRI3g7GtzO//cS1EbF6xEnC/YgOlQgFo2ilh17WL1fcqjsHWSVeTiqQo9Evf/UGMUsjrpBJakzXcxP0M6pRMMmnpV5qeELZmA5511JFI278bH7plJxZZUDCWNtSSObq74mMRsZMosB2RhRHZtmbif953RTDaz8TKkmRK7ZYFKaSYExmb5OB0JyhnFhCmRb2VsJGVFOGNpySDcFbfnmVtGpV77Jau7+o1G/yOIpwAqdwDh5cQR3uoAFNYBDCM7zCmzN2Xpx352PRWnDymWP4A+fzB53OjWw=</latexit> {

[1 0 0 1]Measurement

<latexit sha1_base64="EifKk2OMkzZweTzzY4FCgnd5ylY=">AAAB6nicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF48V7Qe0oWy2k3bpZhN2N0IJ/QlePCji1V/kzX/jts1BWx8MPN6bYWZekAiujet+O4W19Y3NreJ2aWd3b/+gfHjU0nGqGDZZLGLVCahGwSU2DTcCO4lCGgUC28H4dua3n1BpHstHM0nQj+hQ8pAzaqz0kPS9frniVt05yCrxclKBHI1++as3iFkaoTRMUK27npsYP6PKcCZwWuqlGhPKxnSIXUsljVD72fzUKTmzyoCEsbIlDZmrvycyGmk9iQLbGVEz0sveTPzP66YmvPYzLpPUoGSLRWEqiInJ7G8y4AqZERNLKFPc3krYiCrKjE2nZEPwll9eJa1a1bus1u4vKvWbPI4inMApnIMHV1CHO2hAExgM4Rle4c0Rzovz7nwsWgtOPnMMf+B8/gAByo2f</latexit>p1

<latexit sha1_base64="j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WP4A+fzB53OjWw=</latexit>

{

[1 0 0 1][0 1 1 0]

<latexit sha1_base64="EifKk2OMkzZweTzzY4FCgnd5ylY=">AAAB6nicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF48V7Qe0oWy2k3bpZhN2N0IJ/QlePCji1V/kzX/jts1BWx8MPN6bYWZekAiujet+O4W19Y3NreJ2aWd3b/+gfHjU0nGqGDZZLGLVCahGwSU2DTcCO4lCGgUC28H4dua3n1BpHstHM0nQj+hQ8pAzaqz0kPS9frniVt05yCrxclKBHI1++as3iFkaoTRMUK27npsYP6PKcCZwWuqlGhPKxnSIXUsljVD72fzUKTmzyoCEsbIlDZmrvycyGmk9iQLbGVEz0sveTPzP66YmvPYzLpPUoGSLRWEqiInJ7G8y4AqZERNLKFPc3krYiCrKjE2nZEPwll9eJa1a1bus1u4vKvWbPI4inMApnIMHV1CHO2hAExgM4Rle4c0Rzovz7nwsWgtOPnMMf+B8/gAByo2f</latexit>p1<latexit sha1_base64="jAFpftlrex+3y1Qydk/YnZH7eFk=">AAAB6nicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF48V7Qe0oWy2m3bpZhN2J0IJ/QlePCji1V/kzX/jts1BWx8MPN6bYWZekEhh0HW/ncLa+sbmVnG7tLO7t39QPjxqmTjVjDdZLGPdCajhUijeRIGSdxLNaRRI3g7GtzO//cS1EbF6xEnC/YgOlQgFo2ilh6Rf65crbtWdg6wSLycVyNHol796g5ilEVfIJDWm67kJ+hnVKJjk01IvNTyhbEyHvGupohE3fjY/dUrOrDIgYaxtKSRz9fdERiNjJlFgOyOKI7PszcT/vG6K4bWfCZWkyBVbLApTSTAms7/JQGjOUE4soUwLeythI6opQ5tOyYbgLb+8Slq1qndZrd1fVOo3eRxFOIFTOAcPrqAOd9CAJjAYwjO8wpsjnRfn3flYtBacfOYY/sD5/AEDTo2g</latexit>p2

<latexit sha1_base64="HncBU5x9Hmra0QPdDzuzrc2gkrg=">AAAB6nicbVBNS8NAEJ34W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W19Y3NrfJ2ZWd3b/+genjU0TJVhLaJ5FL1QqwpZ4K2DTOc9hJFcRxy2g0nt7nffaJKMykezTShQYxHgkWMYGMlvx9jMyaYZ3ezQbXm1t050CrxClKDAq1B9as/lCSNqTCEY619z01MkGFlGOF0VumnmiaYTPCI+pYKHFMdZPPIM3RmlSGKpLJPGDRXf29kONZ6God2Mo+ol71c/M/zUxNdBxkTSWqoIIuPopQjI1F+PxoyRYnhU0swUcxmRWSMFSbGtlSxJXjLJ6+STqPuXdYbDxe15k1RRxlO4BTOwYMraMI9tKANBCQ8wyu8OcZ5cd6dj8VoySl2juEPnM8fejGRYw==</latexit>F

[1 1 1 1][0 0 0 0]

<latexit sha1_base64="ZRfkIX7JiyChM8tzc2EfU2Cp4yk=">AAAB6XicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF49V7Ae0oWy2m3bpZhN2J0IJ/QdePCji1X/kzX/jts1BWx8MPN6bYWZekEhh0HW/ncLa+sbmVnG7tLO7t39QPjxqmTjVjDdZLGPdCajhUijeRIGSdxLNaRRI3g7GtzO//cS1EbF6xEnC/YgOlQgFo2ilh17WL1fcqjsHWSVeTiqQo9Evf/UGMUsjrpBJakzXcxP0M6pRMMmnpV5qeELZmA5511JFI278bH7plJxZZUDCWNtSSObq74mMRsZMosB2RhRHZtmbif953RTDaz8TKkmRK7ZYFKaSYExmb5OB0JyhnFhCmRb2VsJGVFOGNpySDcFbfnmVtGpV77Jau7+o1G/yOIpwAqdwDh5cQR3uoAFNYBDCM7zCmzN2Xpx352PRWnDymWP4A+fzB53OjWw=</latexit> {

Superposition Time

Figure 3: The structure of the algorithm. First, qubits areput into uniform superposition (blue), F is applied, drivingthe superposition towards the optimal solution, and finally,the basis state amplitudes are measured (red).

state of the qubits. Figure 3 gives an overview of thealgorithm’s circuit.

A high-level quantum multiple query optimizationalgorithm can be formulated as in Algorithm 1.

Input : Plan cost C, Savings S, amount ofqueries Q

Output: Least-cost solution(1) Encode problem into F from C, S and Q;(2) Create uniform superposition on quantumregister;(3) Apply F on quantum register;(4) Measure quantum register;return Least-cost solution;Algorithm 1: High level quantum query opti-mization algorithm.

This chapter omitted details such as the numberof times F has to be applied, or the implementationdetails of F . Both of these topics are refined in thenext section.

4 Hybrid Classical-Quantum Algo-rithmThe intuition of the previous section outlines the ba-sic workings of the algorithm for multiple query op-timization. In this section we develop this intuitioninto a more rigid framework considering the practicallimitations of current quantum hardware. For this, wefirst introduce the context of hybrid classical-quantumalgorithms.

4.1 Toward a Quantum Approximate Opti-mization AlgorithmThe class of hybrid classical-quantum algorithms uti-lizes both classical and quantum computers. Thesetypes of algorithms are considered promising sincethey can better handle erroneous, small-scale quan-tum devices [30] than "pure" quantum algorithms.QAOA has been suggested as one of the major hybridclassical-quantum algorithms [12], next to the Varia-tional Quantum Eigensolver (VQE) [32]. The former

5

Page 6: Multiple Query Optimization using a Hybrid Approach of

is often used for generic optimization problems whilethe latter is often used in context of molecule simula-tions. In this work, we use the QAOA.

The quantum mechanical foundation that enablesa function like F to "select" optimal solutions is theadiabatic principle [7, 13]. It (roughly) states thata quantum mechanical system, evolved by a gradu-ally applied time dependent operator, remains in itsinstantaneous eigenstate [13].

This means that if the system starts in a knownground state and the problem-encoding function F isapplied gradually, it ends in the state that generatesthe least cost for our problem [23]. This evolution isinformally comparable to learning a neural network.Although the form of the neural network is unknownand must first be learned, the properties of neural net-work are known, namely that it maps an input to anoutput with minimal loss. Similarly, the evolution’sgoal state can be described by a problem-encodingfunction as F .Quantum annealers are a class of quantum com-

puters that natively facilitate this evolution [40, 10].Quantum annealers typically comprise more qubitsthan gate-based quantum computers [25, 10]. Whilequantum annealers only facilitate computations of acertain class of problems, gate-based quantum com-puters are more general, as they can implement anyquantum algorithm. In this work, we focus solely ongate-based quantum computers.

To compute the evolution on gate-based quantumcomputers, the evolution process is decomposed intodiscrete units [13]. In case of our problem-encodingfunction F , the decomposition is realized by applyingF step-wise with the two parameters β and γ describ-ing the "step size". F can be expressed as follows:

F Discretization−−−−−−−−−→ F(β1, γ1)+F(β2, γ2)+ . . .+F(βp, γp)(7)

where p denotes the amount of decomposable unitsof F . The parameters β and γ influence significantlyhow well the evolution into the goal state described byF succeeds (see Figure 4). Using the neural networkanalogy, the parameters can be seen as a learning rate.Chosen too steep, it "overshoots" the optima [8].

The decomposition of F typically leads to manygates and thus, deep quantum circuits. As the errorrate grows exponentially with the depth of the circuitand robust error correction is currently out of reach,deep quantum circuits are infeasible.

The QAOA tackles this problem by choosing theparameters β, γ such that F is most effectively ap-plied and the evolution succeeds, approximating theoptimal cost value. Thereby, it exploits the strengthsof quantum computers (i.e. fast evaluation and selec-tion of promising solutions in high dimensional space),while delegating tasks in which they perform poorlyto classical computers (i.e. evaluating solutions to im-prove β and γ).

<latexit sha1_base64="N29tSf3kwZOyzVWjRFGRSPW6/w8=">AAAB7XicbVDLSgNBEJyNrxhfUY9eBoPgKewGUY9BLx4jmAckS+idzCZj5rHMzAphyT948aCIV//Hm3/jJNmDJhY0FFXddHdFCWfG+v63V1hb39jcKm6Xdnb39g/Kh0cto1JNaJMornQnAkM5k7RpmeW0k2gKIuK0HY1vZ377iWrDlHywk4SGAoaSxYyAdVKrNwQhoF+u+FV/DrxKgpxUUI5Gv/zVGyiSCiot4WBMN/ATG2agLSOcTku91NAEyBiGtOuoBEFNmM2vneIzpwxwrLQrafFc/T2RgTBmIiLXKcCOzLI3E//zuqmNr8OMySS1VJLFojjl2Co8ex0PmKbE8okjQDRzt2IyAg3EuoBKLoRg+eVV0qpVg8tq7f6iUr/J4yiiE3SKzlGArlAd3aEGaiKCHtEzekVvnvJevHfvY9Fa8PKZY/QH3ucPiTWPHA==</latexit>�

<latexit sha1_base64="gYJa+h4eRi6XDaD289+2EUHPjMA=">AAAB6HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF48t2FpoQ9lsJ+3azSbsboQS+gu8eFDEqz/Jm//GbZuDtj4YeLw3w8y8IBFcG9f9dgpr6xubW8Xt0s7u3v5B+fCoreNUMWy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xj/RQcNLmYgTTQVZLAoSjnSEZhGgIZOUaD41BBPJzK2IjLEJQpugSiYEZ/nlVdKpVZ3Lau2uXmle53EU4QRO4RwcuIIm3EIL2kBAwjO8wpv1ZL1Y79bHorVg5TPH8AfW5w+ZBpKV</latexit>

3⇡

8

Solu

tion

qua

lity

high

low

Initial solution

Optimal solution

Local minimum

Local maximum

<latexit sha1_base64="dMISHGpDVQrwN8+4pn0XoqLQO1Q=">AAACB3icdZDLSgMxFIYz9VbrrepSkGARKkiZKda2u6IgLivYC3RKOZOmbWgyMyQZoQzdufFV3LhQxK2v4M63Mb1QVPSHwM93ziHn/F7ImdK2/WkllpZXVteS66mNza3tnfTuXl0FkSS0RgIeyKYHinLm05pmmtNmKCkIj9OGN7yc1Bt3VCoW+Ld6FNK2gL7PeoyANqiTPnQF6AEBHl+Ns65HNXTyp9jtgxDGnXTSGTtXLhbK+RJ2cvZU2BCjgr0gGTRXtZP+cLsBiQT1NeGgVMuxQ92OQWpGOB2n3EjREMgQ+rRlrA+CqnY8vWOMjw3p4l4gzfM1ntLvEzEIpUbCM52TrdXv2gT+VWtFuldqx8wPI019MvuoF3GsAzwJBXeZpETzkTFAJDO7YjIACUSb6FImhMXt/5t6Puec5/I3Z5nKxTyOJDpARyiLHFREFXSNqqiGCLpHj+gZvVgP1pP1ar3NWhPWfGYf/ZD1/gXwhpi6</latexit>F(�2, �2)

<latexit sha1_base64="mda92S73EYvx04ONmM/rCV+JW2c=">AAACB3icdZDLSgMxFIYz9VbrrepSkGARKkiZKda2u6IgLivYC3RKOZOmbWgyMyQZoQzdufFV3LhQxK2v4M63Mb1QVPSHwM93ziHn/F7ImdK2/WkllpZXVteS66mNza3tnfTuXl0FkSS0RgIeyKYHinLm05pmmtNmKCkIj9OGN7yc1Bt3VCoW+Ld6FNK2gL7PeoyANqiTPnQF6AEBHl+Ns65HNXScU+z2QQjjTjrpjJ0rFwvlfAk7OXsqbIhRwV6QDJqr2kl/uN2ARIL6mnBQquXYoW7HIDUjnI5TbqRoCGQIfdoy1gdBVTue3jHGx4Z0cS+Q5vkaT+n3iRiEUiPhmc7J1up3bQL/qrUi3Su1Y+aHkaY+mX3UizjWAZ6EgrtMUqL5yBggkpldMRmABKJNdCkTwuL2/009n3POc/mbs0zlYh5HEh2gI5RFDiqiCrpGVVRDBN2jR/SMXqwH68l6td5mrQlrPrOPfsh6/wLtcpi4</latexit>F(�1, �1)

Figure 4: The solution space is represented in dependenceof parameters β, γ used for F . The goal is to find a set ofparameters that guides F to a global minimum, where thedesired solution lies. F is decomposed into p = 2 steps andthe chosen parameters lead it to the optimal solution.

A summary of the QAOA algorithm is given in Fig-ure 5 (a). It consists of a quantum part that applies aproblem-encoding function F step-wise on a quantumregister, which is first brought into uniform superpo-sition by H-gates (blue, so-called Hadamard - gates).Each qubit encodes a single plan, thus the quantumregister can represent any solution to the MQO. Be-cause F is applied step-wise, multiple parametrizedfunctions F(β, γ) appear on the quantum circuit, eachtime with a different set of parameters. The numberof appearances is denoted as p. Finally, the quantumcircuit is measured (red) and the resulting solutionsare fed to the classical part. Based on the qualityof the solution4, the classical computer calculates anew set of parameters (β1, γ1), . . . , (βp, γp) which areexpected to evolve F more effectively, thus produc-ing better solutions. As a classical optimization tech-nique, gradient descent may be used [43, 30]. Thisclosed loop is repeated I times until convergence, ora threshold is reached (see Fig. 5 (b)). The opti-mization of β and γ is crucial to the success of thealgorithm and is discussed at the end of this section.

4.2 Revealing F ’s Problem EncodingUntil now, F has been treated as black-box function,encoding the problem with qualitative constraintspreviously defined in the form of rewards and penal-ties. Quantitatively, the constraints can be formu-lated in terms of a classical cost function to be min-imized, similar to [40]. To distinguish this cost func-tion from the intuitive problem-encoding function F ,we subsequently call the classical cost function FC .The variables of the cost functions are equal to thesolution-encoding bit strings (see Section 3) in theform [p1, p2, p3, p4] e.g. [0, 1, 1, 0].

For the MQO, the cost function FC encompassesthree sums for the constraints and is defined as followsaccording to [40]. The sums are directly derived fromthe rules R1 to R3 defined in Section 1.

4It is computationally inexpensive to evaluate a solution, seeSection 3.

6

Page 7: Multiple Query Optimization using a Hybrid Approach of

<latexit sha1_base64="1e2YKhEQ2T8xnhjGHaGpDF8SQ84=">AAAB6HicbVDLTgJBEOzFF+IL9ehlIjHxRHaJUY9ELxwhkUcCGzI79MLI7OxmZtaEEL7AiweN8eonefNvHGAPClbSSaWqO91dQSK4Nq777eQ2Nre2d/K7hb39g8Oj4vFJS8epYthksYhVJ6AaBZfYNNwI7CQKaRQIbAfj+7nffkKleSwfzCRBP6JDyUPOqLFSo9YvltyyuwBZJ15GSpCh3i9+9QYxSyOUhgmqdddzE+NPqTKcCZwVeqnGhLIxHWLXUkkj1P50ceiMXFhlQMJY2ZKGLNTfE1MaaT2JAtsZUTPSq95c/M/rpia89adcJqlByZaLwlQQE5P512TAFTIjJpZQpri9lbARVZQZm03BhuCtvrxOWpWyd12uNK5K1bssjjycwTlcggc3UIUa1KEJDBCe4RXenEfnxXl3PpatOSebOYU/cD5/AJ/DjNM=</latexit>

H<latexit sha1_base64="1e2YKhEQ2T8xnhjGHaGpDF8SQ84=">AAAB6HicbVDLTgJBEOzFF+IL9ehlIjHxRHaJUY9ELxwhkUcCGzI79MLI7OxmZtaEEL7AiweN8eonefNvHGAPClbSSaWqO91dQSK4Nq777eQ2Nre2d/K7hb39g8Oj4vFJS8epYthksYhVJ6AaBZfYNNwI7CQKaRQIbAfj+7nffkKleSwfzCRBP6JDyUPOqLFSo9YvltyyuwBZJ15GSpCh3i9+9QYxSyOUhgmqdddzE+NPqTKcCZwVeqnGhLIxHWLXUkkj1P50ceiMXFhlQMJY2ZKGLNTfE1MaaT2JAtsZUTPSq95c/M/rpia89adcJqlByZaLwlQQE5P512TAFTIjJpZQpri9lbARVZQZm03BhuCtvrxOWpWyd12uNK5K1bssjjycwTlcggc3UIUa1KEJDBCe4RXenEfnxXl3PpatOSebOYU/cD5/AJ/DjNM=</latexit>

H<latexit sha1_base64="1e2YKhEQ2T8xnhjGHaGpDF8SQ84=">AAAB6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VPSHwM93ziHn/F7ImdK2/WkllpZXVteS66mNza3tnfTuXl0FkSS0RgIeyKYHinLm05pmmtNmKCkIj9OGN7yc1Bt3VCoW+Ld6FNK2gL7PeoyANqiTPnQF6AEBHl+Ns65HNXScU+z2QQjjTjrpjJ0rFwvlfAk7OXsqbIhRwV6QDJqr2kl/uN2ARIL6mnBQquXYoW7HIDUjnI5TbqRoCGQIfdoy1gdBVTue3jHGx4Z0cS+Q5vkaT+n3iRiEUiPhmc7J1up3bQL/qrUi3Su1Y+aHkaY+mX3UizjWAZ6EgrtMUqL5yBggkpldMRmABKJNdCkTwuL2/009n3POc/mbs0zlYh5HEh2gI5RFDiqiCrpGVVRDBN2jR/SMXqwH68l6td5mrQlrPrOPfsh6/wLtcpi4</latexit>F(�1, �1)

(b)

Figure 5: (a) The QAOA’s quantum circuit prepares theuniform superposition by applying H gates, followed byparametrized application of F(β, γ) and concludes by mea-suring the quantum register’s state. Each query planp1, . . . , p4 is encoded by a qubit. After each iterator of thealgorithm, the parameters are optimized by a classical com-puter and fed back to the quantum circuit. (b) Parametersare improved over multiple iterations. Each iteration allowsF to better reach the optimal solution.

FC = S1 + S2 + S3 (8)

S1, S2 and S3 are defined as follows:

S1 =P∑i=1

pi · (ci − wmin) (9)

S2 = −∑s∈S

si,j · pi · pj (10)

S3 =Q∑i=1

∑pk,pj∈qi

wmax · pk · pj (11)

wmin = max(C) + ε (12)

wmax = wmin +∑s∈S

s (13)

We will now analyze the three sums S1, S2 and S3in more detail.S1 calculates the costs ci of all query plans pi. The

term wmin gives an incentive to select at least oneplan. Moreover, the constant ε ensures that wmin isslightly larger than the plan with the maximum costand guarantees that at least one plan is selected forevery query.

S2 calculates the total savings si,j of shared re-sources between query plans pi and pj , i.e. S2 rewardssavings if the plan pairs pi, pj are selected, for whichsavings si,j are applicable.S3 penalizes solutions that select more than one

plan per query. As this is a non-negotiable constraint,it is multiplied by wmax to dominate any bonus.

Example 3 To illustrate the cost function, we applyit on the example MQO. Recall that the costs for theplans p1, p2, p3, p4 are 3, 13, 21 and 1 - as shown pre-viously in Example 2. When the plans p2 and p3are selected, they have a cost saving of s2,3 = 14.For this example we set ε to 1. For all solutions,we calculate wmin = max(3, 13, 21, 1) + 1 = 22 andwmax = wmin + 14 = 36. [p1, p2, p3, p4] = [1, 0, 1, 1]is a non-admissible solution, as it selects plans p1, p3and p4, where p3 and p4 produce the same query q2.For the solution, we calculate S1 = (3− 22) + (21−

22) + (1− 22) = −41. Then, S2 is calculated easily asthere are no savings between the selected plans henceS2 = 0. Finally, S3 = wmax · p3 · p4 = 36, whichrepresents the penalty due to two selected plans forthe same query. The complete sum is given by S1 +S2 + S3 = −41 + 0 + 36 = −5.Now, we calculate the cost for the valid and optimal

solution [p1, p2, p3, p4] = [1, 0, 0, 1]. S1 = (3-22) + (1-22) = -40. Because no savings apply between plansp1 and p4 we set S2 = 0. S3 = 0 as well, becausewmax · p1 · p2 = 36 · 1 · 0 = 0 and wmax · p3 · p4 =36 · 0 · 1 = 0, therefore there is no pair of pi, pj forthe same query whose product is 1. Thus, the sum ofS1 + S2 + S3 = −40 + 0 + 0 = −40.The second solution with −40 yields a lower value

than the first solution with −5, which is desired forminimization of the cost function. Consequently thequery plan [1, 0, 0, 1] is preferred over the query plan[1, 0, 1, 1].

As the sums S2 and S3 are quadratic terms (i.e.they contain the product of the two variables pi, pj),this cost function is classified as a quadratic cost func-tion. In the literature, this class of problem is alsoknown as Quadratic Unconstrained Binary Optimiza-tion (QUBO) [40, 16]. Problems in the QUBO for-mulation have a similar form to problems solvableby Quantum Computers5 [2, 17]. Here, we omit thequantum mechanical intricacies, but refer to [12, 30]for a more detailed explanation of this relationship.

4.3 Implementing FC as Quantum CircuitOn a practical level, the relation between the QUBOform of FC and quantum computing is due to quan-tum gates that typically act on one or two qubitsand QUBO problems that feature one or two vari-ables in every term. Hence, linear variables of the

5More precisely, these are Ising models, described by Hamil-tonian matrices[27].

7

Page 8: Multiple Query Optimization using a Hybrid Approach of

Multiple Query Optimization

<latexit sha1_base64="5M1/cQ6LpbM5EZXthwqseWV2kRE=">AAAB7HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF/FUwbSFNpTNdtMu3eyG3Y0QQn+DFw+KePUHefPfuG1z0NYHA4/3ZpiZFyacaeO6305pbX1jc6u8XdnZ3ds/qB4etbVMFaE+kVyqbog15UxQ3zDDaTdRFMchp51wcjvzO09UaSbFo8kSGsR4JFjECDZW8vv3kolBtebW3TnQKvEKUoMCrUH1qz+UJI2pMIRjrXuem5ggx8owwum00k81TTCZ4BHtWSpwTHWQz4+dojOrDFEklS1h0Fz9PZHjWOssDm1njM1YL3sz8T+vl5roOsiZSFJDBVksilKOjESzz9GQKUoMzyzBRDF7KyJjrDAxNp+KDcFbfnmVtBt177LeeLioNW+KOMpwAqdwDh5cQRPuoAU+EGDwDK/w5gjnxXl3PhatJaeYOYY/cD5/ALOxjp8=</latexit>on

C ... ... ... ... ... ... ... ... ... ... ... ...

<latexit sha1_base64="5M1/cQ6LpbM5EZXthwqseWV2kRE=">AAAB7HicbVBNS8NAEJ3Ur1q/qh69LBbBU0mKqMeiF/FUwbSFNpTNdtMu3eyG3Y0QQn+DFw+KePUHefPfuG1z0NYHA4/3ZpiZFyacaeO6305pbX1jc6u8XdnZ3ds/qB4etbVMFaE+kVyqbog15UxQ3zDDaTdRFMchp51wcjvzO09UaSbFo8kSGsR4JFjECDZW8vv3kolBtebW3TnQKvEKUoMCrUH1qz+UJI2pMIRjrXuem5ggx8owwum00k81TTCZ4BHtWSpwTHWQz4+dojOrDFEklS1h0Fz9PZHjWOssDm1njM1YL3sz8T+vl5roOsiZSFJDBVksilKOjESzz9GQKUoMzyzBRDF7KyJjrDAxNp+KDcFbfnmVtBt177LeeLioNW+KOMpwAqdwDh5cQRPuoAU+EGDwDK/w5gjnxXl3PhatJaeYOYY/cD5/ALOxjp8=</latexit>on

B ... ... ... ... ... ...

A ... ... ... ... ... … ... ... …

Classical cost function Quantum Circuit

<latexit sha1_base64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FMfI56gnYpRtpIgX1wE6R3WdHrIc4RLOKgAo/hQ5B6nIqsVArsglN2xoDzxJ2SApiiFthfXifCCSdCY4aUartOrP0USU0xI1neSxSJER6gHmkbKhAnyk/Hf2TwyCgd2I2kKaHhWP09kSKu1JCHppMj3Vez3kj8z2snunvup1TEiSYCTxZ1EwZ1BEehwA6VBGs2NARhSc2tEPeRRFib6PImBHf25XnSqJTd03Ll+qRQvZjGkQP74BAUgQvOQBVcgRqoAwwewTN4BW/Wk/VivVsfk9YFazqzB/7A+vwBhpeX0Q==</latexit>

RZ(�(c2 � wmin))

<latexit sha1_base64="0USQhXTybxlApdzZ4ZDPi440I1o=">AAACB3icbVDLSgMxFM3UV62vUZeCBIvQLiwzVdRl0Y3LKvaBbRkyadqGJpkhyShlmJ0bf8WNC0Xc+gvu/BvTdhbaeuDC4Zx7ufceP2RUacf5tjILi0vLK9nV3Nr6xuaWvb1TV0EkManhgAWy6SNFGBWkpqlmpBlKgrjPSMMfXo79xj2RigbiVo9C0uGoL2iPYqSN5Nn7N158lxTafcQ5ggXsHcMj+ODFbU5FUix6dt4pORPAeeKmJA9SVD37q90NcMSJ0JghpVquE+pOjKSmmJEk144UCREeoj5pGSoQJ6oTT/5I4KFRurAXSFNCw4n6eyJGXKkR900nR3qgZr2x+J/XinTvvBNTEUaaCDxd1IsY1AEchwK7VBKs2cgQhCU1t0I8QBJhbaLLmRDc2ZfnSb1cck9L5euTfOUijSML9sABKAAXnIEKuAJVUAMYPIJn8ArerCfrxXq3PqatGSud2QV/YH3+AIgol9I=</latexit>

RZ(�(c3 � wmin))

<latexit sha1_base64="U8jArtctywE4HXH94V9MtBX/ttM=">AAACB3icbVDLSgMxFM3UV62vUZeCBIvQLiwzpajLohuXVewDO2XIpGkbmmSGJKOUYXZu/BU3LhRx6y+4829MHwttPXDhcM693HtPEDGqtON8W5ml5ZXVtex6bmNza3vH3t1rqDCWmNRxyELZCpAijApS11Qz0ookQTxgpBkML8d+855IRUNxq0cR6XDUF7RHMdJG8u3DGz+5SwteH3GOYAH7FXgCH/zE41SkxaJv552SMwFcJO6M5MEMNd/+8rohjjkRGjOkVNt1It1JkNQUM5LmvFiRCOEh6pO2oQJxojrJ5I8UHhulC3uhNCU0nKi/JxLElRrxwHRypAdq3huL/3ntWPfOOwkVUayJwNNFvZhBHcJxKLBLJcGajQxBWFJzK8QDJBHWJrqcCcGdf3mRNMol97RUvq7kqxezOLLgAByBAnDBGaiCK1ADdYDBI3gGr+DNerJerHfrY9qasWYz++APrM8fibmX0w==</latexit>

RZ(�(c4 � wmin))

<latexit sha1_base64="y/aIIq1OaOmcvNjziJY2Ly2Glog=">AAAB/3icbVDLSgMxFM3UV62vUcGNm2ARKkiZqaIui25cVrEP2g5DJk3b0CQzJBmhjLPwV9y4UMStv+HOvzFtZ6HVAxcO59zLvfcEEaNKO86XlVtYXFpeya8W1tY3Nrfs7Z2GCmOJSR2HLJStACnCqCB1TTUjrUgSxANGmsHoauI374lUNBR3ehwRj6OBoH2KkTaSb+/d+km7nZa6A8Q5gspPKscn6ZFvF52yMwX8S9yMFEGGmm9/dnshjjkRGjOkVMd1Iu0lSGqKGUkL3ViRCOERGpCOoQJxorxken8KD43Sg/1QmhIaTtWfEwniSo15YDo50kM1703E/7xOrPsXXkJFFGsi8GxRP2ZQh3ASBuxRSbBmY0MQltTcCvEQSYS1iaxgQnDnX/5LGpWye1au3JwWq5dZHHmwDw5ACbjgHFTBNaiBOsDgATyBF/BqPVrP1pv1PmvNWdnMLvgF6+MbcmWVFg==</latexit>

RZZ(�s2,3)

<latexit sha1_base64="0Q+2yaYd6QtehNKRKrYxU9E5xIA=">AAACAHicbVC5TsNAEF2HK4TLQEFBsyJCCk1kRwgoI2goAyKHcsgabzbJKru2tbsGIssNv0JDAUK0fAYdf8PmKCDhSSM9vTejmXl+xJnSjvNtZZaWV1bXsuu5jc2t7R17d6+mwlgSWiUhD2XDB0U5C2hVM81pI5IUhM9p3R9ejf36PZWKhcGdHkW0I6AfsB4joI3k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jDJEfijNExpl6u+NBAdKTQPPTKYp1aKXiv95vVj7V27CRBRrKsj8kB9zpEOUVoCGTFKi+dQQTCQzWREZY4mJNkWVTAnO4peXSbtWdS6qteZ5pX6d11GEIziGU3DgEupwCw1oAQEJz/AKb9aT9WK9Wx/z0YKV7xzCH1ifP2NiknE=</latexit>SQ3

Figure 6: Overview of the problem encoding. First, the MQO is formulated into a quadratic classical cost function (QUBO)FC . Due to the similarity with quantum gates, this function is finally implemented as a quantum circuit FQ with rotationalgates.

classical cost function are translated into two stan-dard gates in quantum computing, a quantum ro-tation gate RZ(θ) with the parameter θ being pro-portional to the scalar (such as cost) the variable ismultiplied with. Quadratic variables are implementedusing RZZ(θ)-gates (another standard type of gate)acting on two qubits, representing the two variables.We subsequently call the quantum-gate implementa-tion of the classical cost function FQ, or quantum costfunction.

Example 4 To illustrate the implementation considerthe example MQO. First, the linear (quantum) sumS1 is implemented:

SQ1 =N∑i=1

RZ(γ(ci − wmin)) |pi〉 (14)

acting on the qubits |pi〉 that encode the plans.Note that the factor γ controlling the step size forgate-based quantum computer is encompassed as well.Here, this sum produces one RZ-gate for every plani.e. qubit. Assuming γ = 0.5, we obtain for the firstplan that has cost of 3 and with wmin that is 22 thegate RZ(0.5 · (3− 22)) |p1〉, where |p1〉 is the qubit thegate is applied to. The plans p2 to p4 are created inthe same manner.Quadratic sums are implemented analogously, as

for instance with SQ2, which is internally quadratic:

SQ2 = −∑s∈S

RZZ(γsi,j) |pi, pj〉 (15)

This gives us a gate for every saving, which is pair-wise between plans. As there is only a single savingbetween plans p2 and p3 with the value 14, the quan-tum gate is RZZ(0.5 · (−14)) |p2, p3〉. Note that thenegative sign of the sum has been taken in front of thesaving’s cost as gate parameter.Lastly, SQ3 is implemented as follows:

SQ3 =Q∑i=1

∑pi,pj∈qi

RZZ(γwmax) |pi, pj〉 (16)

<latexit sha1_base64="EifKk2OMkzZweTzzY4FCgnd5ylY=">AAAB6nicbVBNS8NAEJ3Ur1q/qh69LBbBU0mK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3T33UyriRBOBJ4u6CYM6gqNQYIdKgjUbGoKwpOZWiPtIIqxNdHkTgjv78jxpVMruablyfVKoXkzjyIF9cAiKwAVnoAquQA3UAQaP4Bm8gjfryXqx3q2PSeuCNZ3ZA39gff4AhQaX0A==</latexit>

RZ(�(c1 � wmin))

<latexit sha1_base64="BOgH7wbeyno55taO3emTcCJDGTI=">AAACB3icbVDLSgMxFM34rPU16lKQYBHahWWmiLosunFZxT6wMwyZNG1Dk8yQZJQyzM6Nv+LGhSJu/QV3/o3pY6GtBy4czrmXe+8JY0aVdpxva2FxaXllNbeWX9/Y3Nq2d3YbKkokJnUcsUi2QqQIo4LUNdWMtGJJEA8ZaYaDy5HfvCdS0Ujc6mFMfI56gnYpRtpIgX1wE6R3WdHrIc4RLOKgAo/hQ5B6nIqsVArsglN2xoDzxJ2SApiiFthfXifCCSdCY4aUartOrP0USU0xI1neSxSJER6gHmkbKhAnyk/Hf2TwyCgd2I2kKaHhWP09kSKu1JCHppMj3Vez3kj8z2snunvup1TEiSYCTxZ1EwZ1BEehwA6VBGs2NARhSc2tEPeRRFib6PImBHf25XnSqJTd03Ll+qRQvZjGkQP74BAUgQvOQBVcgRqoAwwewTN4BW/Wk/VivVsfk9YFazqzB/7A+vwBhpeX0Q==</latexit>

RZ(�(c2 � wmin))

<latexit sha1_base64="0USQhXTybxlApdzZ4ZDPi440I1o=">AAACB3icbVDLSgMxFM3UV62vUZeCBIvQLiwzVdRl0Y3LKvaBbRkyadqGJpkhyShlmJ0bf8WNC0Xc+gvu/BvTdhbaeuDC4Zx7ufceP2RUacf5tjILi0vLK9nV3Nr6xuaWvb1TV0EkManhgAWy6SNFGBWkpqlmpBlKgrjPSMMfXo79xj2RigbiVo9C0uGoL2iPYqSN5Nn7N158lxTafcQ5ggXsHcMj+ODFbU5FUix6dt4pORPAeeKmJA9SVD37q90NcMSJ0JghpVquE+pOjKSmmJEk144UCREeoj5pGSoQJ6oTT/5I4KFRurAXSFNCw4n6eyJGXKkR900nR3qgZr2x+J/XinTvvBNTEUaaCDxd1IsY1AEchwK7VBKs2cgQhCU1t0I8QBJhbaLLmRDc2ZfnSb1cck9L5euTfOUijSML9sABKAAXnIEKuAJVUAMYPIJn8ArerCfrxXq3PqatGSud2QV/YH3+AIgol9I=</latexit>

RZ(�(c3 � wmin))

<latexit sha1_base64="U8jArtctywE4HXH94V9MtBX/ttM=">AAACB3icbVDLSgMxFM3UV62vUZeCBIvQLiwzpajLohuXVewDO2XIpGkbmmSGJKOUYXZu/BU3LhRx6y+4829MHwttPXDhcM693HtPEDGqtON8W5ml5ZXVtex6bmNza3vH3t1rqDCWmNRxyELZCpAijApS11Qz0ookQTxgpBkML8d+855IRUNxq0cR6XDUF7RHMdJG8u3DGz+5SwteH3GOYAH7FXgCH/zE41SkxaJv552SMwFcJO6M5MEMNd/+8rohjjkRGjOkVNt1It1JkNQUM5LmvFiRCOEh6pO2oQJxojrJ5I8UHhulC3uhNCU0nKi/JxLElRrxwHRypAdq3huL/3ntWPfOOwkVUayJwNNFvZhBHcJxKLBLJcGajQxBWFJzK8QDJBHWJrqcCcGdf3mRNMol97RUvq7kqxezOLLgAByBAnDBGaiCK1ADdYDBI3gGr+DNerJerHfrY9qasWYz++APrM8fibmX0w==</latexit>

RZ(�(c4 � wmin))

<latexit sha1_base64="y/aIIq1OaOmcvNjziJY2Ly2Glog=">AAAB/3icbVDLSgMxFM3UV62vUcGNm2ARKkiZqaIui25cVrEP2g5DJk3b0CQzJBmhjLPwV9y4UMStv+HOvzFtZ6HVAxcO59zLvfcEEaNKO86XlVtYXFpeya8W1tY3Nrfs7Z2GCmOJSR2HLJStACnCqCB1TTUjrUgSxANGmsHoauI374lUNBR3ehwRj6OBoH2KkTaSb+/d+km7nZa6A8Q5gspPKscn6ZFvF52yMwX8S9yMFEGGmm9/dnshjjkRGjOkVMd1Iu0lSGqKGUkL3ViRCOERGpCOoQJxorxken8KD43Sg/1QmhIaTtWfEwniSo15YDo50kM1703E/7xOrPsXXkJFFGsi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vZhjHeJxGrjLJCWajwwBIpm5FZMBSCDaZJYzIbjzLy+SWqnonhVLN6f58uUsjiw6REeogFx0jsroGlVQFRGUomf0it6sJ+vFerc+pq0Zazazj/7A+vwBRdaWNQ==</latexit>

RZZ(�wmax)

<latexit sha1_base64="F6ICnqtG4sMUZngj10Tq4QBx7eM=">AAACBXicbVBNS8NAEN3Ur1q/oh71sFiEClKSIuqxKIjHFuwHNKFMttt26W4SdjdCCb148a948aCIV/+DN/+Nm7YHrT4YeLw3w8y8IOZMacf5snJLyyura/n1wsbm1vaOvbvXVFEiCW2QiEeyHYCinIW0oZnmtB1LCiLgtBWMrjO/dU+lYlF4p8cx9QUMQtZnBLSRuvahJ0APCfD0ZtKtl7yAajjF3gCEgJOuXXTKzhT4L3HnpIjmqHXtT68XkUTQUBMOSnVcJ9Z+ClIzwumk4CWKxkBGMKAdQ0MQVPnp9IsJPjZKD/cjaSrUeKr+nEhBKDUWgenMblaLXib+53US3b/0UxbGiaYhmS3qJxzrCGeR4B6TlGg+NgSIZOZWTIYggWgTXMGE4C6+/Jc0K2X3vFypnxWrV/M48ugAHaESctEFqqJbVEMNRNADekIv6NV6tJ6tN+t91pqz5jP76Besj29u1Zfi</latexit> F Q(�

,�)

<latexit sha1_base64="45cejcCd+tCIjNTUnuFs7oGc88Y=">AAAB9XicbVDLSgMxFL3js9ZX1aWbYBFclZki6rLoxmWL9gHtWDJppg3NJEOSUcrQ/3DjQhG3/os7/8ZMOwttPRA4nHMv9+QEMWfauO63s7K6tr6xWdgqbu/s7u2XDg5bWiaK0CaRXKpOgDXlTNCmYYbTTqwojgJO28H4JvPbj1RpJsW9mcTUj/BQsJARbKz00IuwGRHM07vGtO/1S2W34s6AlomXkzLkqPdLX72BJElEhSEca9313Nj4KVaGEU6nxV6iaYzJGA9p11KBI6r9dJZ6ik6tMkChVPYJg2bq740UR1pPosBOZin1opeJ/3ndxIRXfspEnBgqyPxQmHBkJMoqQAOmKDF8YgkmitmsiIywwsTYooq2BG/x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1ifP2NiknE=</latexit>SQ3

Figure 7: The final quantum circuit encoding for FQ. Thelinear sum SQ1 acts with single-qubit gates that penalize(high) costs. SQ2 is quadratic and rewards savings on qubitsp2, p3 as they apply for the corresponding plans. Finally, SQ3penalizes the selection of more than one plan per query, andtherefore acts on each pair of plans for a query.

This sum typically contributes the majority of gatesas all plans within a query must be pairwisly con-nected. Recall that wmax equals to 36. For query q1this yields the gate RZZ(0.5 ·36) |p1, p2〉 and for queryq2 the gate RZZ(0.5 · 36) |p3, p4〉.A general analysis of the amount of quantum gates

depending on the problem size is given at the end ofSection 5.

This notation is arguably cumbersome, and the en-coding is better readable in the form of a quantumcircuit, depicted in Figure 7. In difference to theclassical cost function, an additional array of gatesis necessary due to the adiabatic principle. More pre-cisely, for each qubit encoding a plan |p1〉 , . . . , |pP 〉,a single RX(β)-gate (another standard gate) is ap-pended to FQ. The exact reasons for this requirementare beyond the scope of this work and are treatedin [12, 43]. Intuitively, the RX(β)-gates can be de-scribed as "driver" gates for the quantum annealingevolution6.

4.4 Running the AlgorithmThe hybrid classical-quantum algorithm has two de-grees of freedom. First, the number p of steps FQ isdecomposed into and secondly, the number I of times

6Therefore, the requirement is known as driver Hamiltonian.

8

Page 9: Multiple Query Optimization using a Hybrid Approach of

the circuit is run and parameters β and γ are opti-mized. We subsequently refer to p as depth. Cur-rently, QAOA is in general not well understood fordepths p > 1 [43]. An exception to this is the re-cent contribution by Arute, Frank et al., examiningcircuits with p = 3 on Google’s private Sycamorequantum device [21]. Although higher depth theo-retically leads to better results, as the quantum an-nealing evolves "smoother" (see Fig. 4), more gatescontribute to more error [12]. Hence, the depth pshould be chosen carefully depending on factors suchas problem size or error rate of the quantum device.As each additional layer of FQ contributes anotherpair of parameters β and γ, the parameter space tobe classically optimized quickly increases, as alreadynoted by the original authors [12]. To mitigate thisproblem, Zhou, Wang et al. provide helpful heuristicsand strategies, which they prove by extensive experi-mentation on graph problems [43]. We examine theircontributions and their applicability to our algorithmin the next section.

The low-level hybrid algorithm for the MQO cannow be summarized as follows (see Algorithm 2). Incontrast to the high-level algorithm (see Algorithm1), the MQO is first encoded as a classical cost func-tion FC , which is then translated into a quantum costfunction FQ with the additional "driver" gates. AsFQ is applied in p steps, parameters β, γ are used forthe application of FQ inside the quantum circuit. Af-ter FQ(β, γ) has been applied on the quantum circuit,the measurement represents a solution to the MQOproblem, which we denote by z. The cost of z can beclassically evaluated as shown in Example 4.1.

The parameters are first randomly initiated, andthen classically optimized by a classical computer af-ter each measurement. The goal is to find parame-ters β∗, γ∗ that allow FQ to produce the bit sequenceof the least-cost solution z∗ on the quantum regis-ter. This goal is reached exactly when FQ is applied"most effectively", as introduced at the beginning ofthis section. For that, we minimize the quantum costfunction FQ equivalently as to minimize z

β∗, γ∗ = arg minβ,γFQ(β, γ) (17)

As the algorithm is approximate, the optimizationloop is typically executed until a threshold is reachedinstead of finding the exact solution. Often, an ap-proximation ratio r is used as figure of merit for FQ’sperformance [12]. r is defined as follows:

r = FQ(β, γ)zmin

(18)

where zmin denotes a lower bound for the cost of theMQO problem.

To summarize, the algorithm proceeds as follows:

1. Formulate the MQO into a quantum cost func-tion FQ using a classical computer.

Input : Plan cost C, savings S, amount ofqueries Q, depth p

Output: Least-cost solution z∗Formulate the MQO as FC from C, S and Q;Translate FC into FQ;Define initial parameters β, γ;while r > threshold do

Put quantum register into uniformsuperposition;for i← 1 to p do

Construct FQ(βi, γi) on quantumregister;

endz ← Measure quantum register;Optimize β, γ, e.g. with gradient descend;

endreturn Least-cost solution z∗;Algorithm 2: Low level quantum query optimiza-tion algorithm. Quantum parts are highlighted inblue.

2. Initialize parameters β, γ.

3. Create superposition on quantum register, applyFQ(β, γ) in p steps on the quantum register.

4. Measure the quantum register.

5. Classically optimize β, γ with the goal of mini-mizing the cost of the results and repeat from(3) until threshold is reached.

Figure 8 shows the probability distribution of theoutput of the circuit after 1000 measurements for se-lected iterations of the classical optimizer. Initiallythe probabilities to measure any state are distributedevenly as shown in Figure 8 (a). After 14 iterationsthe most likely state, [1, 0, 0, 0] would represent a non-valid solution as shown in Figure 8 (b). Because theclassical optimizer was able to avoid any local optimain this example, it minimizes the cost function evenfurther and eventually approaches the right solutionas most likely state to be measured - see Figure 8 (c),(d).

5 Experiments and ResultsThe primary objective of our experiments is to de-termine how the hybrid classical-quantum algorithmQAOA scales on current quantum computers, i.e.how well we can solve query optimization problems.Therefore, we compare the performance of variousproblem sizes, i.e. various number of queries and vari-ous numbers of query plans, with different numbers ofrepetitions of FQ - the quantum part of the query op-timization algorithm shown in Algorithm 2. FQ con-tains the QUBO-problem to solve and adds its char-acteristic structure and values to the quantum circuit.

9

Page 10: Multiple Query Optimization using a Hybrid Approach of

(a) Initial state (b) 14 iterations

(c) 28 iterations (d) 40 iterations

Optimal solution

Figure 8: The probability distribution of the measured outputof the QAOA circuit of our example problem. The classicaloptimizer tries to find good parameters for γ and β to amplifythe probability of measuring the solution state that producesthe least costs. The probability of the correct state thatminimizes the costs to the problem is clearly enhanced in (d)and therefore identified as the solution to the problem.

The algorithm’s "division of labor" can be summa-rized as follows. The parametrized quantum part ex-plores the search space. By exploiting quantum prop-erties such as superposition and entanglement, the ex-ploration is typically much faster than by classical ap-proaches. The classical part is concerned with findingparameters γ and β that, fed to the quantum part,direct the exploration into promising regions of thesearch space. With growing problem search space, theparameter search space grows as well [12, 43], makingthe classical optimization challenging.

Therefore, we first analyze the classical part of theQAOA on the Qiskit quantum simulator [2]. In par-ticular, we analyze what makes good γ and β. Af-terwards, we investigate the performance of differentclassical optimizers. The FOURIER strategy [43] is arecent suggestion to improve optimization in the high-dimensional parameter space, by using a heuristic.

Finally, we evaluate the quantum part of our hy-brid classical-quantum algorithm where we run ex-periments on two different instances. For develop-ment and benchmarking, the quantum part of the al-gorithm is executed on the Qiskit quantum simula-tor. For experimentation and benchmarking, it is runon the publicly available ibmq Melbourne [25] device,featuring 15 qubits. This device is also used in recentresearch, including [33]. Our implementation can beexecuted on both instances without modification ofthe code7.

The main difference between quantum simulatorsand real quantum devices is that the simulators pro-duce results without noise. This means that on a sim-ulator, one can work without error correction. With

7The source code is available at: https://github.com/macemoth/QuantumQueryOptimization

<latexit sha1_base64="N29tSf3kwZOyzVWjRFGRSPW6/w8=">AAAB7XicbVDLSgNBEJyNrxhfUY9eBoPgKewGUY9BLx4jmAckS+idzCZj5rHMzAphyT948aCIV//Hm3/jJNmDJhY0FFXddHdFCWfG+v63V1hb39jcKm6Xdnb39g/Kh0cto1JNaJMornQnAkM5k7RpmeW0k2gKIuK0HY1vZ377iWrDlHywk4SGAoaSxYyAdVKrNwQhoF+u+FV/DrxKgpxUUI5Gv/zVGyiSCiot4WBMN/ATG2agLSOcTku91NAEyBiGtOuoBEFNmM2vneIzpwxwrLQrafFc/T2RgTBmIiLXKcCOzLI3E//zuqmNr8OMySS1VJLFojjl2Co8ex0PmKbE8okjQDRzt2IyAg3EuoBKLoRg+eVV0qpVg8tq7f6iUr/J4yiiE3SKzlGArlAd3aEGaiKCHtEzekVvnvJevHfvY9Fa8PKZY/QH3ucPiTWPHA==</latexit>�

<latexit sha1_base64="HimhXT2oXhPZtbqB/YuZuzkYQXo=">AAAB7HicbVBNS8NAEJ34WetX1aOXxSJ4KkkR9Vj04rGCaQttKJvtpl262YTdiVBCf4MXD4p49Qd589+4bXPQ1gcDj/dmmJkXplIYdN1vZ219Y3Nru7RT3t3bPzisHB23TJJpxn2WyER3Qmq4FIr7KFDyTqo5jUPJ2+H4bua3n7g2IlGPOEl5ENOhEpFgFK3k90KOtF+pujV3DrJKvIJUoUCzX/nqDRKWxVwhk9SYruemGORUo2CST8u9zPCUsjEd8q6lisbcBPn82Ck5t8qARIm2pZDM1d8TOY2NmcSh7YwpjsyyNxP/87oZRjdBLlSaIVdssSjKJMGEzD4nA6E5QzmxhDIt7K2EjaimDG0+ZRuCt/zyKmnVa95Vrf5wWW3cFnGU4BTO4AI8uIYG3EMTfGAg4Ble4c1Rzovz7nwsWtecYuYE/sD5/AHGII6r</latexit>

Figure 9: The FOURIER strategy restricts the parametersearch space (light red) based on previous parameters (red).

current hardware, up to 61 qubits can be simulatedusing supercomputers [42], with desktop computers,quantum algorithms below 30 qubits are realistic [2].As current quantum systems feature a comparableamount of qubits, the size of problems our algorithmcan tackle is restricted by both quantum simulatorsand real quantum devices.

5.1 Bootstrapping the Classical OptimizationPart with a FOURIER StrategyWhen FQ is constructed in Algorithm 2, initial val-ues for parameters γ and β need to be set to start theclassical optimization. Usually those values are setrandomly. Initializing γ and β at random has mul-tiple disadvantages. First, the randomly generatedvalues often lead the optimizer to converge againstlocal optima and therefore the circuit returning suboptimal solutions. Second, the more repetitions of FQare applied to the circuit, the more parameters needto be initialized. Hence finding good initial parame-ters through random initialization gets exponentiallymore difficult.

We base our experiments on the FOURIER heuris-tic strategy introduced in [43] which seems to performvery well in finding good initial parameters for γ andβ. Instead of randomly initializing γ and β for everyrepetition of F , the FOURIER strategy advises tocalculate new values for all γi and βi through the fol-lowing transformation based on previously optimizedvalues:

γi =p∑k=1

uk sin[(k − 1

2

)(i− 1

2

p

],

βi =p∑k=1

vk cos[(k − 1

2

)(i− 1

2

p

]

where the parameters (u, v) ∈ R2p correspond tothe parameters (γ, β) ∈ R2p. With this strategy onlythe initial parameters γ1 and β1 are determined ran-domly. Because of the rotational symmetry of qubitstates the initial parameter guess can be restrictedto β1, γ1 ∈ [−π2 ,

π2 ). The schematic procedure for

FOURIER is rendered in Figure 9.

10

Page 11: Multiple Query Optimization using a Hybrid Approach of

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

1 2 3 4 5 6 7 8 9 10

r-va

lue

Nr of repetitions p

FOURIER

avg random

best random

Figure 10: Comparison between the FOURIER strategy andrandomly initialized parameter sets for γ and β. As canbe seen, the FOURIER performs equally as the best of therandomly initialized parameters. The y-axis shows the ap-proximation ratio r.

To verify the results presented in [43] we comparethe performance of the QAOA algorithm with param-eters found through the FOURIER strategy againstrandomly initialized parameters. For the experimentwe first generate a random multiple-query optimiza-tion problem of 4 qubits, i.e. 2 queries with 2 planseach. On that problem we apply the QAOA with dif-ferent numbers of repetitions of F . We perform 30runs of the QAOA with FOURIER as well as withrandomly initialized parameters for each number ofrepetitions of F on the simulator. The result can beseen in Figure 10. The average FOURIER strategyperforms as well as the best randomly found param-eters and is therefore our algorithm of choice for de-termining the parameters of the further experiments.

5.2 Applying Various Classical OptimizationApproachesClassical optimization arises to be the critical part ofthe QAOA because of the challenge to avoid local op-tima. To get around this problem, we evaluate theperformance of the different optimizers provided bythe Qiskit library on the simulator [2]. Additionallyto the classical optimizer provided by Qiskit, we alsouse the PennyLane library with its quantum gradientdescent optimizer [2, 6]. Figure 11 shows the perfor-mance of the different optimizers with respect to thenumber of applications of F in the circuit. All exper-iments are executed on the Qiskit simulator. As canbe seen, for certain optimizers the quality of the so-lution increases with the number of repetitions as thetheory suggests. Because of the steady increase andslight edge of performance of the POWELL optimizer[2], the further experiments are performed using thisoptimizer.

5.3 Hybrid Classical-Quantum OptimizationIn this section we analyze the end-to-end query op-timization problem using a hybrid classical-quantumoptimization algorithm described by Algorithm 2.

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

1 2 3 4 5 6 7 8 9 10

r-valu

e

Nr of repetitions p

PennyLane

ADAM

COBYLA

NELDER_MEAD

NFT

POWELL

SLSQP

TNC

Figure 11: Comparison of the optimizers provided by theQiskit and PennyLane library on 30 different, randomly gener-ated 4 qubit problem instances. The figure shows the averageperformance of the optimizer with regard to the approxima-tion ratio r. As the number of repetitions of F increases, sodoes the performance of POWELL. Besides POWELL alsoNELDERMEAD and COBYLA seem to perform well com-pared to the other optimizers.

First we evaluate how to find the optimal parametersγ and β, i.e. the classical part of Algorithm 2. After-wards, we evaluate how to find the optimal number ofrepetitions of FQ, i.e. the quantum part of Algorithm2. Again, the classical part is run on the simulatorwhile the quantum part is executed on the ibmq Mel-bourne quantum computer.

5.3.1 Classical Part: Finding Optimal Parameters forγ and β

We first analyze the "classical part" of Algorithm 2,i.e. to find the optimal parameter setting of γ andβ. Note that finding the optimal parameters γ and βappears to be the main difficulty to apply the QAOAsuccessfully on quantum computers [12, 43, 21]. Toget to the bottom of the problem, we try to deter-mine what makes good γ and β. Because this stephappens with a classical optimizer e.g. gradient de-scent or other non-linear optimizers in a non-convexcost landscape, the optimizer can severely fail to finda good solution [43]. Therefore, restricting the searchspace to good candidates for γ and β can drasticallyenhance the solution quality and the time consumedby classical optimizers.

To evaluate whether there exist patterns in goodcandidates, we record the parameters which lead toright solutions for different problem sizes. We expecta steady increase in value for the parameter γi com-pared to γj with i > j and a decrease in value forthe parameter βi compared to βj with i > j. Thisbehavior is predicted by the adiabatic principle andshown by [43].

Although the application of the FOURIER strat-egy always resets the initial parameters in a similarway, the classical optimization part finds good solu-tions scattered all over the search space. As can beseen in Figure 12, there is no obvious pattern in theparameter setting of γ∗ and β∗, such that the QAOAcan extract the optimal solution. Hence, the optimalparameter setting must be determined empirically foreach problem.

11

Page 12: Multiple Query Optimization using a Hybrid Approach of

0

1

2

3

4

5

6

7

1 2 3 4 5 6 7 8 9 10

𝛽 𝑖∗ /

𝛽*1

i

(a) Correlation of optimal parameters βi for variousproblems of size 4 Qubits

0

0.5

1

1.5

2

2.5

3

3.5

1 2 3 4 5 6 7 8 9 10

𝛾 𝑖∗ /

𝛾*1

i

(b) correlation of optimal parameters γi for variousproblems of size 4 Qubits

Figure 12: The correlation between parameters of differentFs of a circuit, visualized by plotting the optimal parametersof 35 correctly solved instances of different, randomly gener-ated MQO problems with the QAOA and various optimizers.One line represents all parameters of the same circuit. Forinstance βi is the parameter β of Fi. To make the generateddata comparable to the eye, the initial values are normal-ized and the subsequent values are also divided by the initialvalue.

5.3.2 Quantum Part: Finding Optimal Repetitions ofFQ

Next, we analyze the "quantum part" of Algorithm2, i.e. to find the optimal number of repetitions ofFQ depending on the size of our multiple-query opti-mization problem. In particular, we vary the numberof queries as well as the number of query plans andstudy the probabilities of finding the optimal solution,i.e. the optimal query plan, for various problem sizes.

The QAOA algorithm is currently not well under-stood beyond p = 1 repetitions of FQ. To investigatethe behavior and necessity of more than 1 repetitionfor larger problem sizes, we apply the QAOA on var-ious randomly generated MQO problems up to prob-lem sizes of 14 plans (resulting in the same number ofqubits). In theory, and empirically proven on the sim-ulator in our experiments before, more applications ofFQ should lead to a better approximation of the min-imum cost but at the same time deepening the circuitand increasing the gate induced error [43, 21].

We perform this experiment on the ibmq Mel-bourne quantum computer where we evaluate the ac-curacy of the QAOA on 50 different problems on each

Figure 13: The accuracy of measuring the correct solutionfor problems of size 4 to 14 qubits with 1 up to 10 repetitionsof FQ in the circuit. The accuracy peaks at 59% on probleminstances with 4 qubits i.e. 2 queries with 2 plans each. Onproblems of size 6 qubits the accuracy ceils by 16% with 6repetitions of F . Problem instances of size larger than 8qubits have a 0% accuracy on the ibmq Melbourne in ourexperiment.

problem size.Figure 13 shows the probability of finding the op-

timal solution as a function of the number of qubits,i.e. problem size, and the number of repetitions p ofFQ. We measured the results on problems of size 4to 14 qubits and with 1 to 10 repetitions of FQ inthe circuit. Our experimental results show that for aproblem size of 4 qubits, i.e. 2 queries with 2 queryplans each, the probability of finding the optimal so-lution is 59%. For a problem size of 6 qubits, with 4repetitions of FQ, the optimal solution is found with aprobability of 16%. For problem sizes of 8 qubits andabove, the probability of finding the optimal solutionconverges to zero. In other words, deeper circuits cancurrently not be processed by the ibmq Melbournedevice.

5.4 Experimental Algorithm Run TimesEach run is concluded by measuring the state of thequbits, which is a stochastic procedure. For statistics,the quantum circuit is executed and then measuredmultiple times, where each cycle is called a shot. Typ-ically, thousand to ten thousand shots are conducted[20]. Table 1 shows the minimum, median and maxi-mum run times for four differently sized problems. Forall experiments, five repetitions of F , that is, p = 5were used on the ibmq Melbourne device.

The run times mainly depend on the number ofqubits used, which are determined by the number ofplans × the number of queries. If there are many al-ternative plans for each query (i.e. P is large), the ex-ecution time increases slightly. Although the doublingof qubits used leads to doubling in run times, this cor-relation might be coincidental. The time complexityis analyzed in more detail at the end of this section.Generally, the execution time is not only determined

12

Page 13: Multiple Query Optimization using a Hybrid Approach of

Table 1: Run times of quantum circuits (shots) for differentproblems with the number of queries Q and number of plansper query P in milliseconds.

Run time in msQ P Min. Med. Max.

14 Qbits 7 2 14.2 28.0 35.32 7 23.8 25.0 30.9

7 Qbits 4 2 14.3 15.1 15.22 4 14.6 15.2 15.7

by the amount of gates, but as follows: (time to pre-pare the qubit’s state) + (time per gate) × (amountof gates) + (time to measure) [20].

5.5 Comparison with Competing ApproachesFor the MQO problem [37], a variety of approacheshave been suggested. Early methods were based ongraphs, using algorithms based on A* and branch-and-bound techniques [18, 37]. Since then, integer lin-ear programming [11] and genetic algorithms [5] havebeen proposed, improving prior methods. More recentapproaches employ dynamic programming, while con-sidering multiple cost metrics [41]. In case of the moregeneral class of query optimization problems, learningalgorithms have successfully been applied [39]. Mod-ern approaches extend this approach with the usageof deep learning methods [28, 22].

Whilst almost all of the existing approaches rely onclassical computing architecture, to the best of ourknowledge, there is only one quantum-based solutionto address the MQO suggested by Trummer and Koch[40]. In the following paragraph, we compare thesetwo approaches in more detail.

In their paper, Trummer and Koch utilize a D-Wavequantum annealer with more than 1000 qubits [40],while we employ a gate-based quantum computer with15 qubits [25]. The qubit disparity between quantumannealers and gate-based quantum computers persiststo this day, with quantum annealers featuring almosttwo orders of magnitude more qubits than gate-basedquantum computers [10, 24]. Clearly, the D-Wave de-vice’s superiority in qubits allows it to solve largerproblems with as many as 1074 queries with two planseach, or 540 queries with 5 plans each, as shown inTable 2.

Similarly to our approach, Trummer and Koch as-sign plans to qubits that are either selected or not toform the solution to the MQO. For this, they mapplans as variables to the physical qubits, called phys-ical mapping [40]. The physical layout of the qubitson the D-Wave quantum annealer is represented asChimera graph [29] as in Figure 14.

To model cost savings, which become active whencertain pairs of qubits have been selected for the so-lution, qubits have to interact with each other (this

1

4

234

321

1

8

234

765 5

8

678

765

Figure 14: Chimera graph representing the qubits of the D-Wave quantum annealer [40]. The vertices denote qubitswith the variable number inside and the edges denote con-nections among qubits. As the graph is not fully connected,variables must be mapped to multiple qubits, ensuring thatall variables are fully connected among each other.

is, they are entangled). For this interaction, plan-encoding qubits have to be connected to each other.As the Chimera graph is not fully connected, it isnecessary to encode a plan in multiple qubits to en-sure that the necessary interactions can be facilitated.An example for this encoding is the TRIAD pattern(see Fig. 14) [40], where a total of eight variables aremapped to 24 qubits to become fully connected.

This mapping introduces two restrictions. First,the physical mapping introduces an overhead, in par-ticular with problems that require strong interaction.An example of such a problem is the MQO with manyplans per query. With the requirement to only chooseone plan per query, all plans within that query mustbe connected, augmenting the degree of interaction.As a consequence, with a higher number of plans perquery, around half of the quantum annealer’s qubitsare required for the physical mapping, as shown inTable 2. The second restriction is that the physicalmapping with the minimal number of qubits is itselfan NP-hard problem [26].

Although our approach is heavily limited by thenumber of qubits of gate-based quantum devices, itdoes not suffer both of these restrictions, as all of theavailable qubits can be used to encode plans and thephysical mapping is a one-to-one mapping from a vari-able to a qubit.

Both our approach on QAOA as well as quantumannealing are founded on the quantum-mechanicaladiabatic principle [12, 13, 43]. In quantum annealing,the minimum spectral gap ∆min, informally describedas a property of the problem-encoding function F , de-termines how much time T is required for the adia-batic evolution [43] (we use the conventions and unitsof this work). The relationship is given by

T = 1∆2

min. (19)

Zhou et al. [43] report that some graph-basedproblems ("hard problems") exhibit very small mini-

13

Page 14: Multiple Query Optimization using a Hybrid Approach of

Table 2: Comparison of the approaches by Trummer and Koch [41] and ours. Although the D-Wave quantum device cantackle significantly larger problems, there are situations it can only use a fraction of its qubits.

Trummer and Koch This workMax. # of queries 537 queries, 2 plans 7 queries, 2 plansQubits used 1074 / 1097 (98%) 14 / 14 (100%)Max. # of plans 108 queries, 5 plans 2 queries, 7 plansQubits used 540 / 1097 (49%) 14 / 14 (100%)

mum spectral gaps, thus requiring a very long time toevolve, as described by the relationship above. Whenevolved too quickly, the quantum annealing algorithmcan leave it’s "path", and thus produces a completelydifferent result [13], as illustrated in Figure 15.

Time

Ene

rgy

QAOA

Quantum Annealing

<latexit sha1_base64="wNnmkZoRhRnmaS6FbISkePWsJoE=">AAAB9HicbVBNSwMxEM3Wr1q/qh69BIvgqewWUY9FPXisYD+gu5RsOtuGJtk1yRbK0t/hxYMiXv0x3vw3pu0etPXBwOO9GWbmhQln2rjut1NYW9/Y3Cpul3Z29/YPyodHLR2nikKTxjxWnZBo4ExC0zDDoZMoICLk0A5HtzO/PQalWSwfzSSBQJCBZBGjxFgp8O+AG9LLfMHktFeuuFV3DrxKvJxUUI5Gr/zl92OaCpCGcqJ113MTE2REGUY5TEt+qiEhdEQG0LVUEgE6yOZHT/GZVfo4ipUtafBc/T2REaH1RIS2UxAz1MveTPzP66Ymug4yJpPUgKSLRVHKsYnxLAHcZwqo4RNLCFXM3orpkChCjc2pZEPwll9eJa1a1bus1h4uKvWbPI4iOkGn6Bx56ArV0T1qoCai6Ak9o1f05oydF+fd+Vi0Fpx85hj9gfP5A/yrkkA=</latexit>

�min

Figure 15: The minimum spectral gap ∆min visualized be-tween the blue and red lines as energy states. While quantumannealing is susceptible to leave its path with small ∆minand to follow the red energy state, the QAOA can overcomethis gap and remains close to the desired blue energy state.s = t/T denotes the state of the evolution with the totalannealing time T .

The time required to evolve would in practice ren-der quantum annealing ineffective for those problems.Zhou et al. further report that QAOA can overcomethis limitation, as it adjusts its parameters during theoptimization procedure. Hence, QAOA can concludethe adiabatic evolution much faster and solve prob-lems that can not effectively be solved by quantumannealing. This resistance makes QAOA more robustin tackling these hard problems.

Zhou et al. classify gaps ∆min < 10−3 as very small[43] and thus problematic for quantum annealing. Ex-isting approaches typically compute the minimal gapfor random problem instances [43] or estimate it forparticular problems [13]. Farhi et al. state that theyare in general unable to estimate the gap. Choi [9]examines the effects of the problem8 on the gap an-alytically. Choi notes that the relation between theproblem encoding (introduced as FQ) and the drivergates (see Section 4.3) plays a significant role for theminimum gap. For general search problems, Albash etal. [3] indicate an inverse scaling of the minimum gapwith the number of qubits (i.e. problem size), iden-tifying the gap (-scaling) as a problem for quantumannealing. For the MQO, we numerically evaluatethe minimum gap for several problem instances (see

8More specifically, the problem Hamiltonian.

0.0 0.2 0.4 0.6 0.8 1.0s

0.5

1.0

1.5

Ener

gy

∆min

E0

E1

Figure 16: The minimum spectral gap ∆min = 0.134 be-tween the energy levels E0 and E1 of the example MQO.

Table 3). The energy states of the example problemintroduced in Section 1 are shown in Figure 16.

We observe that with a larger number of plans perquery P , ∆min typically increases. Even when in-creasing the number of qubits (this is, P · Q), theminimum gap grows. This effect is different than re-ported for many problems in the literature. We sug-gest that the benevolent gap scaling is likely due tothe MQO’s problem structure, where the amount ofplans per query P contributes strongly to the amountof qubits but has a positive influence on the minimumgap.

By constructing a problem with small P but largeQ, we indeed find that the minimum gap becomessmaller. Similarly to Zhou et al., we find a MQOproblem instance that has a extremely small gap∆min ≈ 3.33 · 10−16 with plan cost of 8, 42, 49, 3and savings s1,3 = −15, s1,4 = −12, s2,3 = −5 ands2,4 = −14. We suspect that the very small gap par-tially stems from the large savings, and are able toreproduce this problem to some degree by introduc-ing large savings. However, we are not able to find apattern that routinely leads to very small gaps.

This coincides with the observations of most au-thors, that very small gaps are observed for specialinstances found at random rather than by construc-tion. Based on the random problem instances ana-lyzed, we suppose that there may be real MQO in-stances that exhibit very small minimum gaps thatare indeed problematic for quantum annealers andtherefore better tractable by our approach instead ofquantum annealing.

14

Page 15: Multiple Query Optimization using a Hybrid Approach of

Plans QubitsP ∆min # of qubits ∆min

2 0.134 4 0.1343 0.180 6 0.0764 0.169 8 0.1405 0.262 10 0.213

Table 3: Minimum gaps for different numbers of plans P withfixed Q = 2 (left) and for different number of qubits (right).The instances on the RHS consist of different combinationsof Q and P to satisfy P ·Q = # of qubits.

5.6 Scaling the ProblemCurrent quantum devices are severely limited by thenumber of qubits they feature. Moreover, gate-basedquantum computers, as used for this work, are ad-ditionally restricted because each operation intro-duces non-negligible error [34, 43]. Quantum algo-rithms, such as Shor’s algorithm [38] assume avail-ability of fault-tolerant quantum computers compris-ing millions of qubits [30]. Those computers cannotbe constructed currently. In addition, algorithms de-signed to run on near-term quantum computers, suchas QAOA [12], can currently only be used to solvevery small proof-of-concept problems. Hence, solvingsuch problems on current gate-based quantum com-puters gives only limited insight in the real-world useof quantum algorithms. Simulators remain to experi-mentally examine quantum algorithms merely beyondthis insight9. Nevertheless, it remains to analyzequantum algorithms analytically. In the next para-graph we analyze our algorithm in terms of scaling,as the intention is to devise quantum algorithms thatpotentially solve problems faster than classical com-puters.

We provide a sketch of the computational complex-ity of our algorithm and compare it with the classicalbrute-force approach introduced in Section 3. Recallthat for the MQO, we denote the number of queries byQ, the number of plans per query by P and the totalnumber of plans by PQ. For each of the Q queries,one of the P plans must be selected. With this re-quirement, only admissible solutions remain.

q1 q2 . . . qQp1, p2, p3︸ ︷︷ ︸ p4, p5, p6︸ ︷︷ ︸ . . . pPQ−2, pPQ−1, pPQ

P poss. P poss. . . . PQ possibilities

By brute force, PQ possibilities must be evalu-ated10. Considering a constant time to evaluate thecost of each solution, the complexity of the brute forceapproach is as follows:

9A notable exception is Arute et al.’s experiment, claimingto outperform a classical simulation [4].

10If we included non-admissible solutions with no or morethan one plan per query, 2P Q evaluations would be required.

O(BruteForce) = O(PQ) (20)For the quantum approach, we focus on the quan-

tum part and assume the complexity of the classicoptimization as constant O(1). Furthermore, we as-sume the complexity for formulating the MQO into aclassical cost function, and into a quantum circuit tobe constant.

The space complexity of the quantum circuit cantrivially be answered as O(P ) because our approachrequires exactly one qubit for every plan of the MQO.The time complexity for quantum computations istypically determined by the depth of the quantumcircuit [20]. This is because the depth indicates thelongest succession of gates that must be executed se-quentially. The time required for a computation tocomplete is obtained by multiplying the amount ofoperations with the average time a quantum gate re-quires [20].

For the complexity sketch, we split the quantumcost function FQ into its three sums SQ1 to SQ3.SQ1 contains linear terms and only adds one gate toeach qubit. Because these gates are executed simul-taneously, the complexity is constant with O(1).SQ2 is a quadratic sum and appends a gate for

every pair of plans that, when active, save costs. Al-though very untypical, every plan could potentiallyexhibit cost savings when selected with any other plan(e.g. when there is an intermediate result that can bereused for all queries). The number of all plan pairsis then PQ(PQ − 1)/2, resulting in a complexity ofO((PQ)2). Because only one plan can be selectedper query, plans for the same query could never formpairs. Because of this, we consider this estimate anupper bound.

Finally, SQ3 is another quadratic sum. It penal-izes the selection of more than one plan per query.For this, it connects all P plans inside a query witheach other pairwisely by adding a gate to every pair.Similar to above, all plan pairs inside the query areP (P − 1)/2, contributing to a complexity of O(P 2).These gates can be applied simultaneously for allqueries, therefore, the number of queries is not de-cisive.

As the three components of FQ are sequentiallyconnected, the individual complexity sketches can beadded. Because FQ is run I times in the optimizationloop with the classical optimizer (which is assumedO(1) here), the complexity of QAOA is

O(QAOA) = O(I)·(O(P )+O((PQ)2)+O(P 2)) (21)

After reformulation, we end up with the followingcomplexity of QAOA:

O(QAOA) = O(I · (PQ)2) (22)Compared to the brute force complexity of O(PQ),

this is a significant speedup. For comparison, Grover’s

15

Page 16: Multiple Query Optimization using a Hybrid Approach of

Table 4: Amount of operations for solving a multiple queryoptimization problem as a function of the problem size, i.e.the number of queries Q and the number of plans P . Theclassical approach is a brute force algorithm. Our approachis the hybrid quantum-classical approach QAOA.

# of operationsProblem size Brute Force QAOAQ = 2, P = 2 4 16Q = 10, P = 10 1010 105

Q = 100, P = 10 10100 106

algorithm for searching an unstructured list achievesa speedup from O(n) to O(

√n). This suggests that

the quantum part of the algorithm does not only workfor very small problems, but also for real-world sizedproblems, as the number of gates grows moderately.

Example 5 In both classical and quantum computing,the amount of operations determines the time and fea-sibility for a computation [31, 20]. In this example,we estimate and compare the amount of operations ofthe QAOA algorithm with the brute force approach fordifferent problem sizes (see Table 4). For our quantumquery optimization algorithm, we neglect the numberof iterations of the optimization loop, as the same cir-cuit is run in each iteration. Thus, the number of it-erations does not determine the amount of quantumgates required.With larger problem instances, our algorithm re-

quires clearly fewer operations than a brute force al-gorithm. Still, the two larger problem sizes could notbe solved on a current gate-based quantum computer[25], and as described previously.

The complexity sketch above, however, neglects thenon-trivial classical optimization procedure, which isanalyzed in Zhou et al. [43] and from a more theoret-ical aspect in Farhi and Harrow [14]. In the same pa-per, Farhi and Harrow analyze the prospects of QAOAfor near-term quantum devices and as candidate fora problem-solving technique superior to any classicalapproach. Guerreschi and Mazuura [20] argue thatthe necessary speedup with QAOA can be attainedwith hundreds of qubits. They also propose a com-plete estimate on the computational time of realisticQAOA applications.

6 ConclusionIn this paper we have proposed a hybrid classical-quantum algorithm based on the Quantum Approx-imate Optimization Algorithm to find quasi-optimalsolutions for the multiple query optimization problem,a classical problem in database optimization. Our al-gorithm is designed for near-term gate-based quantumcomputers, consisting of a parametrized quantum part

for exploring the search space, and a classical part op-timizing the parameters. Our approach is the firstcontribution to use gate-based quantum computersfor tackling query optimization. While the classicalpart of hybrid classical-quantum algorithms is typi-cally difficult due to the high-dimensional parameterspace, we implemented a recently suggested strategyas remedy, thus improving the solution quality.

As current-day gate-based quantum computers arerestricted in the amount of qubits and fault-tolerance,our gate-based algorithm can currently not directlycompete against implementations on a quantum an-nealing architecture, for which quantum devices withmore capacity exist. However, when comparing ourhybrid approach with a competing pure quantum-annealing approach, we found that our approach hastwo advantages. Firstly, it can utilize the quantumdevice’s qubits more efficiently, as we have a directmapping from the mathematical formulation to thequantum implementation. In contrast, an ideal map-ping with quantum annealers is an NP-complete prob-lem. Secondly, our algorithm is based on an approachthat was previously shown to solve "hard" problemsthat quantum annealers may not be able to solve andthat may be found within the MQO context.

Finally, we analytically sketched the scaling of ouralgorithm and found that with larger problem sizes,the computational time grows polynomially while thesolution space grows exponentially. Further, the spacerequirements only grow linearly with the problem size.

We believe that our paper lays a solid ground-work for using hybrid classical-quantum algorithmsto tackle the special problem of database optimiza-tions as well as the generic class of binary optimiza-tion problems.

References[1] Scott Aaronson. Quantum computing since Dem-

ocritus. Cambridge University Press, 2013.

[2] Héctor Abraham, AduOffei, Rochisha Agarwal,Ismail Yunus Akhalwaya, Gadi Aleksandrowicz,Thomas Alexander, and Matthew Amy. Qiskit:An open-source framework for quantum comput-ing, 2019.

[3] Tameem Albash and Daniel A Lidar. Adia-batic quantum computation. Reviews of ModernPhysics, 90(1):015002, 2018.

[4] Frank Arute, Kunal Arya, Ryan Babbush, DaveBacon, Joseph C. Bardin, Rami Barends, RupakBiswas, Sergio Boixo, Fernando G. S. L. Bran-dao, David A. Buell, Brian Burkett, Yu Chen,Zijun Chen, Ben Chiaro, Roberto Collins,William Courtney, Andrew Dunsworth, EdwardFarhi, Brooks Foxen, Austin Fowler, CraigGidney, Marissa Giustina, Rob Graff, KeithGuerin, Steve Habegger, Matthew P. Harrigan,

16

Page 17: Multiple Query Optimization using a Hybrid Approach of

Michael J. Hartmann, Alan Ho, Markus Hoff-mann, Trent Huang, Travis S. Humble, Sergei V.Isakov, Evan Jeffrey, Zhang Jiang, Dvir Kafri,Kostyantyn Kechedzhi, Julian Kelly, Paul V.Klimov, Sergey Knysh, Alexander Korotkov, Fe-dor Kostritsa, David Landhuis, Mike Lindmark,Erik Lucero, Dmitry Lyakh, Salvatore Man-drà, Jarrod R. McClean, Matthew McEwen, An-thony Megrant, Xiao Mi, Kristel Michielsen,Masoud Mohseni, Josh Mutus, Ofer Naaman,Matthew Neeley, Charles Neill, Murphy YuezhenNiu, Eric Ostby, Andre Petukhov, John C.Platt, Chris Quintana, Eleanor G. Rieffel, Pe-dram Roushan, Nicholas C. Rubin, Daniel Sank,Kevin J. Satzinger, Vadim Smelyanskiy, Kevin J.Sung, Matthew D. Trevithick, Amit Vainsencher,Benjamin Villalonga, Theodore White, Z. JamieYao, Ping Yeh, Adam Zalcman, Hartmut Neven,and John M. Martinis. Quantum supremacy us-ing a programmable superconducting processor.Nature, 574(7779):505–510, 2019.

[5] Murat Ali Bayir, Ismail H Toroslu, and AhmetCosar. Genetic algorithm for the multiple-queryoptimization problem. IEEE Transactions onSystems, Man, and Cybernetics, Part C (Appli-cations and Reviews), 37(1):147–153, 2006.

[6] Ville Bergholm, Josh Izaac, Maria Schuld,Christian Gogolin, M Sohaib Alam, ShahnawazAhmed, Juan Miguel Arrazola, Carsten Blank,Alain Delgado, Soran Jahangiri, et al. Pen-nylane: Automatic differentiation of hybridquantum-classical computations. arXiv preprintarXiv:1811.04968, 2018.

[7] Max Born and Vladimir Fock. Beweis des adia-batensatzes. Zeitschrift für Physik, 51(3-4):165–180, 1928.

[8] Nikhil Buduma and Nicholas Locascio. Fun-damentals of deep learning: Designing next-generation machine intelligence algorithms. "O’Reilly Media, Inc.", 2017.

[9] Vicky Choi. The effects of the problem hamilto-nian parameters on the minimum spectral gap inadiabatic quantum optimization. Quantum In-formation Processing, 19(3):1–25, 2020.

[10] D-Wave Systems Inc. A the d-wave 2000qtmquantum computer technology overview, 2017.Accessed 08.06.2021.

[11] Tansel Dokeroglu, Murat Ali Bayır, and AhmetCosar. Integer linear programming solution forthe multiple query optimization problem. In In-formation Sciences and Systems 2014, pages 51–60. Springer, 2014.

[12] Edward Farhi, Jeffrey Goldstone, and Sam Gut-mann. A quantum approximate optimization al-gorithm. arXiv preprint arXiv:1411.4028, 2014.

[13] Edward Farhi, Jeffrey Goldstone, Sam Gutmann,and Michael Sipser. Quantum computationby adiabatic evolution. arXiv preprint quant-ph/0001106, 2000.

[14] Edward Farhi and Aram W Harrow. Quantumsupremacy through the quantum approximateoptimization algorithm, 2019.

[15] Richard P Feynman. Simulating physics withcomputers. Int. J. Theor. Phys, 21(6/7), 1982.

[16] Austin Gilliam, Stefan Woerner, and ConstantinGonciulea. Grover adaptive search for con-strained polynomial binary optimization. Quan-tum, 5:428, 2021.

[17] Fred Glover, Gary Kochenberger, and Yu Du. Atutorial on formulating and using qubo models,2019.

[18] John Grant and Jack Minker. On optimizingthe evaluation of a set of expressions. Interna-tional Journal of Computer & Information Sci-ences, 11(3):179–191, 1982.

[19] Lov K Grover. A fast quantum mechanical algo-rithm for database search. In Proceedings of thetwenty-eighth annual ACM symposium on The-ory of computing, pages 212–219, 1996.

[20] Gian Giacomo Guerreschi and Anne YMatsuura.Qaoa for max-cut requires hundreds of qubits forquantum speed-up. Scientific reports, 9(1):1–7,2019.

[21] Matthew P. Harrigan, Kevin J. Sung, MatthewNeeley, Kevin J. Satzinger, Frank Arute, Ku-nal Arya, Juan Atalaya, Joseph C. Bardin,Rami Barends, Sergio Boixo, Michael Broughton,Bob B. Buckley, David A. Buell, Brian Bur-kett, Nicholas Bushnell, Yu Chen, Zijun Chen,Ben Chiaro, Roberto Collins, William Courtney,Sean Demura, Andrew Dunsworth, Daniel Ep-pens, Austin Fowler, Brooks Foxen, Craig Gid-ney, Marissa Giustina, Rob Graff, Steve Habeg-ger, Alan Ho, Sabrina Hong, Trent Huang, L. B.Ioffe, Sergei V. Isakov, Evan Jeffrey, Zhang Jiang,Cody Jones, Dir Kafri, Kostyantyn Kechedzhi,Julian Kelly, Seon Kim, Paul V. Klimov, Alexan-der N. Korotkov, Fedor Kostritsa, David Land-huis, Pavel Laptev, Mike Lindmark, Martin Leib,Orion Martin, John M. Martinis, Jarrod R. Mc-Clean, Matt McEwen, Anthony Megrant, XiaoMi, Masoud Mohseni, Wojciech Mruczkiewicz,Josh Mutus, Ofer Naaman, Charles Neill, Flo-rian Neukart, Murphy Yuezhen Niu, Thomas E.O’Brien, Bryan O’Gorman, Eric Ostby, An-dre Petukhov, Harald Putterman, Chris Quin-tana, Pedram Roushan, Nicholas C. Rubin,Daniel Sank, Andrea Skolik, Vadim Smelyan-skiy, Doug Strain, Michael Streif, Marco Szalay,Amit Vainsencher, Theodore White, Z. Jamie

17

Page 18: Multiple Query Optimization using a Hybrid Approach of

Yao, Ping Yeh, Adam Zalcman, Leo Zhou, Hart-mut Neven, Dave Bacon, Erik Lucero, EdwardFarhi, and Ryan Babbush. Quantum approxi-mate optimization of non-planar graph problemson a planar superconducting processor, 2021.

[22] Jonas Heitz and Kurt Stockinger. Join query op-timization with deep reinforcement learning algo-rithms. arXiv preprint arXiv:1911.11689, 2019.

[23] Matthias Homeister. Quantum Computing ver-stehen. Springer, 2008.

[24] IBM Quantum team. ibmq_manhattan v1.21.0,2021. Accessed 09.06.2021.

[25] IBM Quantum team. ibmq_melbourne v2.3.24,2021. Accessed 02.06.2021.

[26] Christine Klymko, Blair D Sullivan, and Travis SHumble. Adiabatic quantum programming: mi-nor embedding with hard faults. Quantum infor-mation processing, 13(3):709–729, 2014.

[27] Andrew Lucas. Ising formulations of many npproblems. Frontiers in Physics, 2:5, 2014.

[28] Ryan Marcus, Parimarjan Negi, Hongzi Mao,Chi Zhang, Mohammad Alizadeh, Tim Kraska,Olga Papaemmanouil, and Nesime Tatbul. Neo:A learned query optimizer. arXiv preprintarXiv:1904.03711, 2019.

[29] Catherine C McGeoch and Cong Wang. Ex-perimental evaluation of an adiabiatic quantumsystem for combinatorial optimization. In Pro-ceedings of the ACM International Conference onComputing Frontiers, pages 1–11, 2013.

[30] Nikolaj Moll, Panagiotis Barkoutsos, Lev SBishop, Jerry M Chow, Andrew Cross, Daniel JEgger, Stefan Filipp, Andreas Fuhrer, Jay MGambetta, Marc Ganzhorn, et al. Quantum op-timization using variational algorithms on near-term quantum devices. Quantum Science andTechnology, 3(3):030503, 2018.

[31] Michael A Nielsen and Isaac Chuang. Quantumcomputation and quantum information, 2002.

[32] Alberto Peruzzo, Jarrod McClean, Peter Shad-bolt, Man-Hong Yung, Xiao-Qi Zhou, Peter JLove, Alán Aspuru-Guzik, and Jeremy L O’brien.A variational eigenvalue solver on a photonicquantum processor. Nature communications,5(1):1–7, 2014.

[33] Christophe Piveteau, David Sutter, and StefanWoerner. Quasiprobability decompositions withreduced sampling overhead, 2021.

[34] Timothy Proctor, Kenneth Rudinger, KevinYoung, Erik Nielsen, and Robin Blume-Kohout.Demonstrating scalable benchmarking of quan-tum computers. Bulletin of the American Phys-ical Society, 65, 2020.

[35] P Griffiths Selinger, Morton M Astrahan, Don-ald D Chamberlin, Raymond A Lorie, andThomas G Price. Access path selection in a rela-tional database management system. In Readingsin Artificial Intelligence and Databases, pages511–522. Elsevier, 1989.

[36] Timos Sellis and Subrata Ghosh. On themultiple-query optimization problem. Knowledgeand Data Engineering, IEEE Transactions on,2:262 – 266, 07 1990.

[37] Timos K Sellis. Multiple-query optimiza-tion. ACM Transactions on Database Systems(TODS), 13(1):23–52, 1988.

[38] Peter W Shor. Polynomial-time algorithms forprime factorization and discrete logarithms ona quantum computer. SIAM review, 41(2):303–332, 1999.

[39] Michael Stillger, Guy M Lohman, Volker Markl,and Mokhtar Kandil. Leo-db2’s learning opti-mizer. In VLDB, volume 1, pages 19–28, 2001.

[40] Immanuel Trummer and Christoph Koch. Mul-tiple query optimization on the d-wave 2xadiabatic quantum computer. arXiv preprintarXiv:1510.06437, 2015.

[41] Immanuel Trummer and Christoph Koch. Multi-objective parametric query optimization. ACMSIGMOD Record, 45(1):24–31, 2016.

[42] Xin-Chuan Wu, Sheng Di, Emma Maitreyee Das-gupta, Franck Cappello, Hal Finkel, Yuri Alex-eev, and Frederic T. Chong. Full-state quantumcircuit simulation by using data compression. InProceedings of the International Conference forHigh Performance Computing, Networking, Stor-age and Analysis, SC ’19, New York, NY, USA,2019. Association for Computing Machinery.

[43] Leo Zhou, Sheng-Tao Wang, Soonwon Choi,Hannes Pichler, and Mikhail D Lukin. Quantumapproximate optimization algorithm: Perfor-mance, mechanism, and implementation on near-term devices. Physical Review X, 10(2):021067,2020.

18