Parameter Setting Method, System, Device, Equipment, Storage Medium and Program Product
By transforming the database parameter tuning problem into a travel quotient problem in quantum computing, the quantum algorithm model is used to solve the optimal solution on the quantum computer, and the time-consuming and resource-consuming parameter tuning problem in traditional methods is solved, improving the efficiency and accuracy of database queries.
Patent Information
- Application Number
- CN202311482543.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-08
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2043-11-08
AI Technical Summary
The prior art parameters tuning in database systems consumes a lot of time and resources, making it difficult to quickly and efficiently find the optimal parameter configuration.
Transform parameter tuning problems into quantum computing problems, use quantum algorithm models to build a travel provider problem (TSP), solve the optimal solution through quantum computers, and set database parameters.
It realizes faster and more efficient solution to parameter tuning problems, and improves the efficiency and accuracy of database queries.
Smart Images

Figure CN118606291B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of database systems, and particularly to a parameter setting method, system, device, equipment, storage medium and program product. Background Art
[0002] How to select the optimal parameter configuration is an important issue in database systems.
[0003] In related technologies, parameter tuning problems are usually solved based on experience and trial-and-error. Current research on parameter tuning mainly focuses on aspects such as automated tuning, statistics-based tuning, machine learning-based tuning, deep learning-based tuning, etc.
[0004] However, due to the huge order of magnitude of database system parameters, related technologies require a large amount of time and resources to solve. Therefore, an efficient method is needed. Summary of the Invention
[0005] This application provides a parameter setting method, system, device, equipment, storage medium and program product, which can solve the parameter tuning problem more quickly and efficiently, and thus improve the efficiency and accuracy of database queries; the technical solution is as follows.
[0006] According to one aspect of this application, a parameter setting method is provided. The method includes:
[0007] Obtain the parameter value ranges of multiple parameters of the database, and the objective function of the database; the objective function is used to measure the performance metrics of the database;
[0008] Based on the parameter value ranges of the multiple parameters and the objective function, construct a Traveling Salesman Problem (TSP) model, where the paths in the TSP model are combinations of parameter values of the multiple parameters; the path length in the TSP model is the objective function;
[0009] Based on the TSP model, construct a quantum algorithm model;
[0010] Based on the quantum algorithm model, solve the optimal solution of the TSP model;
[0011] Based on the combination of parameter values corresponding to the optimal solution of the TSP model, set the multiple parameters of the database.
[0012] According to one aspect of this application, a parameter setting system is provided. The system includes:
[0013] A database, a classical computer, and a quantum computer;
[0014] The classical computer is used to obtain the parameter value ranges of multiple parameters of a database and the objective function of the database; the objective function is used to measure the performance metrics of the database; a Traveling Salesman Problem (TSP) model is constructed based on the parameter value ranges of the multiple parameters and the objective function, where the paths in the TSP model are combinations of the parameter values of the multiple parameters; the path length in the TSP model is the objective function; a quantum algorithm model is constructed based on the TSP model.
[0015] The quantum computer is used to solve the optimal solution of the TSP model based on the quantum algorithm model.
[0016] The classical computer is used to set the multiple parameters of the database based on the combination of parameter values corresponding to the optimal solution of the TSP model.
[0017] According to an aspect of the present application, a parameter setting device is provided, and the device includes:
[0018] An acquisition module, configured to acquire the parameter value ranges of multiple parameters of a database and the objective function of the database; the objective function is used to measure the performance metrics of the database.
[0019] A first model construction module, configured to construct a Traveling Salesman Problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function, where the paths in the TSP model are combinations of the parameter values of the multiple parameters; the path length in the TSP model is the objective function.
[0020] A second model construction module, configured to construct a quantum algorithm model based on the TSP model.
[0021] A solution module, configured to solve the optimal solution of the TSP model based on the quantum algorithm model.
[0022] A parameter setting module, configured to set the multiple parameters of the database based on the combination of parameter values corresponding to the optimal solution of the TSP model.
[0023] In some embodiments, the second model construction module is configured to:
[0024] Construct a first quantum algorithm model and a second quantum algorithm model based on the TSP model, where the first quantum algorithm model is used to query the solution space of the TSP model, and the second quantum algorithm model is used to query the optimal solution in the solution space.
[0025] Wherein, each solution in the solution space corresponds to a combination of parameter values of the multiple parameters.
[0026] In some embodiments, the first quantum algorithm model is a Hamiltonian cycle problem model.
[0027] Each solution in the solution space corresponds to a Hamiltonian cycle in the Hamiltonian cycle problem model.
[0028] In some embodiments, the second quantum algorithm model is a Grover algorithm model;
[0029] Each solution in the solution space corresponds to a qubit state in the Grover algorithm model.
[0030] In some embodiments, the solving module is used to,
[0031] Execute the quantum circuit corresponding to the first quantum algorithm model through a quantum computer to obtain each solution in the solution space;
[0032] Map each solution in the solution space to a qubit state in the second quantum algorithm model respectively, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probabilities of the qubit states corresponding to each solution in the solution space;
[0033] Determine the solution with the highest probability of the corresponding qubit state among each solution in the solution space as the optimal solution of the TSP model.
[0034] In some embodiments, the device further includes: a processing module, used to,
[0035] Before the first model construction module, perform normalization processing on the parameter value ranges of the multiple parameters, and the normalization processing is used to unify the parameter value ranges of the multiple parameters into a specified numerical range;
[0036] The first model construction module is used to construct the TSP model based on the parameter value ranges of the multiple parameters after the normalization processing and the objective function.
[0037] In some embodiments, the parameter setting module is used to,
[0038] Perform the inverse process of the normalization processing on the parameter values in the parameter value combination corresponding to the optimal solution to obtain the optimized parameter values of the multiple parameters;
[0039] Set the multiple parameters of the database based on the optimized parameter values of the multiple parameters.
[0040] In some embodiments, the multiple parameters include the parameters corresponding to the query configuration of the database.
[0041] In some embodiments, the multiple parameters include multiple of the following parameters:
[0042] Cache parameters, concurrent connection parameters, query optimization parameters, index parameters, log parameters, memory allocation parameters, disk input / output parameters, processor utilization parameters.
[0043] According to another aspect of the present application, there is provided a computer device, which includes a processor and a memory. At least one instruction, at least one program, a code set or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the parameter setting method as described in the above aspect.
[0044] According to another aspect of the present application, there is provided a computer-readable storage medium in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the parameter setting method as described in the above aspect.
[0045] According to another aspect of the present application, there is provided a computer program product, which includes computer instructions. The computer instructions are stored in a computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement the parameter setting method as described in the above aspect.
[0046] The technical solutions provided in the embodiments of the present application may include the following beneficial effects:
[0047] By transforming the parameter tuning problem into a quantum computing problem and then solving the quantum computing problem through a quantum algorithm, the target solution of the parameter tuning problem can be obtained. Compared with traditional computers, quantum computers can process data at an exponential level and can process or estimate the performance of multiple possible parameter combinations simultaneously. Therefore, the technical solutions provided in the embodiments of the present application can solve the parameter tuning problem more quickly and efficiently, thereby improving the efficiency and accuracy of database queries. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0049] Figure 1 It is a distributed database architecture diagram provided by an exemplary embodiment of the present application;
[0050] Figure 2 It is a schematic diagram of the application scenario of the solution provided by an embodiment of the present application;
[0051] Figure 3 is a flowchart of a parameter setting method provided by an exemplary embodiment of the present application;
[0052] Figure 4 is a flowchart of a parameter setting method provided by another exemplary embodiment of the present application;
[0053] Figure 5 is a flowchart of a parameter setting method provided by yet another exemplary embodiment of the present application;
[0054] Figure 6 is a flowchart of a parameter setting method provided by still another exemplary embodiment of the present application;
[0055] Figure 7 is a flowchart of a parameter setting method provided by another exemplary embodiment of the present application;
[0056] Figure 8 is a flowchart of solving the parameter tuning problem based on a traditional computer provided by an exemplary embodiment of the present application;
[0057] Figure 9 is a flowchart of solving the parameter tuning problem based on a quantum computer provided by an exemplary embodiment of the present application;
[0058] Figure 10 is a flowchart of a parameter selection method provided by an exemplary embodiment of the present application;
[0059] Figure 11 is a block diagram of a parameter setting device shown by an exemplary embodiment of the present application;
[0060] Figure 12 is a structural block diagram of a computer device provided by an exemplary embodiment of the present application;
[0061] Figure 13 is a schematic diagram of a parameter setting system provided by an exemplary embodiment of the present application.
[0062] The accompanying drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Detailed Embodiments
[0063] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0064] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0065] The terms used in the present disclosure are for the purpose of describing particular embodiments only and are not intended to limit the present disclosure. The singular forms "a", "the", and "said" used in the present disclosure and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0066] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions. For example, the object behaviors such as attack operations involved in the present application are obtained under full authorization.
[0067] It should be understood that although the terms first, second, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".
[0068] The following introduces some noun interpretations involved in the present application:
[0069] Database (DB): An organic collection of a large amount of data that is organized in a certain structure and stored in a computer for a long time and can be shared. Each database has one or more different Application Programming Interfaces (APIs) for creating, accessing, managing, searching, and replicating the stored data.
[0070] Quantum Computing: A computing method based on quantum logic that utilizes properties such as the superposition and entanglement of quantum states to rapidly complete computational tasks. The basic unit for storing data in quantum computing is the qubit.
[0071] Qubit: The carrier form of quantum information and also the basic unit of quantum computing. Traditional computers use 0 and 1 as the basic units of binary. Different from this, quantum computing can process 0 and 1 simultaneously, and the system can be in a linear superposition state of 0 and 1: |ψ> = α|0> + β|1>, where α and β represent the complex probability amplitudes of the system in 0 and 1. The squared modulus of α, |α| 2 , |β| 2 represent the probabilities of being in 0 and 1 respectively.
[0072] Quantum Operation: Manipulating qubits to process the quantum information carried by qubits. Common quantum operations include Pauli X, Y, Z transformations (or written as σ x , σ y , σ z ), Hadamard transformation (H), controlled Pauli X transformation, i.e., controlled not gate (CNOT), etc.
[0073] Quantum Circuit: A descriptive model of quantum computing, composed of qubits and quantum operations on qubits, representing the hardware implementation of the corresponding quantum algorithm / program in the quantum gate model. A quantum circuit consists of a series of quantum gate sequences and the computation is completed by quantum gates. If the quantum circuit contains adjustable parameters for controlling quantum gates, it is called a parameterized quantum circuit.
[0074] Quantum Computing Device: A physical device that executes quantum computing.
[0075] Travelling Salesman Problem (TSP): A classical combinatorial optimization problem. The classical TSP can be described as follows: A salesman of goods needs to visit several cities to promote goods. The salesman starts from one city, needs to pass through all cities, and then return to the starting point. How should the travel route be selected to minimize the total travel distance? From the perspective of graph theory, this problem essentially involves finding a Hamiltonian cycle with the minimum weight in a weighted complete undirected graph. Since the feasible solutions to this problem are all permutations of all vertices, as the number of vertices increases, a combinatorial explosion will occur. Therefore, TSP is an NP-complete problem.
[0076] Hamiltonian cycle: Given \(G=(V, E)\) is a graph. If a path in \(G\) passes through each vertex exactly once, this path is called a Hamiltonian path. If a cycle in \(G\) passes through each vertex exactly once, this cycle is called a Hamiltonian cycle. If a graph has a Hamiltonian cycle, it is called a Hamiltonian graph.
[0077] Nondeterminism Polynomial (NP) problem: All decision problems that can be solved in nondeterministic polynomial time constitute NP problems.
[0078] Grover's algorithm: Also known as the Quantum Search Algorithm, it refers to an unstructured search algorithm running on a quantum computer and is one of the typical algorithms in quantum computing.
[0079] Distributed Data Base (DDB): It is a database system that is physically dispersed but logically centralized, which is the product of the combination of database technology and computer networks. DDB includes a computing layer, a storage layer, and a metadata layer. The computing layer is used for permission checking and routing access for data access, etc.; the storage layer is used to store data; the metadata layer is used to store metadata information. When the computing layer of the distributed database starts, it can correctly perform operations such as parsing and routing of Structured Query Language (SQL) by accessing the metadata layer to obtain all cluster information.
[0080] Please refer to Figure 1 , which shows the architecture diagram of the distributed database provided by an exemplary embodiment of the present application. As Figure 1 shown, the distributed database includes a Scheduler, a ZK cluster, a gateway, and a Set.
[0081] Scheduler:
[0082] 1. Pull DDL tasks from ZK and execute them on the actual MySQL instance;
[0083] 2. Obtain tasks from ZK and generate expansion tasks;
[0084] 3. Control the master-slave switch within the Set;
[0085] 4. Multiple Schedulers achieve disaster tolerance through the election of ZK themselves.
[0086] Gateway:
[0087] 1. Identify DDL operations and save them as tasks to the ZK cluster;
[0088] 2. Identify DML operations, perform SQL conversion and send them to the hosts or standby machines in the corresponding Set;
[0089] 3. Collect the responses from each node in the Set, combine and process them, and then return them to the API of the front-end application;
[0090] 4. Check the ZK cluster and pull information such as routing and permissions.
[0091] Set:
[0092] 1. Check the instance status and report it to ZK;
[0093] 2. Check the table status and report it to ZK;
[0094] 3. Pull migration tasks from ZK and execute them;
[0095] 4. Participate in the master-standby switchover process.
[0096] Data Definition Language (DDL): Used to create or delete databases for storing data and objects such as tables in the database.
[0097] Data Manipulation Language (DML): Used to query or change records in a table.
[0098] ZooKeeper (ZK) cluster: Its main functions include configuration maintenance, election decision-making, routing synchronization, etc.; at the same time, it can also assist in storing routing, control information, task information, heartbeat, etc.
[0099] Parameter Tuning is an important issue in database systems, which involves how to select the optimal parameter configuration to improve the performance and reliability of database systems. The parameters in database systems include cache size, thread pool size, log size, lock granularity, etc. Different parameter configurations will have different impacts on the performance and reliability of database systems. Therefore, selecting the optimal parameter configuration is crucial for the performance and reliability of database systems.
[0100] Traditional parameter tuning methods usually rely on experience and trial-and-error, requiring a large amount of manual intervention and experiments. This method is inefficient and it is difficult to find the optimal parameter configuration. Therefore, researching how to automatically select the optimal parameter configuration has become one of the hotspots in database system research.
[0101] Current parameter tuning research mainly focuses on aspects such as automated tuning, statistics-based tuning, machine learning-based tuning, and deep learning-based tuning. These research results can help database administrators and developers select the optimal parameter configuration and improve the performance and reliability of database systems.
[0102] Since researchers hope to achieve quantum advantage in complex computations, quantum computing has attracted extensive attention in many research fields. Although quantum computing has been studied for decades, the accelerated development of quantum computing hardware in recent years has led to an increasing interest in quantum computing among researchers. In addition, cloud access to quantum systems makes quantum computing more feasible for researchers, enabling the first experiments to be conducted on real quantum processing units (QPUs).
[0103] Different from the central processing unit (CPU), QPUs use quantum bits or qubits for computing. The mathematical states of QPUs are exponentially larger than classical bits and can achieve phenomena such as quantum superposition, quantum entanglement, or quantum interference. It is generally believed that, given the accepted complexity theory assumptions, quantum systems provide higher computing power than classical systems. Multiple quantum algorithms have been proven to have acceleration effects, and a pioneering experiment has demonstrated quantum advantage on real hardware, even for artificially constructed problems.
[0104] In addition, quantum computing excels in optimization problems that require determining elements with specific properties in an (exponentially large) search space. Such problems are common in database systems and are particularly relevant to database query optimization.
[0105] Therefore, exploring the application of quantum cloud services (QCs) in database query optimization is a challenging and promising research direction.
[0106] In database optimization problems, the parameter tuning problem is an important one. Traditional computers need to spend a large amount of time and resources to solve this problem because parameter tuning is essentially a non-deterministic polynomial (NP)-hard problem due to its huge parameter space. Therefore, a faster and more efficient method is needed to solve this problem.
[0107] The emergence of quantum computers provides new opportunities for solving the problem of parameter tuning. A quantum computer is a computer based on the principles of quantum mechanics and can solve certain problems faster than traditional computers in some cases. Quantum machine learning is a method that uses quantum computers to accelerate machine learning. In parameter tuning optimization, quantum machine learning can use technologies such as Quantum Support Vector Machine (QSVM) and Parameterized Quantum Circuit (PQC) to accelerate the optimization process.
[0108] Please refer to Figure 2 , which shows a schematic diagram of the application scenario of the solution provided by an embodiment of the present application. As Figure 2 shown, the application scenario can be a superconducting quantum computing platform, and this application scenario includes: a quantum computing device 21, a dilution refrigerator 22, a control device 23, and a computer 24.
[0109] The quantum computing device 21 is a circuit that acts on physical qubits, and the quantum computing device 21 can be implemented as a quantum chip, such as a superconducting quantum chip near absolute zero. The dilution refrigerator 22 is used to provide an environment of absolute zero for the superconducting quantum chip.
[0110] The control device 23 is used to control the quantum computing device 21, and the computer 24 is used to control the control device 23. For example, the written quantum program is compiled into instructions in the computer 24 and sent to the control device 23 (such as an electronic / microwave control system), and the control device 23 converts the above instructions into electronic / microwave control signals and inputs them into the dilution refrigerator 22 to control the superconducting qubits at a temperature less than 10 mK. The reading process is the opposite, and the read waveform is transmitted to the quantum computing device 21.
[0111] Before introducing and explaining the method embodiment of the present application, the operating environment of this method will be introduced and explained first. The method provided by the embodiment of the present application can be executed in a hybrid device environment of a classical computer and a quantum computer.
[0112] In the following method embodiments, for the convenience of description, only the execution subject of each step is introduced and explained as a computer device. It should be understood that this computer device can include a hybrid execution environment of a classical computer and a quantum computer, and the embodiment of the present application does not limit this.
[0113] Please refer to Figure 3 , which shows a flowchart of a parameter setting method provided by an exemplary embodiment of the present application. This method is executed by a computer device, such as Figure 3As shown, the method may include step 310, step 320, step 330, step 340, and step 350.
[0114] Step 310: Obtain the parameter value ranges of multiple parameters of the database, and the objective function of the database; the objective function is used to measure the performance metrics of the database.
[0115] In an embodiment of the present application, the computer device can determine the parameter value ranges of multiple parameters by collecting multiple parameters from the database, and obtain the objective function of the database. Among them, the objective function is an indicator for measuring the performance or effect of the database, and the database can be an enterprise-level database, a cloud database, etc.
[0116] Among them, the multiple parameters include cache size, thread pool size, log size, lock granularity, etc. Different parameter configurations will have different impacts on the performance and reliability of the database system.
[0117] Among them, the parameter value ranges of multiple parameters are usually limited. For example, the parameter value range of the thread is 1 - 10.
[0118] In some embodiments, the computer device can perform a normalization process on the parameter value ranges of multiple parameters to unify the parameter value ranges of multiple parameters to a specified numerical range.
[0119] Step 320: Construct a Traveling Salesman Problem (TSP) model based on the parameter value ranges of multiple parameters and the objective function. The paths in the TSP model are combinations of parameter values of multiple parameters; the path length in the TSP model is the objective function.
[0120] In an embodiment of the present application, the computer device can construct a Traveling Salesman Problem (TSP) model based on the parameter value ranges of multiple parameters and the objective function obtained in step 310.
[0121] Among them, the paths in the TSP model are combinations of parameter values of multiple parameters. The parameter value combinations are usually variables that need to be adjusted and optimized. In the TSP model, the parameter value combinations can be regarded as the path selection of the traveling salesman, that is, determining in what order the traveling salesman visits each city.
[0122] Among them, the path length in the TSP model is the objective function. The objective function is usually an indicator for measuring the performance or effect of parameter settings. In the TSP model, the objective function is to find the shortest travel path so that the traveling salesman passes through each city once and returns to the starting city.
[0123] Step 330: Construct a quantum algorithm model based on the TSP model.
[0124] In the embodiment of the present application, the computer device may construct a quantum algorithm model based on the TSP model constructed in step 320.
[0125] Among them, TSP is an NP-hard problem in combinatorial optimization. Based on the traditional computing model, the TSP model requires a large amount of time and resources to solve. The solution of the quantum algorithm model can be based on quantum logic and can be quickly completed by using properties such as the superposition and entanglement of quantum states. Compared with traditional computers, quantum computers can process data at an exponential level, and at the same time, utilize the characteristics of quantum superposition and quantum parallelism to process or estimate the performance of multiple possible parameter combinations simultaneously, thereby improving the query efficiency of the final database.
[0126] Step 340: Based on the quantum algorithm model, solve the optimal solution of the TSP model.
[0127] In the embodiment of the present application, the computer device may solve the optimal solution of the TSP model based on the quantum algorithm model constructed in step 330.
[0128] Step 350: Based on the parameter value combination corresponding to the optimal solution of the TSP model, set various parameters of the database.
[0129] In the embodiment of the present application, the computer device may set various parameters of the database based on the parameter value combination corresponding to the optimal solution solved in step 340.
[0130] In summary, the technical solution provided by the embodiment of the present application constructs the parameter value combination of various parameters of the database as the path in the TSP model, and constructs the objective function of the database as the path length in the TSP model; constructs a quantum algorithm model based on the TSP model; based on the quantum algorithm model, solves the optimal solution of the TSP model through quantum computing, and correspondingly sets various parameters of the database, thereby optimizing the performance index of the database. Compared with traditional computing, quantum computing can process data at an exponential level and can process or estimate the performance of multiple possible parameter combinations simultaneously. Therefore, the solution shown in the embodiment of the present application can solve the parameter tuning problem more quickly and efficiently, and further improve the query efficiency and accuracy of the database.
[0131] Please refer to Figure 4 , which shows a flowchart of a parameter setting method provided by another exemplary embodiment of the present application. This method is executed by a computer device. As Figure 4 shown, step 330 in the above Figure 3 shown embodiment can be implemented as step 330a.
[0132] Step 330a: Based on the TSP model, construct a first quantum algorithm model and a second quantum algorithm model. The first quantum algorithm model is used to query the solution space of the TSP model, and the second quantum algorithm model is used to query the optimal solution in the solution space;
[0133] Among them, each solution in the solution space corresponds to a combination of parameter values of multiple parameters.
[0134] In the embodiments of the present application, the computer device can construct a first quantum algorithm model for querying the solution space of the TSP model and a second quantum algorithm model for querying the optimal solution in the solution space based on the TSP model constructed in step 320. Among them, each solution in the solution space corresponds to a combination of parameter values of multiple parameters.
[0135] In some embodiments, the first quantum algorithm model can be an NP-complete problem model, such as a Hamiltonian cycle problem model.
[0136] In some embodiments, the second quantum algorithm model can be a Grover algorithm model, or it can also be a quantum simulation algorithm model.
[0137] Quantum computers utilize the superposition and entanglement properties of qubits (quantum bits) and can process multiple possibilities in a single calculation, which gives quantum computers potential advantages in fields such as search, optimization, and simulation. For NP problems, quantum computers can utilize quantum parallelism and quantum coherence to search the solution space in order to find the solution to the problem. Among them, quantum parallelism allows quantum computers to process multiple possible solutions simultaneously, while quantum coherence allows quantum computers to utilize interference effects during the search process to enhance the probability of the correct solution.
[0138] In quantum computing, the way to feedback the result is usually to obtain it by measuring the state of the qubits. The output of a quantum computer is a series of results of measured qubits, and these results are represented in the form of probabilities. By running the same calculation multiple times, the frequency of the measurement results can be statistically analyzed, and the solution to the problem can be estimated based on the frequency.
[0139] The embodiments of the present application provide a technical solution for constructing a quantum algorithm model based on the TSP model, constructing two quantum algorithm models, one for querying the solution space of the TSP model and the other for querying the optimal solution in the solution space. For the TSP problem, compared with traditional computers, quantum computers can utilize quantum parallelism and quantum coherence to search the solution space at an exponential level and find the optimal solution to the TSP problem, thus solving the parameter tuning problem more quickly and efficiently.
[0140] In some embodiments, the above-mentioned first quantum algorithm model is a Hamiltonian cycle problem model; each solution in the solution space corresponds to a Hamiltonian cycle in the Hamiltonian cycle problem model.
[0141] Among them, the quantum existence problem can be mapped to the Hamiltonian cycle existence problem, and the result of quantum computing can be reflected in the solution of the Hamiltonian cycle.
[0142] There is a reduction property among NP-complete problems. Both the TSP and the Hamiltonian cycle problem are NP-complete problems. The TSP problem can be reduced to the Hamiltonian problem, that is, if the Hamiltonian cycle problem is solved, then the TSP problem can also be solved, which means solving the parameter optimization problem.
[0143] The embodiments of the present application provide an alternative solution for the first quantum algorithm model, specifically a Hamiltonian cycle problem model, which is used to query the solution space of the TSP model. Each Hamiltonian cycle in the Hamiltonian cycle problem model corresponds to each solution in the solution space, which can further optimize the perfection and reliability of the technical solution of the present application.
[0144] In some embodiments, the above-mentioned second quantum algorithm model is a Grover algorithm model; each solution in the solution space corresponds to a qubit state in the Grover algorithm model.
[0145] In the embodiments of the present application, the quantum counting algorithm can be used to accelerate the solution of NP-complete problems. An example of an NP-complete problem is the Hamiltonian cycle problem. The method for determining whether a graph is a Hamiltonian cycle problem is as follows: Assume there is a Hamiltonian cycle. A simple solution to the Hamiltonian cycle problem is to check whether each vertex order is a Hamiltonian cycle; finding all possible orderings of the vertices in the graph can be done by following the quantum counting of the Grover algorithm. The Grover algorithm achieves a square root-like acceleration, and this method finds the Hamiltonian cycle (assuming there is a Hamiltonian cycle). Among them, the quantum counting algorithm itself is sufficient to determine whether a Hamiltonian cycle exists.
[0146] The Grover algorithm is a quantum algorithm that can search for a target item in an unsorted database in O(sqrt(N)) time. Although the Grover algorithm cannot directly solve NP problems, it can be used to accelerate the solution of certain NP problems.
[0147] In the embodiments of the present application, the solution space of the NP problem can be regarded as an unsorted database, then the Grover algorithm can be used to search for solutions in the solution space. By mapping each solution in the solution space to an item in a database, the Grover algorithm can be used to search for the optimal solution in the solution space.
[0148] For example, assume that we want to search for a solution that meets certain conditions in a solution space containing N elements. If we use a traditional search algorithm, it takes O(N) time to find the solution. However, if we use Grover's algorithm, we can find the solution in O(sqrt(N)) time. Specifically, for example, given the same problem, Grover's algorithm can solve it in 10,000 operations, while a classical computer would require 10,000^2 = 100,000,000 operations. This is a huge difference between 10,000 and 100 million.
[0149] It should be noted that the acceleration effect of Grover's algorithm is limited because Grover's algorithm can only provide an acceleration of O(sqrt(N)). For large-scale NP problems, this acceleration may still not be sufficient to make the problem solvable. In addition, the implementation of Grover's algorithm also needs to consider issues such as the hardware limitations of quantum computers and error correction.
[0150] In summary, although Grover's algorithm cannot directly solve NP problems, it can be used to accelerate the solution of certain NP problems. By mapping the solution space to an unsorted database, a computer device can use Grover's algorithm to search for the optimal solution in the solution space.
[0151] An embodiment of the present application provides an alternative solution for the second quantum algorithm model, specifically the Grover's algorithm model. Among them, the quantum bit state in the Grover's algorithm model corresponds to the solution in the solution space, and it can accelerate the search for the optimal solution in the solution space through Grover's algorithm, improving the efficiency of solving parameter optimization problems.
[0152] Based on the above Figure 4 solution in the illustrated embodiment, please refer to Figure 5 , which shows a flowchart of a parameter setting method provided by another exemplary embodiment of the present application. This method is executed by a computer device. As Figure 5 shown, step 340 in the above Figure 4 illustrated embodiment can be implemented as step 340a, step 340b, and step 340c.
[0153] Step 340a: Execute the quantum circuit corresponding to the first quantum algorithm model through a quantum computer to obtain each solution in the solution space.
[0154] In an embodiment of the present application, after constructing the first quantum algorithm model and the second quantum algorithm model based on the TSP model in the above steps, the computer device can execute the quantum circuit corresponding to the first quantum algorithm model through a quantum computer to obtain each solution in the solution space.
[0155] Step 340b: Map each solution in the solution space to a qubit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probabilities of the qubit states corresponding to each solution in the solution space.
[0156] In an embodiment of the present application, after obtaining each solution in the solution space in step 340a, the computer device may map each solution in the solution space to a qubit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probabilities of the qubit states corresponding to each solution in the solution space.
[0157] Step 340c: Determine the solution with the highest probability of the corresponding qubit state among each solution in the solution space as the optimal solution of the TSP model.
[0158] In an embodiment of the present application, after obtaining the probabilities of the qubit states corresponding to each solution in the solution space in step 340b, the computer device may determine the solution with the highest probability of the corresponding qubit state among each solution in the solution space as the optimal solution of the TSP model.
[0159] Among them, the optimal parameter setting is one of all possible combinations of parameter values. Therefore, the parameter tuning problem can be mapped to a combinatorial optimization problem, such as the Traveling Salesman Problem (TSP). The association between the parameter tuning problem and the Traveling Salesman Problem (TSP) can be understood in the following way:
[0160] Objective function: In the parameter tuning problem, the objective function is usually an index to measure the performance or effect of the parameter setting; in the TSP problem, the objective function is to find the shortest travel path so that the traveling salesman passes through each city once and returns to the starting city.
[0161] Parameter setting: In the parameter tuning problem, the parameter setting is the variable that needs to be adjusted and optimized; in the TSP problem, the parameter setting can be regarded as the path selection of the traveling salesman, that is, determining in what order the traveling salesman visits each city.
[0162] Constraint conditions: In the parameter tuning problem, there may be some constraint conditions (such as data dependencies between parameters, overall performance balance), which limit the value range or relationship of the parameters; in the TSP problem, the constraint condition is that the traveling salesman must pass through each city once and finally return to the starting city.
[0163] Among them, in step 320, a Traveling Salesman Problem (TSP) model is constructed based on the parameter value ranges and objective functions of multiple parameters, mapping the parameter optimization problem to a TSP problem. Among them, the parameter settings are mapped to the paths of the TSP model, the objective function is mapped to the lengths of the paths, and the constraint conditions are mapped to that the path is a loop and the path can pass through each city only once and exactly once.
[0164] Among them, in step 330, a quantum algorithm model is constructed based on the TSP model, that is, converting the TSP problem (i.e., the parameter optimization problem) into a quantum computing problem; in step 340, the optimal solution (i.e., the optimal parameter settings) of the TSP problem can be quickly found based on the quantum algorithm model; finally, various parameters of the database are set correspondingly.
[0165] Specifically, for example, the quantum algorithm model includes a Hamiltonian cycle problem model and a Grover algorithm model. First, through the Hamiltonian cycle problem model, all possible vertex orderings in the Hamiltonian graph are searched, that is, all possible paths of the TSP problem are searched, that is, all possible combinations of parameter values of multiple parameters are searched; then, the optimal vertex ordering (i.e., the optimal combination of parameter values) is searched through the Grover algorithm model, specifically including:
[0166] Represent all possible vertex orderings (i.e., combinations of parameter values) as different quantum bit states;
[0167] Through the Oracle, mark the target quantum bit state;
[0168] Through Grover iteration, increase the probability of the target quantum bit state;
[0169] Measure the quantum bits; among them, the measurement result is represented in the form of probability;
[0170] Correspond the quantum bit state with the maximum probability to the optimal vertex ordering (i.e., the optimal combination of parameter values).
[0171] Among them, taking the second quantum algorithm model as the Grover algorithm model as an example, the following steps are involved in modeling and feedback of the Grover algorithm in quantum computing.
[0172] S1, Modeling: The above steps have transformed the parameter tuning problem into a form that can be processed by a quantum computer. For the Grover algorithm, the computer device can represent the search space of the problem as the state of qubits (quantum bits). Each item in the search space is mapped to the state of a quantum bit, which contains the information of the problem.
[0173] S2, Initialization: In the Grover algorithm, the qubits need to be initialized to a uniform superposition state. This can be achieved by setting all qubits to the superposition state of the Hadamard gate.
[0174] S3, Oracle: The Oracle is a crucial part of the Grover algorithm and is used to mark the target item. In quantum computing, the Oracle can be represented as a quantum gate or a quantum circuit, which can manipulate the state of qubits according to the specific conditions of the problem.
[0175] S4, Grover Iteration: The Grover algorithm increases the probability of the target item by applying Grover iterations multiple times. Each Grover iteration consists of three steps: S41 Apply the Oracle, S42 Apply the reflection operation, and S43 Repeat.
[0176] S41, Apply the Oracle: In each iteration of the Grover algorithm, the Oracle operation is applied first. The role of the Oracle is to mark the target item, that is, to distinguish the target item from other items. The computer device can achieve this goal by manipulating the state of qubits.
[0177] Specifically, the Oracle manipulates the state of qubits according to the specific conditions of the problem to distinguish the target item from other items. For example, it can be achieved by applying a specific quantum gate or a quantum circuit.
[0178] S42, Apply the reflection operation: After applying the Oracle in S41, the next step is S42 to apply the reflection operation. The reflection operation is the core part of the Grover algorithm, which helps to increase the probability amplitude of the target item, making it easier to be measured.
[0179] Specifically, the reflection operation can be implemented by a quantum gate or a quantum circuit called the Grover reflection. The role of the reflection operation is to invert the state of the qubits about the average amplitude, thereby increasing the probability amplitude of the target item.
[0180] S43, Repeat: After applying the Oracle in S41 and the reflection operation in S42, the Grover algorithm repeats these two steps. The number of repetitions depends on the scale of the problem and the probability amplitude of the target item. Usually, the number of repetitions is approximately the square root of N, where N is the number of items with various parameters in the database. By repeatedly applying the Oracle and the reflection operation, the probability amplitude of the target item will gradually increase, making it easier to be measured.
[0181] Through the iteration of these three steps, the Grover's algorithm can efficiently search for the target item in an unsorted database. Each iteration helps increase the probability amplitude of the target item, thereby improving the accuracy and efficiency of finding the target item.
[0182] S5, Measurement: At the end of the Grover's algorithm, the qubits need to be measured to obtain the final result. The measurement result is represented in the form of probability, where the result with the highest probability corresponds to the optimal solution of the TSP model.
[0183] Among them, the way and method of measurement can be implemented through the hardware of the quantum computer. Quantum measurement gates or measurement circuits can be used to complete it. These measurement gates or circuits will perform corresponding operations according to the state of the qubits and convert them into the state of classical bits.
[0184] Specifically, the process of S5 measurement can be simply described as the following steps.
[0185] S51, Preparation: Before measurement, it is necessary to ensure that the qubits are in the required state. This may involve applying a series of quantum operations, such as applying Hadamard gates to create a uniform superposition state.
[0186] S52, Measurement: In response to the qubits being in the required state, a measurement operation is performed. The measurement operation causes the state of the qubits to collapse into the state of classical bits, that is, 0 or 1. The measurement result is random, but the probability is proportional to the square of the state amplitude of the qubits.
[0187] S53, Result: The measurement result is represented in the form of probability, where the result with the highest probability corresponds to the solution of the problem. For example, in the Grover's algorithm, if the target item is correctly marked, then the probability corresponding to the target item in the measurement result will be high.
[0188] Take an example to illustrate the measurement process: Suppose a qubit is in the superposition state (|0> + |1>) / √2. After measurement, the possible results are 0 or 1, and the probability of each result is 1 / 2. This means that in the process of repeated measurements, about half of the time 0 will be obtained, and the other half of the time 1 will be obtained.
[0189] It should be noted that the measurement operation causes the state of the qubits to collapse into the state of classical bits. Therefore, after measurement, the information of the qubits will be lost. Therefore, in the Grover's algorithm, multiple iterations and measurements are usually required to increase the probability amplitude of the target item, thereby improving the accuracy and efficiency of finding the target item.
[0190] In terms of feedback, the results of the Grover algorithm are usually obtained by running the algorithm multiple times and counting the frequencies of the measurement results. By repeatedly running the Grover algorithm, the probability of the target item can be increased, and ultimately a result closer to the optimal solution can be obtained.
[0191] The embodiments of the present application provide a technical solution for solving the optimal solution of the TSP model based on a quantum algorithm model, which can use the quantum algorithm to obtain the optimal solution of the TSP model more quickly and efficiently. Specifically, a quantum computer executes the quantum circuit of the first quantum algorithm model to obtain each solution in the solution space; then, each solution in the solution space is respectively mapped to the qubit state in the second quantum algorithm model, and the quantum circuit of the second quantum algorithm model is run to obtain the probability of the qubit state corresponding to each solution in the solution space; finally, among each solution in the solution space, the solution with the highest probability of the corresponding qubit state is determined as the optimal solution of the TSP model, so as to set various parameters of the database based on the parameter value combination corresponding to the optimal solution of the TSP model.
[0192] Based on Figure 3 the solution in the embodiment shown, please refer to Figure 6 which shows the flowchart of the parameter setting method provided by another exemplary embodiment of the present application. This method is executed by a computer device. As Figure 6 shown, before the above step 320, the method may further include step 312:
[0193] Step 312: Normalize the parameter value ranges of various parameters, and the normalization process is used to unify the parameter value ranges of various parameters to a specified numerical range;
[0194] The above step 320 can be implemented as step 320a:
[0195] Step 320a: Construct a TSP model based on the parameter value ranges of various parameters after normalization and the objective function.
[0196] In the embodiments of the present application, the computer device normalizes (normalized) various parameters so that all parameters are within a numerical range; then, based on the parameter value ranges of various parameters after normalization and the objective function, a TSP model is constructed.
[0197] The embodiments of the present application provide a technical solution for normalizing various parameters before constructing the Traveling Salesman Problem (TSP) model. At the same time, the computer device can construct a TSP model based on the parameter value ranges of various parameters after normalization and the objective function. This not only unifies the parameter value ranges of various parameters to a specified numerical range, but also facilitates subsequent processing and improves the efficiency of solving the optimal solution of the TSP model.
[0198] Based on Figure 6 the solution in the embodiment shown, please refer to Figure 7 , which shows a flowchart of a parameter setting method provided by another exemplary embodiment of the present application. This method is executed by a computer device. As Figure 7 shown, the above step 350 can be implemented as step 350a and step 350b.
[0199] Step 350a: Perform the inverse process of the normalization process on the parameter values in the parameter value combination corresponding to the optimal solution to obtain the optimized parameter values of multiple parameters;
[0200] Step 350b: Set multiple parameters of the database based on the optimized parameter values of multiple parameters.
[0201] In the embodiment of the present application, since the normalization process is performed on multiple parameters in the above steps, therefore, the inverse process of the normalization process can be performed on the parameter values in the parameter value combination corresponding to the optimal solution to obtain the optimized parameter values of multiple parameters; then, based on the optimized parameter values of multiple parameters, set multiple parameters of the database.
[0202] The embodiment of the present application provides an inverse process solution relative to the above normalization process, which is convenient for obtaining the optimized parameter values of multiple parameters, and then setting multiple parameters of the database, and can further improve the efficiency of solving the parameter optimization problem, thereby optimizing the database performance.
[0203] In some embodiments, based on Figure 3 the solution in the embodiment shown, multiple parameters include the parameters corresponding to the query configuration of the database.
[0204] In the embodiment of the present application, the computer device can perform a query operation on the database through the API. How to complete the query operation with the least execution time and resource consumption requires setting the parameters related to the query in the database. Therefore, multiple parameters in the embodiment of the present application include the parameters corresponding to the query configuration of the database.
[0205] The embodiment of the present application provides an applicable scenario of the technical solution of the present application, specifically applied to the query scenario of the database, and the parameters involved are the parameters corresponding to the query configuration of the database, which can further optimize the applicability and operability of the technical solution of the present application.
[0206] In some embodiments, multiple parameters include multiple of the following parameters:
[0207] Cache parameters, concurrent connection parameters, query optimization parameters, index parameters, log parameters, memory allocation parameters, disk input / output parameters, processor utilization parameters.
[0208] In the embodiments of the present application, taking MySQL as an example, multiple parameters include multiple of the following parameters.
[0209] Cache size: The MySQL cache size refers to the amount of data cached by MySQL in memory. Increasing the cache size can improve query performance but also consume more memory resources.
[0210] Among them, common cache parameters include: innodb_buffer_pool_size, key_buffer_size, etc.
[0211] Concurrent connection number: The MySQL concurrent connection number refers to the number of connections that MySQL processes simultaneously. Increasing the concurrent connection number can improve concurrent performance but also consume more system resources.
[0212] Among them, common concurrent connection parameters include: max_connections, thread_cache_size, etc.
[0213] Query optimizer: The MySQL query optimizer refers to the algorithm used by MySQL to optimize the query execution plan. Different query optimizers may have different impacts on query performance.
[0214] Among them, common query optimization parameters include: optimizer_switch, join_buffer_size, etc.
[0215] Index: The MySQL index is a data structure used to accelerate queries. Increasing the index can improve query performance but also consume more storage space and system resources.
[0216] Among them, common index parameters include: innodb_ft_result_cache_limit, innodb_ft_total_cache_size, etc.
[0217] Log: The MySQL log is used to record information about MySQL operations. Increasing the log level can improve the ability to troubleshoot faults but also consume more storage space and system resources.
[0218] Among them, common log parameters include: log_error, slow_query_log, etc.
[0219] Memory allocation: The MySQL memory allocation refers to the size of the memory blocks allocated by MySQL in memory. Increasing the memory allocation size can improve query performance but also consume more memory resources.
[0220] Among them, common memory allocation parameters include: innodb_log_buffer_size, sort_buffer_size, etc.
[0221] Disk Input Output (IO): MySQL disk IO refers to the speed at which MySQL reads and writes to the disk. Optimizing disk IO can improve query performance, but factors such as disk capacity and disk read / write speed also need to be considered.
[0222] Among them, common disk IO parameters include: innodb_io_capacity, innodb_flush_method, etc.
[0223] CPU utilization: MySQL CPU utilization refers to the efficiency of MySQL in using the CPU. Optimizing CPU utilization can improve query performance, but factors such as the number of CPU cores and CPU load also need to be considered.
[0224] Among them, common CPU utilization parameters include: innodb_thread_concurrency, innodb_spin_wait_delay, etc.
[0225] The embodiments of the present application provide an exemplary solution for multiple parameters to facilitate solving the problem of parameter tuning in MySQL.
[0226] Please refer to Figure 8 , which shows a flowchart for solving the parameter tuning problem based on a traditional computer provided by an exemplary embodiment of the present application. As Figure 8 shown, the computer device can transform the parameter tuning problem into a TSP problem and then use the TSP algorithm to find the optimal parameter settings.
[0227] Specifically, the parameter settings can be mapped to the path of a traveling salesman, and the objective function can be mapped to the length of the travel path. Then, the TSP algorithm (such as dynamic programming, genetic algorithm, etc.) is usually used to solve the shortest path.
[0228] Please refer to Figure 9 , which shows a flowchart for solving the parameter tuning problem based on a quantum computer provided by an exemplary embodiment of the present application. As Figure 9 shown, since both the TSP and Hamiltonian cycle problems are NP-complete problems, and NP-complete problems have a reduction property. Therefore, the TSP problem can be reduced to the Hamiltonian cycle problem, that is, if the Hamiltonian cycle problem is solved, then the TSP problem can also be solved, that is, the parameter optimization problem can be solved.
[0229] Specifically, for example, the Grover algorithm can be used to model and calculate on a quantum computer to solve the TSP problem.
[0230] Please refer to Figure 10 , which shows a flowchart of a parameter selection method provided by an exemplary embodiment of the present application, and is used to illustrate the implementation manner of the solution of the present application. As Figure 10 shown, it includes the following steps:
[0231] S101: Collect parameters, determine the parameter value range, and model it into a parameter tuning problem;
[0232] S102: Transform the parameter tuning problem into a quantum computing problem;
[0233] S103: Use quantum algorithms, such as Grover algorithm and quantum simulation algorithm, to solve the quantum computing problem;
[0234] S104: Determine the optimal parameter selection according to the quantum computing result.
[0235] Apply the optimal parameter selection to the database query configuration to improve the efficiency and accuracy of query optimization.
[0236] In summary, the present application can solve the parameter tuning problem more quickly and efficiently by utilizing the characteristics of quantum computing, thereby improving the efficiency and accuracy of the overall database query. Compared with traditional computers, quantum computers can process data at an exponential level, and at the same time utilize the characteristics of quantum superposition and quantum parallelism to process or estimate the performance of multiple possible parameter combinations simultaneously, thereby improving the query efficiency of the final database. In addition, quantum computers can optimize the query performance through the characteristics of quantum entanglement and quantum interference, thereby improving the accuracy and efficiency of the query.
[0237] The present application can solve the parameter problem more quickly and efficiently, thereby improving the efficiency and accuracy of query optimization. The system of the present application can be applied to various database query optimization scenarios, including enterprise-level databases, cloud databases, and big data analysis, etc. Among them, the above database can be the database corresponding to the server, and the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
[0238] The role of database parameter tuning is to optimize the performance and reliability of the database system to meet different business and user requirements. The parameters in the database system include cache size, thread pool size, log size, locking granularity, etc. Different parameter configurations will have different impacts on the performance and reliability of the database system. Therefore, selecting the optimal parameter configuration is crucial for the performance and reliability of the database system.
[0239] This application utilizes the latest quantum computing technology, which has strong practical significance for enhancing the competitiveness and technical influence of distributed databases.
[0240] Quantum computing technology is an emerging computing technology that can process a large amount of data and complex computational problems in a short time by using the principles of quantum mechanics. In terms of database parameter tuning, quantum computing technology can bring the following benefits:
[0241] 1. Faster parameter tuning speed: Quantum computing technology can process a large amount of data and complex computational problems in a short time, so it can complete the parameter tuning process faster and improve the tuning efficiency.
[0242] 2. More accurate parameter tuning results: Quantum computing technology can handle more complex computational problems, so it can analyze the relationship between the performance of the database system and parameter configurations more accurately and improve the accuracy of the tuning results.
[0243] 3. More comprehensive parameter tuning solutions: Quantum computing technology can handle more data and parameter combinations, so it can generate more comprehensive parameter tuning solutions and improve the tuning effect.
[0244] 4. More efficient resource utilization: Quantum computing technology can optimize the resource utilization of the database system, including CPU utilization, memory utilization, disk utilization, etc. This can improve the efficiency and sustainable development ability of the database system.
[0245] 5. Better scalability: Quantum computing technology can handle larger-scale data and computational problems, so it can better meet the scalability requirements of the database system and improve the sustainable development ability of the database system.
[0246] In summary, quantum computing technology can bring faster, more accurate, more comprehensive, more efficient, and more scalable parameter tuning solutions, improve the performance and reliability of the database system, and enhance the business efficiency and competitiveness of enterprises.
[0247] Figure 11 It shows a block diagram of a parameter setting device shown in an exemplary embodiment of this application. This device can be used to execute as Figure 3 、 Figure 4 、 Figure 5 、Figure 6 or Figure 9 In the method shown, all or part of the steps executed by the computer device are as follows Figure 11 shown, the device includes:
[0248] An acquisition module 1101, configured to acquire the parameter value ranges of multiple parameters of the database, and the objective function of the database; the objective function is used to measure the performance metrics of the database;
[0249] A first model construction module 1102, configured to construct a Traveling Salesman Problem (TSP) model based on the parameter value ranges of multiple parameters and the objective function, where the path in the TSP model is a combination of parameter values of multiple parameters; the path length in the TSP model is the objective function;
[0250] A second model construction module 1103, configured to construct a quantum algorithm model based on the TSP model;
[0251] A solving module 1104, configured to solve the optimal solution of the TSP model based on the quantum algorithm model;
[0252] A parameter setting module 1105, configured to set multiple parameters of the database based on the combination of parameter values corresponding to the optimal solution of the TSP model.
[0253] In some embodiments, the second model construction module 1103 is configured to
[0254] Based on the TSP model, construct a first quantum algorithm model and a second quantum algorithm model, where the first quantum algorithm model is used to query the solution space of the TSP model, and the second quantum algorithm model is used to query the optimal solution in the solution space;
[0255] Wherein, each solution in the solution space corresponds to a combination of parameter values of multiple parameters.
[0256] In some embodiments, the first quantum algorithm model is a Hamiltonian cycle problem model;
[0257] Each solution in the solution space corresponds to a Hamiltonian cycle in the Hamiltonian cycle problem model.
[0258] In some embodiments, the second quantum algorithm model is a Grover's algorithm model;
[0259] Each solution in the solution space corresponds to a qubit state in the Grover's algorithm model.
[0260] In some embodiments, the solving module 1104 is configured to execute the quantum circuit corresponding to the first quantum algorithm model through a quantum computer to obtain each solution in the solution space;
[0261] Map each solution in the solution space to a qubit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probabilities of the qubit states corresponding to the solutions in the solution space;
[0262] Among the solutions in the solution space, determine the solution with the highest probability of the corresponding qubit state as the optimal solution of the TSP model.
[0263] In some embodiments, the apparatus further includes: a processing module, configured to,
[0264] Before the first model construction module 1102 constructs the traveling salesman problem (TSP) model based on the parameter value ranges of multiple parameters and the objective function, perform a normalization process on the parameter value ranges of the multiple parameters, where the normalization process is used to unify the parameter value ranges of the multiple parameters to a specified numerical range;
[0265] The first model construction module 1102 is configured to,
[0266] Construct a TSP model based on the parameter value ranges of the multiple parameters after the normalization process and the objective function.
[0267] In some embodiments, the parameter setting module 1105 is configured to,
[0268] Perform the inverse process of the normalization process on the parameter values in the parameter value combination corresponding to the optimal solution to obtain the optimized parameter values of the multiple parameters;
[0269] Set the multiple parameters of the database based on the optimized parameter values of the multiple parameters.
[0270] In some embodiments, the multiple parameters include the parameters corresponding to the query configuration of the database.
[0271] In some embodiments, the multiple parameters include multiple of the following parameters:
[0272] Cache parameters, concurrent connection parameters, query optimization parameters, index parameters, log parameters, memory allocation parameters, disk input / output parameters, processor utilization parameters.
[0273] Figure 12The structural block diagram of a computer device 1200 shown in an exemplary embodiment of the present application is illustrated. The computer device 1200 includes a Central Processing Unit (CPU) 1201, a system memory 1204 including a Random Access Memory (RAM) 1202 and a Read-Only Memory (ROM) 1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The computer device 1200 also includes a mass storage device 1206 for storing an operating system 1209, application programs 1210, and other program modules 1211.
[0274] The mass storage device 1206 is connected to the central processing unit 1201 through a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1206 and its associated computer-readable medium provide non-volatile storage for the computer device 1200. That is to say, the mass storage device 1206 may include computer-readable media (not shown) such as a hard disk or a Compact Disc Read-Only Memory (CD-ROM) drive.
[0275] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, magnetic tape cartridges, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage media is not limited to the above several types. The above-mentioned system memory 1204 and mass storage device 1206 may be collectively referred to as memory.
[0276] According to various embodiments of the present disclosure, the computer device 1200 can also be run by a remote computer on the network through a network such as the Internet. That is, the computer device 1200 can be connected to the network 1208 through the network interface unit 1207 connected to the system bus 1205. Or rather, the network interface unit 1207 can also be used to connect to other types of networks or remote computer systems (not shown).
[0277] The memory further includes at least one computer program. The at least one computer program is stored in the memory, and the central processing unit 1201 implements all or part of the steps in the methods shown in the above various embodiments by executing the at least one computer program.
[0278] In an exemplary embodiment, a chip is further provided. The chip includes a programmable logic circuit and / or program instructions, which are used to implement the parameter setting method in the above aspects when the chip runs on a computer device.
[0279] In an exemplary embodiment, a computer program product is further provided. The computer program product includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement the parameter setting method provided in the above method embodiments.
[0280] In an exemplary embodiment, a computer-readable storage medium is further provided. A computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the parameter setting method provided in the above method embodiments.
[0281] Please refer to Figure 13 , which shows a schematic structural diagram of a parameter setting system provided by an exemplary embodiment of the present application. As Figure 13 shown, the system may include a database 1310, a classical computer 1320, and a quantum computer 1330.
[0282] The classical computer 1320 is configured to obtain the parameter value ranges of various parameters of the database 1310 and the objective function of the database 1310; the objective function is used to measure the performance index of the database 1310; build a traveling salesman problem (TSP) model based on the parameter value ranges of various parameters and the objective function, where the paths in the TSP model are combinations of parameter values of various parameters; the path length in the TSP model is the objective function; build a quantum algorithm model based on the TSP model.
[0283] The quantum computer 1330 is configured to solve the optimal solution of the TSP model based on the quantum algorithm model.
[0284] A classical computer 1320 is used to set various parameters of a database based on a parameter value combination corresponding to an optimal solution of a TSP model.
[0285] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a disk, an optical disc, etc.
[0286] Those skilled in the art should be able to realize that in the above one or more examples, the functions described in the embodiments of the present application can be implemented by hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. The computer-readable medium includes computer storage media and communication media, where the communication media includes any medium that facilitates the transfer of a computer program from one place to another. The storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0287] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.
Claims
1. A parameter setting method, characterized in that, The method includes: Obtaining the parameter value ranges of multiple parameters of the database, and the objective function of the database; the objective function is used to measure the performance metrics of the database; Constructing a Traveling Salesman Problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function, where the paths in the TSP model are combinations of parameter values of the multiple parameters; the path length in the TSP model is the objective function; Based on the TSP model, constructing a first quantum algorithm model and a second quantum algorithm model, where the first quantum algorithm model is used to query the solution space of the TSP model, and the second quantum algorithm model is used to query the optimal solution in the solution space; wherein, each solution in the solution space corresponds to a combination of parameter values of the multiple parameters; Solving the optimal solution of the TSP model based on the first quantum algorithm model and the second quantum algorithm model; Setting the multiple parameters of the database based on the combination of parameter values corresponding to the optimal solution of the TSP model; 2. The method according to claim 1, characterized in that, The first quantum algorithm model is a Hamiltonian cycle problem model; Each solution in the solution space corresponds to a Hamiltonian cycle in the Hamiltonian cycle problem model; 3. The method according to claim 1, wherein The second quantum algorithm model is a Grover's algorithm model; Each solution in the solution space corresponds to a qubit state in the Grover's algorithm model; 4. The method according to any one of claims 1 to 3, characterized in that, The solving the optimal solution of the TSP model based on the first quantum algorithm model and the second quantum algorithm model includes: Executing the quantum circuit corresponding to the first quantum algorithm model by a quantum computer to obtain each solution in the solution space; Mapping each solution in the solution space to a qubit state in the second quantum algorithm model respectively, and running the quantum circuit corresponding to the second quantum algorithm model to obtain the probabilities of the qubit states corresponding to each solution in the solution space; Determining the solution with the highest probability of the qubit state among each solution in the solution space as the optimal solution of the TSP model; 5. The method according to claim 1, characterized in that Before constructing the Traveling Salesman Problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function, it further includes: Performing a normalization process on the parameter value ranges of the multiple parameters, and the normalization process is used to unify the parameter value ranges of the multiple parameters to a specified numerical range; The constructing the Traveling Salesman Problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function includes: Constructing the TSP model based on the parameter value ranges of the multiple parameters after the normalization process and the objective function; 6. The method according to claim 5, wherein The setting the multiple parameters of the database based on the combination of parameter values corresponding to the optimal solution of the TSP model includes: Performing the inverse process of the normalization process on the parameter values in the combination of parameter values corresponding to the optimal solution to obtain the optimized parameter values of the multiple parameters; Setting the multiple parameters of the database based on the optimized parameter values of the multiple parameters; 7. The method according to claim 1, characterized in that The multiple parameters include the parameters corresponding to the query configuration of the database; 8. The method according to claim 7, wherein The multiple parameters include multiple of the following parameters: Cache parameters, concurrent connection parameters, query optimization parameters, index parameters, log parameters, memory allocation parameters, disk input / output parameters, processor utilization parameters.
9. A parameter setting device, characterized in that, The device includes: An acquisition module, configured to acquire the parameter value ranges of multiple parameters of a database, and the objective function of the database; the objective function is used to measure the performance metrics of the database; A first model construction module, configured to construct a Traveling Salesman Problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function, where the paths in the TSP model are combinations of the parameter values of the multiple parameters; the path length in the TSP model is the objective function; A second model construction module, configured to construct a first quantum algorithm model and a second quantum algorithm model based on the TSP model, where the first quantum algorithm model is used to query the solution space of the TSP model, and the second quantum algorithm model is used to query the optimal solution in the solution space; wherein, each solution in the solution space corresponds to a combination of the parameter values of the multiple parameters; A solution module, configured to solve the optimal solution of the TSP model based on the first quantum algorithm model and the second quantum algorithm model; A parameter setting module, configured to set the multiple parameters of the database based on the combination of the parameter values corresponding to the optimal solution of the TSP model.
10. A computer device, characterized in that, The computer device includes a processor and a memory, and the memory stores at least one computer instruction, and the at least one computer instruction is loaded and executed by the processor to implement the parameter setting method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, At least one computer instruction is stored in the computer-readable storage medium, and the computer instruction is loaded and executed by the processor to implement the parameter setting method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, The computer program product includes computer instructions, and the computer instructions are stored in the computer-readable storage medium; the computer instructions are read and executed by the processor of the computer device to implement the parameter setting method according to any one of claims 1 to 8.
13. A parameter setting system, characterized in that, The system includes: A database, a classical computer, and a quantum computer; The classical computer is configured to acquire the parameter value ranges of multiple parameters of a database, and the objective function of the database; the objective function is used to measure the performance metrics of the database; construct a Traveling Salesman Problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function, where the paths in the TSP model are combinations of the parameter values of the multiple parameters; the path length in the TSP model is the objective function; construct a first quantum algorithm model and a second quantum algorithm model based on the TSP model, where the first quantum algorithm model is used to query the solution space of the TSP model, and the second quantum algorithm model is used to query the optimal solution in the solution space; wherein, each solution in the solution space corresponds to a combination of the parameter values of the multiple parameters; The quantum computer is configured to solve the optimal solution of the TSP model based on the first quantum algorithm model and the second quantum algorithm model; The classical computer is used to set the multiple parameters of the database based on the parameter value combination corresponding to the optimal solution of the TSP model.
Citation Information
Patent Citations
Hybrid quantum algorithm-based combinatorial optimization solving method, system and solver architecture
CN113392580A