Parameter-setting method, system, and apparatus, device, storage medium, and program product
By converting the database parameter tuning problem into a TSP model, and using quantum algorithm to solve it on a quantum computer, finally setting the database parameters is solved, the problem of low database parameter tuning efficiency is achieved, faster and more efficient parameter settings are achieved, and database query efficiency is improved.
Patent Information
- Application Number
- PCT/CN2024/126536
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-11-08
- Filing Date
- 2024-10-22
- Publication Date
- 2025-05-15
AI Technical Summary
Parameter tuning efficiency in database systems is low, and the existing technology requires a lot of time and resources, making it difficult to quickly find the optimal parameter configuration.
The database parameter tuning problem is transformed into a travel dealer problem (TSP) model, and the quantum algorithm model is used to solve it on a quantum computer, and finally the database parameters are set according to the optimal solution.
Through the exponential data processing capabilities and quantum superposition characteristics of quantum computers, the efficiency and accuracy of parameter tuning are significantly improved, the tuning time is shortened, and the efficiency of database queries is improved.
Smart Images

Figure CN2024126536_15052025_PF_FP_ABST
Abstract
Description
Parameter setting method, system, device, equipment, storage medium and program product
[0001] This application claims priority to the Chinese patent application filed on November 8, 2023, with application number 202311482543.7 and invention name “Parameter setting method, system, device, equipment, storage medium and program product”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the technical field of database systems, and in particular to a parameter setting method, system, device, equipment, storage medium, and program product. Background Art
[0003] How to choose the optimal parameter configuration is an important issue in database systems.
[0004] In related technologies, database parameter tuning problems can usually be solved based on experience and trial and error. Current parameter tuning research mainly focuses on automated tuning, statistics-based tuning, machine learning-based tuning, and deep learning-based tuning.
[0005] However, due to the huge magnitude of database system parameters, the tuning solutions in related technologies require a lot of time and resources, resulting in low efficiency in database parameter tuning.
[0006] Summary of the Invention
[0007] The present application provides a parameter setting method, system, device, equipment, storage medium and program product, which can solve the parameter tuning problem of the database more quickly and efficiently, and ensure the efficiency and accuracy of the parameter setting of the database; the content of the technical solution is as follows.
[0008] According to one aspect of the present application, a parameter setting method is provided, the method being executed by a computer device, the method comprising:
[0009] Obtaining parameter value ranges of multiple parameters of the database and an objective function of the database; the objective function is used to measure performance indicators of the database;
[0010] A traveling salesman problem (TSP) model is constructed based on the parameter value ranges of the multiple parameters and the objective function, wherein the path in the TSP model is a combination of the parameter values of the multiple parameters; and the path length in the TSP model is the objective function;
[0011] Based on the TSP model, a quantum algorithm model is constructed;
[0012] Based on the quantum algorithm model, solving the optimal solution of the TSP model;
[0013] The multiple parameters of the database are set based on the parameter value combination corresponding to the optimal solution of the TSP model.
[0014] According to one aspect of the present application, a parameter setting system is provided, comprising:
[0015] Databases, classical computers, and quantum computers;
[0016] The classical computer is used to obtain parameter value ranges of multiple parameters of a database and an objective function of the database; the objective function is used to measure a performance indicator 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, wherein a path in the TSP model is a combination of parameter values of the multiple parameters; the path length in the TSP model is the objective function; and a quantum algorithm model is constructed based on the TSP model;
[0017] The quantum computer is used to solve the optimal solution of the TSP model based on the quantum algorithm model;
[0018] 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.
[0019] According to one aspect of the present application, a parameter setting device is provided, the device comprising:
[0020] An acquisition module, configured to acquire parameter value ranges of various parameters of a database and an objective function of the database; the objective function is used to measure performance indicators of the database;
[0021] A first model building module is configured to build a traveling salesman problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function, wherein a path in the TSP model is a combination of the parameter values of the multiple parameters; and a path length in the TSP model is the objective function;
[0022] A second model building module is used to build a quantum algorithm model based on the TSP model;
[0023] A solution module, configured to solve the optimal solution of the TSP model based on the quantum algorithm model;
[0024] A parameter setting module 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.
[0025] In some embodiments, the second model building module is used to build a first quantum algorithm model and a second quantum algorithm model based on the TSP model, the first quantum algorithm model is used to query the solution space of the TSP problem, 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 parameter value combination of the multiple parameters.
[0026] In some embodiments, the first quantum algorithm model is a Hamiltonian circuit problem model; each solution in the solution space corresponds to a Hamiltonian circuit in the Hamiltonian circuit problem model.
[0027] In some embodiments, the second quantum algorithm model is a Grover algorithm model; each solution in the solution space corresponds to a quantum bit state in the Grover algorithm model.
[0028] In some embodiments, the solution module is used to execute the quantum circuit corresponding to the first quantum algorithm model through a quantum computer to obtain each solution in the solution space; map each solution in the solution space to a quantum bit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probability of the quantum bit state corresponding to each solution in the solution space; and determine the solution with the highest probability of the corresponding quantum bit state among the solutions in the solution space as the optimal solution of the TSP model.
[0029] In some embodiments, the apparatus further comprises: a processing module configured to perform a normalization process on the parameter value ranges of the plurality of parameters before the first model building module, wherein the normalization process is configured to unify the parameter value ranges of the plurality of parameters into a specified numerical range;
[0030] The first model building module is used to build the TSP model based on the parameter value ranges of the multiple parameters after normalization and the objective function.
[0031] In some embodiments, the parameter setting module is used to 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 tuned parameter values of the multiple parameters; and set the multiple parameters of the database based on the tuned parameter values of the multiple parameters.
[0032] In some embodiments, the plurality of parameters include parameters corresponding to a query configuration of the database.
[0033] In some embodiments, 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, and processor utilization parameters.
[0034] According to another aspect of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, 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 described above.
[0035] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores at least one instruction, at least one program, a code set, or an instruction set, 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 described above.
[0036] According to another aspect of the present application, a computer program product is provided, which includes computer instructions stored in a computer-readable storage medium. A processor reads and executes the computer instructions from the computer-readable storage medium to implement the parameter setting method described above.
[0037] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0038] By converting the parameter tuning problem into a quantum computing problem and then solving the quantum computing problem using a quantum algorithm, the target solution to the parameter tuning problem can be obtained. Compared with classical computers, quantum computers can process data at an exponential level and can simultaneously process or estimate the performance of multiple possible parameter combinations. Therefore, the technical solutions provided by the embodiments of the present application can solve the parameter tuning problem of the database more quickly and efficiently, ensure the efficiency and accuracy of the database parameter settings, and thus improve the efficiency and accuracy of database queries. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] FIG1 is a diagram of a distributed database architecture provided by an exemplary embodiment of the present application;
[0040] FIG2 is a schematic diagram of an application scenario of a solution provided by an embodiment of the present application;
[0041] FIG3 is a flow chart of a parameter setting method provided by an exemplary embodiment of the present application;
[0042] FIG4 is a flow chart of a parameter setting method provided by another exemplary embodiment of the present application;
[0043] FIG5 is a flow chart of a parameter setting method provided by another exemplary embodiment of the present application;
[0044] FIG6 is a flow chart of a parameter setting method provided by yet another exemplary embodiment of the present application;
[0045] FIG7 is a flowchart of a parameter setting method provided by another exemplary embodiment of the present application;
[0046] FIG8 is a flowchart of solving a parameter tuning problem based on a classical computer according to an exemplary embodiment of the present application;
[0047] FIG9 is a flowchart of solving a parameter tuning problem based on a quantum computer according to an exemplary embodiment of the present application;
[0048] FIG10 is a flow chart of a parameter selection method provided by an exemplary embodiment of the present application;
[0049] FIG11 is a block diagram of a parameter setting device according to an exemplary embodiment of the present application;
[0050] FIG12 is a structural block diagram of a computer device provided by an exemplary embodiment of the present application;
[0051] FIG13 is a schematic diagram of a parameter setting system provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0052] The following are some definitions of terms involved in this application:
[0053] A database (DB) is a large, sharable collection of data organized into a structure and stored permanently on a computer. Each database has one or more application programming interfaces (APIs) for creating, accessing, managing, searching, and replicating the stored data.
[0054] Quantum computing: A method of computing that uses quantum logic to rapidly complete computational tasks, leveraging properties such as superposition and entanglement of quantum states. The fundamental unit of data storage in quantum computing is the qubit.
[0055] Qubit: A quantum information carrier and the fundamental unit of quantum computing. Classical computers use 0 and 1 as the fundamental units of binary. However, quantum computing can process both 0 and 1 simultaneously, allowing the system to be in a linear superposition of 0 and 1: |ψ> = α|0> + β|1>, where α and β represent the complex probability amplitude of the system at 0 and 1. The square of the modulus of α and β, |α| 2、|β| 2 represent the probabilities of being 0 and 1 respectively.
[0056] Quantum Operation: Manipulate the quantum bits to process the quantum information carried by the quantum bits. Common quantum operations include Pauli X, Y, and Z transformations (or σ x , σ y , σ z ), Hadamard transform (H), controlled Pauli X transform, that is, controlled not gate (CNOT), etc.
[0057] Quantum Circuit: A model describing quantum computing, consisting of qubits and quantum operations on them, representing the hardware implementation of a corresponding quantum algorithm or program within the quantum gate model. A quantum circuit consists of a sequence of quantum gates, which perform computations. If a quantum circuit includes adjustable parameters to control the quantum gates, it is called a parameterized quantum circuit.
[0058] Quantum Computing Device: A physical device that performs quantum computing.
[0059] The Traveling Salesman Problem (TSP) is a classic combinatorial optimization problem. The classic TSP can be described as follows: a salesman travels to several cities to sell goods. Starting from one city, the salesman must visit all cities before returning to the starting point. How should the salesman choose a route that minimizes the total distance? From a graph theory perspective, the problem essentially involves finding a Hamiltonian circuit with the minimum weight in a weighted, completely undirected graph. Because a feasible solution to this problem requires a full permutation of all vertices, increasing the number of vertices leads to a combinatorial explosion. Therefore, the TSP is an NP-complete problem.
[0060] Hamiltonian cycle: Let G = (V, E) be a graph. If a path in G passes through every vertex exactly once, this path is called a Hamiltonian path. If a cycle in G passes through every vertex exactly once, this cycle is called a Hamiltonian cycle. If a graph has a Hamiltonian cycle, it is called a Hamiltonian graph.
[0061] Nondeterminism Polynomial (NP) problem: All decision problems that can be solved in nondeterministic polynomial time constitute NP problems.
[0062] Grover algorithm: also known as the quantum search algorithm, refers to an unstructured search algorithm that runs on a quantum computer and is one of the typical algorithms of quantum computing.
[0063] A distributed database (DDB) is a physically decentralized yet logically centralized database system, resulting from the integration of database technology and computer networks. A DDB consists of a computing layer, a storage layer, and a metadata layer. The computing layer is responsible for performing data access permission checks and routing; the storage layer stores data; and the metadata layer stores metadata information. When the computing layer of a distributed database is started, it accesses the metadata layer to obtain all cluster information, enabling it to correctly perform tasks such as parsing and routing Structured Query Language (SQL).
[0064] Please refer to Figure 1, which shows a distributed database architecture diagram provided by an exemplary embodiment of the present application. As shown in Figure 1, the distributed database includes a scheduler (Scheduler), a ZK cluster, a gateway and a setter (Set).
[0065] Scheduler:
[0066] 1. Pull the DDL task from ZK and execute it on the actual MySQL instance;
[0067] 2. Obtain tasks from ZK and generate expansion tasks;
[0068] 3. Control the master / slave switch within the Set;
[0069] 4. Multiple schedulers themselves achieve disaster recovery through ZK elections.
[0070] Gateway:
[0071] 1. Identify DDL operations and save them to the ZK cluster as tasks;
[0072] 2. Identify DML operations, convert them into SQL, and send them to the master or slave server in the corresponding set;
[0073] 3. Collect responses from each node in the Set, combine them, and return them to the front-end application API;
[0074] 4. Check the ZK cluster and pull information such as routing and permissions.
[0075] Set:
[0076] 1. Check the instance status and report it to ZK;
[0077] 2. Check the status of the table and report it to ZK;
[0078] 3. Pull the migration task from ZK and execute it;
[0079] 4. Participate in the master-slave switching process.
[0080] Data Definition Language (DDL): used to create or delete databases used to store data and objects such as tables in the database.
[0081] Data Manipulation Language (DML): used to query or change records in a table.
[0082] Decision-making (ZooKeeper, ZK) cluster: Its main functions are configuration maintenance, election decision-making, routing synchronization, etc.; it can also assist in storing routing, control information, task information, heartbeat information, etc.
[0083] Parameter tuning is a critical issue in database systems. It involves selecting the optimal parameter configuration to improve database system performance and reliability. Parameters in database systems include cache size, thread pool size, log size, and lock granularity. Different parameter configurations have varying impacts on database system performance and reliability. Therefore, selecting the optimal parameter configuration is crucial to database system performance and reliability.
[0084] Traditional parameter tuning methods are typically based on experience and trial-and-error, requiring extensive manual intervention and experimentation. This approach is inefficient and difficult to find the optimal parameter configuration. Therefore, research on how to automatically select the optimal parameter configuration has become a hot topic in database system research.
[0085] Current parameter tuning research focuses on automated tuning, statistics-based tuning, machine learning-based tuning, and deep learning-based tuning. These research findings can help database administrators and developers select optimal parameter configurations and improve database system performance and reliability.
[0086] Quantum computing has garnered widespread attention across many research fields, driven by researchers' hopes of achieving quantum advantage in complex computations. While quantum computing has been studied for decades, the accelerated development of quantum computing hardware in recent years has fueled a surge in interest. Furthermore, cloud-based access to quantum systems has made quantum computing more accessible to researchers, enabling the first experiments to be conducted on actual quantum processing units (QPUs).
[0087] Unlike central processing units (CPUs), QPUs perform computations using quantum bits, or qubits. The mathematical states of QPUs are exponentially larger than classical bits and can realize phenomena such as quantum superposition, quantum entanglement, and quantum interference. It is widely believed that, given accepted complexity theory assumptions, quantum systems offer significantly higher computational power than classical systems. Several quantum algorithms have been shown to accelerate performance, and several groundbreaking experiments have demonstrated quantum advantage on real hardware.
[0088] Furthermore, quantum computing excels at optimization problems that require finding 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.
[0089] Therefore, exploring the application of quantum cloud services (QCs) in database query optimization is a challenging and promising research direction.
[0090] Parameter tuning is a crucial issue in database optimization. Traditional computers require significant time and resources to solve this problem, as parameter tuning is inherently nondeterministic and polynomial (NP) hard due to its vast parameter space. Therefore, a faster and more efficient approach is needed to address this problem.
[0091] The emergence of quantum computers offers new opportunities for solving parameter tuning problems. Quantum computers, based on the principles of quantum mechanics, can, in some cases, solve certain problems faster than classical computers. Quantum machine learning is a method that uses quantum computers to accelerate machine learning. In parameter tuning optimization, quantum machine learning can accelerate the optimization process using techniques such as quantum support vector machines (QSVM) and parameterized quantum circuits (PQC).
[0092] Please refer to Figure 2, which shows a schematic diagram of an application scenario of a solution provided by an embodiment of the present application. As shown in Figure 2, the application scenario can be a superconducting quantum computing platform, which includes: a quantum computing device 21, a dilution refrigerator 22, a control device 23, and a computer 24.
[0093] The quantum computing device 21 is a circuit that acts on a physical quantum bit. The quantum computing device 21 can be implemented as a quantum chip, such as a superconducting quantum chip at near absolute zero. The dilution refrigerator 22 is used to provide an absolute zero environment for the superconducting quantum chip.
[0094] Control device 23 controls quantum computing device 21, and computer 24 controls control device 23. For example, a pre-written quantum program is compiled into instructions by software in computer 24 and sent to control device 23 (e.g., an electronic / microwave control system). Control device 23 converts these instructions into electronic / microwave control signals, which are then input into dilution refrigerator 22 to control the superconducting qubits, which are kept at a temperature below 10 mK. The reading process is the opposite, with the read waveform being transmitted to quantum computing device 21.
[0095] Before introducing the embodiment of the method of the present application, the operating environment of the method is first introduced. The method provided in the embodiment of the present application can be executed in a hybrid device environment of a classical computer and a quantum computer.
[0096] Classical computers use a binary system to store and process information using bits. While the computing power of classical computers continues to increase with hardware development, their speed remains limited by physical constraints, making it difficult to achieve theoretically optimal solutions for certain problems. For example, NP-complete problems can only be solved on classical computers through exhaustive enumeration, which requires a very high time complexity.
[0097] A quantum computer is a computer that uses quantum bits (qubits) to store and process information. Unlike classical computer bits, which can only process states of 0 or 1, qubits can possess the characteristics of quantum superposition and quantum entanglement, which makes quantum computers have more powerful computing capabilities than computers.
[0098] In the following method embodiments, for ease of description, only the computer device as the execution subject of each step is introduced and described. It should be understood that the computer device can include a hybrid execution environment of a classical computer and a quantum computer, and the embodiments of the present application are not limited to this.
[0099] Please refer to Figure 3, which shows a flow chart of a parameter setting method provided by an exemplary embodiment of the present application. The method is executed by a computer device, as shown in Figure 3, and the method may include steps 310, 320, 330, 340, and 350.
[0100] Step 310: Obtain parameter value ranges of various parameters of the database, as well as the objective function of the database; the objective function is used to measure performance indicators of the database.
[0101] In an embodiment of the present application, a computer device may collect multiple parameters from a database to determine parameter ranges for the multiple parameters and obtain an objective function for the database. The objective function is used to measure an indicator of the performance or effectiveness of the database. Optionally, the objective function is a function used to measure the performance or effectiveness of the database. For example, the objective function takes the parameter values of the multiple parameters of the database as input and outputs an indicator of the performance or effectiveness of the database. The database may be an enterprise-level database, a cloud database, or the like.
[0102] Among them, various parameters include cache size, thread pool size, log size, lock granularity, etc. Different parameter configurations will have different effects on the performance and reliability of the database system.
[0103] The parameter range is the range of the parameter's value. The range of various parameters is usually limited. For example, the parameter range of a thread is 1-10.
[0104] In some embodiments, the computer device may perform normalization processing on the parameter value ranges of the various parameters to unify the parameter value ranges of the various parameters into a specified numerical range.
[0105] In one possible implementation, the normalization process performed on the parameter value ranges of the multiple parameters may refer to performing normalization on the parameter value range of each parameter separately to unify the parameter value range of the parameter into a specified numerical range. The numerical ranges of the parameter value ranges after normalization of different parameters may be the same, or the numerical ranges of the parameter value ranges after normalization of different parameters may be different.
[0106] Step 320: Construct a traveling salesman problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function. The path in the TSP model is a combination of the parameter values of the multiple parameters; and the path length in the TSP model is the objective function.
[0107] In an embodiment of the present application, the computer device may construct a traveling salesman problem (TSP) model based on the parameter value ranges of the various parameters and the objective function obtained in step 310 .
[0108] The TSP model is a mathematical model of the Traveling Salesman (TSP) problem. The mathematical description of the TSP problem can be expressed using graph theory. Consider a graph G = (V, E), where V is the set of vertices, representing cities, and E is the set of edges, representing the connections between cities. Each edge (i, j) has a weight w(i, j), representing the distance from city i to city j. The goal of the TSP is to find a path that minimizes the total distance, passing through each vertex once and returning to the starting point.
[0109] In the embodiment of the present application, the path in the above-mentioned TSP model is a combination of parameter values of multiple parameters. The parameter value combination is usually a variable that needs to be adjusted and optimized. In the TSP model, the parameter value combination can be regarded as the path selection of the traveling salesman, that is, the order in which the traveling salesman visits each city.
[0110] The path length in the TSP model is the objective function. An objective function is typically a metric used to measure the performance or effectiveness of parameter settings. In the TSP model, the objective function is to find the shortest path that allows the traveling salesman to visit each city exactly once and return to the starting city.
[0111] That is to say, the above-mentioned construction of the TSP model based on the parameter value ranges of multiple parameters and the objective function is to construct a TSP model with the parameter value combination of multiple parameters as the path and the objective function as the path length.
[0112] Step 330: Construct a quantum algorithm model based on the TSP model.
[0113] In an embodiment of the present application, the computer device may construct a quantum algorithm model based on the TSP model constructed in step 320 .
[0114] The TSP is an NP-hard problem in combinatorial optimization. Solving it using traditional computational models requires significant time and resources. However, quantum algorithms, based on quantum logic, can rapidly solve it, leveraging properties such as superposition and entanglement of quantum states. Compared to classical computers, quantum computers can process data at exponential levels. By leveraging quantum superposition and parallelism, they can simultaneously process or estimate the performance of multiple possible parameter combinations, thereby improving database query efficiency.
[0115] Among them, the above-mentioned quantum algorithm model, also called quantum computing model or quantum circuit model, is a mathematical model used to represent quantum circuits.
[0116] Step 340: Find the optimal solution of the TSP model based on the quantum algorithm model.
[0117] In an embodiment of the present application, the computer device can solve the optimal solution of the TSP model based on the quantum algorithm model constructed in step 330.
[0118] Among them, the above-mentioned solving the optimal solution of the TSP model based on the quantum algorithm model may refer to running the above-mentioned quantum algorithm model and obtaining the running result of the quantum algorithm model to obtain the optimal solution of the TSP model.
[0119] Step 350: Based on the parameter value combination corresponding to the optimal solution of the TSP model, set various parameters of the database.
[0120] In an 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. For example, the computer device may set various parameter values corresponding to the parameter value combination corresponding to the optimal solution of the TSP model as parameter values of various parameters of the database.
[0121] In summary, the technical solution provided by the embodiment of the present application is to construct the parameter value combination of various parameters of the database as the path in the TSP model, and to construct the objective function of the database as the path length in the TSP model; based on the TSP model, a quantum algorithm model is constructed; based on the quantum algorithm model, the optimal solution of the TSP model is solved by quantum computing, and the various parameters of the database are set accordingly, thereby optimizing the performance indicators of the database. Compared with traditional computing, quantum computing can process data at an exponential level and can simultaneously process or estimate the performance of multiple possible parameter combinations. Therefore, the solution shown in the embodiment of the present application can solve the parameter tuning problem of the database more quickly and efficiently, ensure the efficiency and accuracy of the parameter setting of the database, and thus improve the efficiency and accuracy of database queries.
[0122] Based on the solutions shown in any one or more of the above-mentioned embodiments of the present application, please refer to Figure 4, which shows a flow chart of a parameter setting method provided by another exemplary embodiment of the present application. The method is executed by a computer device. As shown in Figure 4, step 330 in the embodiment shown in Figure 3 above can be implemented as step 330a.
[0123] Step 330a: Based on the TSP model, a first quantum algorithm model and a second quantum algorithm model are constructed. The first quantum algorithm model is used to query the solution space of the TSP problem, and the second quantum algorithm model is used to query the optimal solution in the solution space.
[0124] Each solution in the solution space corresponds to a parameter value combination of multiple parameters.
[0125] In this embodiment of the present application, the computer device can construct a first quantum algorithm model for querying the solution space of the TSP problem, and a second quantum algorithm model for querying the solution space for the optimal solution, based on the TSP model constructed in step 320. Each solution in the solution space corresponds to a combination of parameter values for multiple parameters.
[0126] That is to say, the above-mentioned construction of the first quantum algorithm model and the second quantum algorithm model based on the TSP model refers to constructing a first quantum algorithm model for querying the solution space of the TSP problem, and a second quantum algorithm model for querying the optimal solution in the solution space.
[0127] In some embodiments, the first quantum algorithm model may be an NP-complete problem model, such as a Hamiltonian circuit problem model.
[0128] In some embodiments, the second quantum algorithm model may be a Grover algorithm model, or may be a quantum simulation algorithm model.
[0129] Quantum computers exploit the superposition and entanglement properties of quantum bits (qubits) to process multiple possibilities in a single calculation. This gives them potential advantages in fields such as search, optimization, and simulation. For NP-valued problems, quantum computers can exploit quantum parallelism and quantum coherence to search the solution space in the hope of finding a solution. Quantum parallelism allows quantum computers to process multiple possible solutions simultaneously, while quantum coherence allows them to exploit interference effects during the search process to increase the probability of finding the correct solution.
[0130] In quantum computing, feedback is typically obtained by measuring the state of qubits. The output of a quantum computer is a series of qubit-measured outcomes, expressed as probabilities. By running the same calculation multiple times, the frequency of measurement results can be counted and used to estimate the solution to the problem.
[0131] This embodiment of the application provides a technical solution for constructing a quantum algorithm model based on the Transitional Programming (TSP) model. Two quantum algorithm models are constructed: one for searching the solution space of the TSP problem and the other for searching for the optimal solution within that solution space. Compared to classical computers, quantum computers can leverage quantum parallelism and quantum coherence to exponentially search the solution space and find the optimal solution to the TSP problem, thereby solving parameter tuning problems more quickly and efficiently.
[0132] Based on the solutions shown in any one or more of the above embodiments of the present application, in some embodiments, the above-mentioned first quantum algorithm model is a Hamiltonian circuit problem model; each solution in the solution space corresponds to a Hamiltonian circuit in the Hamiltonian circuit problem model.
[0133] Among them, the quantum existence problem can be mapped to the Hamiltonian circuit existence problem, and the results of quantum calculation can be reflected in the solution of the Hamiltonian circuit.
[0134] NP-complete problems have a reduction property. TSP and Hamiltonian cycle problems are both NP-complete problems. TSP problem can be reduced to Hamiltonian problem, that is, if the Hamiltonian cycle problem is solved, then the TSP problem can also be solved, that is, the parameter optimization problem of the database can be solved.
[0135] The embodiment of the present application provides a selection scheme for the first quantum algorithm model, specifically a Hamiltonian circuit problem model, which is used to query the solution space of the TSP problem, and corresponds a Hamiltonian circuit in the Hamiltonian circuit problem model to a solution in the solution space, which can further optimize the completeness and reliability of the technical solution of the present application.
[0136] Based on the solutions shown in any one or more of the above embodiments of the present application, in some embodiments, the above second quantum algorithm model is a Grover algorithm model; each solution in the solution space corresponds to a quantum bit state in the Grover algorithm model.
[0137] In embodiments of the present application, a quantum counting algorithm can be used to accelerate the solution of NP-complete problems. An example of an NP-complete problem is the Hamiltonian circuit problem. The method for determining whether a graph is a Hamiltonian circuit problem is as follows: assuming there is a Hamiltonian circuit, a simple solution to the Hamiltonian circuit problem is to check each vertex order to see if it is a Hamiltonian circuit. Finding all possible orderings of vertices in the graph can be accomplished by quantum counting using Grover's algorithm. The quantum counting algorithm itself is sufficient to determine whether a Hamiltonian circuit exists.
[0138] Grover's algorithm is a quantum algorithm that can search for a target item in an unsorted database in O(sqrt(N)) time. Grover's algorithm can be used to accelerate the solution of NP problems.
[0139] In the embodiments of the present application, the solution space of an NP problem can be viewed as an unsorted database, and the Grover algorithm can be used to search for solutions in the solution space. By mapping each solution in the solution space to a parameter item in a database, the Grover algorithm can be used to search for the optimal solution in the solution space.
[0140] For example, suppose you want to search a solution space containing N elements for a solution that satisfies certain conditions. Using a traditional search algorithm, it would take O(N) time to find the solution. However, using Grover's algorithm, the solution can be found in O(sqrt(N)) time. For example, given the same problem, Grover's algorithm solves it in 10,000 calculations, while a classical computer would require 10,000^2 = 100,000,000 calculations.
[0141] The solution shown in the embodiment of the present application maps the above solution space into an unsorted database, and the computer device can use the Grover algorithm to search for the optimal solution in the solution space.
[0142] An embodiment of the present application provides a selection scheme for a second quantum algorithm model, specifically a Grover algorithm model; wherein the quantum bit state in the Grover algorithm model corresponds to a solution in the solution space, and the Grover algorithm can be used to accelerate the search for the optimal solution in the solution space, thereby improving the efficiency of solving parameter optimization problems.
[0143] Based on the solutions shown in any one or more of the above-mentioned embodiments of the present application, please refer to Figure 5, which shows a flow chart of a parameter setting method provided by another exemplary embodiment of the present application. The method is executed by a computer device. As shown in Figure 5, step 340 in the embodiment shown in Figure 4 above can be implemented as steps 340a, 340b, and 340c.
[0144] 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.
[0145] In an embodiment of the present application, after the first quantum algorithm model and the second quantum algorithm model are constructed 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.
[0146] Step 340b: Map each solution in the solution space to a quantum bit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probability of the quantum bit state corresponding to each solution in the solution space.
[0147] In an embodiment of the present application, after obtaining each solution in the solution space in step 340a, the computer device can map each solution in the solution space to a quantum bit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probability of the quantum bit state corresponding to each solution in the solution space.
[0148] Among them, the above-mentioned mapping of each solution in the solution space to a quantum bit state in the second quantity algorithm model means mapping each solution in the solution space to a quantum bit state in the second quantity algorithm model, that is, mapping different solutions in the solution space to different quantum bit states in the second quantity algorithm model.
[0149] Step 340c: Determine the solution with the highest probability of the corresponding quantum bit state among the solutions in the solution space as the optimal solution of the TSP model.
[0150] In an embodiment of the present application, after obtaining the probabilities of the quantum bit states corresponding to the respective solutions in the solution space in step 340b, the computer device may determine the solution with the highest probability of the corresponding quantum bit state among the solutions in the solution space as the optimal solution of the TSP model.
[0151] The optimal database parameter setting is one of all possible combinations of parameter values. Therefore, database parameter tuning can be mapped to a combinatorial optimization problem, such as the Traveling Salesman Problem (TSP). The relationship between parameter tuning and the TSP can be understood as follows:
[0152] Objective function: In parameter tuning problems, the objective function is usually an indicator to measure the performance or effect of parameter settings; 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.
[0153] Parameter settings: In parameter tuning problems, parameter settings are variables that need to be adjusted and optimized; in the TSP problem, parameter settings can be regarded as the path selection of the traveling salesman, that is, determining in what order the traveling salesman visits each city.
[0154] Constraints: In parameter tuning problems, there may be some constraints (such as data dependencies between parameters, overall performance balance), which limit the range of parameter values or relationships. In the TSP problem, the constraint is that the traveling salesman must pass through each city once and eventually return to the starting city.
[0155] In step 320, a traveling salesman problem (TSP) model is constructed based on the parameter ranges of various parameters and the objective function, thus mapping the parameter optimization problem into the TSP problem. The parameter settings are mapped to the path of the TSP model, the objective function is mapped to the length of the path, and the constraints are mapped to the path being a loop and the path passing through each city only once.
[0156] Among them, in step 330, a quantum algorithm model is constructed based on the TSP model, that is, the TSP problem (i.e., parameter optimization problem) is converted into a quantum computing problem; in step 340, the optimal solution to the TSP problem (i.e., optimal parameter setting) can be quickly found based on the quantum algorithm model; finally, various parameters of the database are set accordingly.
[0157] For example, quantum algorithm models include the Hamiltonian circuit problem model and the Grover algorithm model. First, the Hamiltonian circuit problem model is used to find all possible vertex orderings in the Hamiltonian graph, that is, to find all possible paths for the TSP problem, that is, to find all possible parameter value combinations for multiple parameters. Then, the Grover algorithm model is used to search for the optimal vertex ordering (i.e., the optimal parameter value combination), specifically including:
[0158] Represent all possible vertex orderings (i.e., parameter value combinations) as different qubit states;
[0159] Mark the target quantum bit state through Oracle;
[0160] Increase the probability of the target quantum bit state through Grover iteration;
[0161] Performing measurements on the quantum bits; wherein the measurement results are expressed in the form of probabilities;
[0162] The quantum bit state with the maximum probability corresponds to the optimal vertex ordering (i.e. the optimal parameter value combination).
[0163] Among them, taking the second quantum algorithm model as the Grover algorithm model as an example, modeling and feedback of the Grover algorithm in quantum computing involves the following steps.
[0164] 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 can represent the problem's search space as quantum bit (qubit) states. Each item in the search space is mapped to a qubit state, which contains information about the problem.
[0165] 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.
[0166] S3, Oracle: Oracle is a key part of Grover's algorithm, used to mark the target item. In quantum computing, an oracle can be represented as a quantum gate or quantum circuit that can manipulate the state of quantum bits according to the specific conditions of the problem.
[0167] S4, Grover Iteration: The Grover algorithm increases the probability of the target item by applying multiple Grover iterations. Each Grover iteration consists of three steps: S41 applying the Oracle, S42 applying the reflection operation, and S43 repeating.
[0168] S41, Applying an Oracle: In each iteration of the Grover algorithm, an oracle operation is first applied. The oracle serves to mark the target item, distinguishing it from other items. Quantum computers can achieve this by manipulating the state of qubits.
[0169] Specifically, the oracle manipulates the state of the qubits according to the specific conditions of the problem, distinguishing the target term from other terms. For example, this can be achieved by applying a specific quantum gate or quantum circuit.
[0170] S42, apply reflection operation: After S41 applies the Oracle, S42 applies the reflection operation. The reflection operation is the core part of Grover's algorithm and helps increase the probability amplitude of the target item, making it easier to measure.
[0171] Specifically, the reflection operation can be implemented by a quantum gate or quantum circuit called Grover reflection. The reflection operation reverses the state of the quantum bit with respect to the average amplitude, thereby increasing the probability amplitude of the target term.
[0172] S43, Repetition: 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 problem size and the probability amplitude of the target term. Typically, the number of repetitions is approximately the square root of N, where N is the number of terms in the database with various parameters. By repeatedly applying the Oracle and Reflection operation, the probability amplitude of the target term gradually increases, making it easier to measure.
[0173] By iterating these three steps, Grover's algorithm can efficiently search for the target item in the unsorted database. Each iteration helps increase the probability amplitude of the target item, thereby improving the accuracy and efficiency of finding the target item.
[0174] S5, Measurement: At the end of the Grover algorithm, the qubits need to be measured to obtain the final result. The measurement results are expressed in the form of probabilities, where the result with the highest probability corresponds to the optimal solution of the TSP model.
[0175] The measurement method can be implemented through the hardware of the quantum computer, such as quantum measurement gates or measurement circuits. These quantum measurement gates or measurement circuits will perform corresponding operations based on the state of the quantum bit, converting it into the state of a classical bit.
[0176] Specifically, the above S5 measurement process can be simply described as the following steps.
[0177] S51, Preparation: Before making a measurement, you need to ensure that the qubit is in the desired state. This involves applying a series of quantum operations, such as applying a Hadamard gate to create a uniform superposition state.
[0178] S52, Measure: In response to the qubit being in the desired state, a measurement operation is performed. The measurement operation causes the qubit state to collapse to the state of a classical bit, i.e., 0 or 1. The result of the measurement is random, but the probability is proportional to the square of the state amplitude of the qubit.
[0179] S53, Result: The result of the measurement is expressed in the form of probability, where the result with the highest probability corresponds to the solution to the problem. For example, in the Grover algorithm, if the target item is correctly labeled, then the probability of the corresponding target item in the measurement result will be high.
[0180] Let's take an example to illustrate the measurement process: suppose there is a quantum bit in a superposition state When you make a measurement, you get either 0 or 1, each with a probability of 1 / 2. This means that if you repeat the measurement many times, you'll get 0 about half the time and 1 about half the time.
[0181] It is important to note that the measurement operation causes the state of the qubit to collapse to the state of the classical bit, so after the measurement, the information of the qubit will be lost. Therefore, in the Grover 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.
[0182] In terms of feedback, the results of the Grover algorithm are usually obtained by running the algorithm multiple times and statistically measuring the frequency of the 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.
[0183] The embodiment of the present application provides a technical solution for solving the optimal solution of the TSP model based on a quantum algorithm model, which can use quantum algorithms to obtain the optimal solution of the TSP model more quickly and efficiently. Specifically, a quantum computer executes the quantum circuit of a first quantum algorithm model to obtain each solution in the solution space; then, each solution in the solution space is mapped to a quantum bit state in a second quantum algorithm model, and the quantum circuit of the second quantum algorithm model is run to obtain the probability of the quantum bit state corresponding to each solution in the solution space; finally, the solution with the highest probability of the corresponding quantum bit state among the solutions in the solution space is determined as the optimal solution of the TSP model, so that various parameters of the database can be set based on the parameter value combination corresponding to the optimal solution of the TSP model.
[0184] Based on the solutions shown in any one or more of the above embodiments of the present application, please refer to Figure 6, which shows a flow chart of a parameter setting method provided by another exemplary embodiment of the present application. The method is executed by a computer device. As shown in Figure 6, before the above step 320, the method may also include step 312:
[0185] Step 312: performing normalization processing on the parameter value ranges of the multiple parameters, wherein the normalization processing is used to unify the parameter value ranges of the multiple parameters into a specified numerical range;
[0186] The above step 320 can be implemented as step 320a:
[0187] Step 320a: Construct a TSP model based on the parameter ranges of the normalized parameters and the objective function.
[0188] In an embodiment of the present application, a computer device normalizes multiple parameters so that all parameters are within a numerical range; then, a TSP model is constructed based on the parameter ranges of the normalized multiple parameters and the objective function.
[0189] Among them, the above-mentioned construction of the TSP model based on the parameter value range of the multiple parameters after normalization and the objective function is to construct a TSP model with the parameter value combination of the multiple parameters after normalization as the path and the objective function as the path length.
[0190] The present invention provides a technical solution for normalizing multiple parameters before constructing a TSP model. Furthermore, a computer device can construct the TSP model based on the parameter ranges of the normalized parameters and an objective function. This not only normalizes the parameter ranges of the multiple parameters to a specified numerical range, but also facilitates subsequent processing and improves the efficiency of finding the optimal solution for the TSP model.
[0191] Based on the solutions shown in any one or more of the above-mentioned embodiments of the present application, please refer to Figure 7, which shows a flow chart of a parameter setting method provided by another exemplary embodiment of the present application. The method is executed by a computer device. As shown in Figure 7, the above-mentioned step 350 can be implemented as steps 350a and 350b.
[0192] Step 350a: Perform an inverse process of the normalization process on the parameter values in the parameter value combination corresponding to the optimal solution to obtain tuned parameter values of multiple parameters.
[0193] Step 350b: Setting various parameters of the database based on the optimized parameter values of the various parameters.
[0194] In an embodiment of the present application, since normalization processing is performed on multiple parameters in the above steps, the inverse processing of the normalization processing can be performed on the parameter values in the parameter value combination corresponding to the optimal solution to obtain the tuned parameter values of the multiple parameters; then, based on the tuned parameter values of the multiple parameters, the multiple parameters of the database are set.
[0195] The inverse process of the above-mentioned normalization process refers to mapping the parameter values in the parameter value combination to the parameter value domain before the inverse process of the corresponding parameters to obtain the above-mentioned optimized parameter values.
[0196] For example, the computer device sets the various parameters of the database based on the optimized parameter values of the various parameters, including but not limited to: directly setting the optimized parameter values of the various parameters as the various parameters of the database.
[0197] The embodiment of the present application provides an inverse processing solution relative to the above-mentioned normalization processing, which facilitates obtaining the tuned parameter values of multiple parameters, and then setting multiple parameters of the database, which can further improve the efficiency of solving parameter optimization problems, thereby optimizing database performance.
[0198] Based on the solutions shown in any one or more of the above-mentioned embodiments of the present application, in some embodiments, based on the solution in the embodiment shown in FIG3 , the multiple parameters include parameters corresponding to the query configuration of the database.
[0199] In the embodiments of the present application, a computer device can perform a query operation on a database through an API. To complete the query operation with minimal execution time and resource consumption, it is necessary to set the query-related parameters in the database. Therefore, the various parameters in the embodiments of the present application include parameters corresponding to the query configuration of the database.
[0200] The embodiment of the present application provides an applicable scenario of the technical solution of the present application, specifically a query scenario applied to a database. The parameters involved are 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.
[0201] Based on the solutions shown in any one or more of the above embodiments of the present application, in some embodiments, the multiple parameters include multiple parameters of the following parameters:
[0202] Cache parameters, concurrent connection parameters, query optimization parameters, index parameters, log parameters, memory allocation parameters, disk input / output parameters, and processor utilization parameters.
[0203] In the embodiment of the present application, taking MySQL as an example, the multiple parameters include multiple of the following parameters.
[0204] Cache size: The MySQL cache size refers to the amount of data that MySQL caches in memory. Increasing the cache size can improve query performance, but it also uses more memory resources.
[0205] Among them, common cache parameters include: innodb_buffer_pool_size, key_buffer_size, etc.
[0206] Concurrent connections: MySQL concurrent connections refer to the number of connections that MySQL processes simultaneously. Increasing the number of concurrent connections can improve concurrency performance, but it also consumes more system resources.
[0207] Among them, common concurrent connection parameters include: max_connections, thread_cache_size, etc.
[0208] Query Optimizer: The MySQL query optimizer is the algorithm MySQL uses to optimize query execution plans. Different query optimizers may have different effects on query performance.
[0209] Common query optimization parameters include optimizer_switch and join_buffer_size.
[0210] Index: MySQL indexes are data structures used to speed up queries. Adding indexes can improve query performance, but it also takes up more storage space and system resources.
[0211] Among them, common index parameters include: innodb_ft_result_cache_limit, innodb_ft_total_cache_size, etc.
[0212] Logs: MySQL logs record information about MySQL operations. Increasing the log level improves troubleshooting capabilities, but also consumes more storage space and system resources.
[0213] Common log parameters include log_error, slow_query_log, etc.
[0214] Memory allocation: 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 it also consumes more memory resources.
[0215] Among them, common memory allocation parameters include: innodb_log_buffer_size, sort_buffer_size, etc.
[0216] 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.
[0217] Among them, common disk IO parameters include: innodb_io_capacity, innodb_flush_method, etc.
[0218] CPU utilization: MySQL CPU utilization refers to how efficiently MySQL uses 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.
[0219] Among them, common CPU utilization parameters include: innodb_thread_concurrency, innodb_spin_wait_delay, etc.
[0220] The embodiments of the present application provide an example solution for multiple parameters, introduce the parameter types that can be tuned through the solution shown in the present application, clarify the application scenarios of the solution shown in the present application, and facilitate solving the parameter tuning problem of MySQL.
[0221] Please refer to Figure 8, which shows a flowchart of solving the parameter tuning problem based on a classical computer according to an exemplary embodiment of the present application. As shown in Figure 8, 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.
[0222] Specifically, the parameter settings can be mapped to the path of the traveling salesman, the objective function can be mapped to the length of the travel path, and then a TSP algorithm (such as dynamic programming, genetic algorithm, etc.) is usually used to solve the shortest path.
[0223] Please refer to Figure 9, which shows a flowchart of a method for solving a parameter tuning problem based on a quantum computer, provided by an exemplary embodiment of the present application. As shown in Figure 9, the parameter tuning problem is first converted into a TSP problem. Since both the TSP and the Hamiltonian circuit problem are NP-complete problems, there is a reduction property between NP-complete problems. Therefore, the TSP problem can be reduced to the Hamiltonian circuit problem, that is, if the Hamiltonian circuit problem is solved, the TSP problem can also be solved, that is, the parameter optimization problem is solved; then, a Grover algorithm for database search problems is constructed to solve the Hamiltonian circuit problem; then, the Grover algorithm can be used to model and calculate on a quantum computer to solve the TSP problem. The solution to the TSP problem can be used as the solution to the parameter optimization problem to optimize the parameters of the database.
[0224] Please refer to Figure 10, which shows a flow chart of a parameter selection method provided by an exemplary embodiment of the present application, for illustrating the implementation of the present application scheme. As shown in Figure 10, the following steps are included:
[0225] S101: Collect database parameters, determine parameter ranges, and model them as parameter tuning problems;
[0226] S102: Convert the parameter tuning problem into a quantum computing problem; specifically, convert the parameter tuning problem into a TSP problem, and then convert the TSP problem into a quantum computing problem;
[0227] S103: Use quantum algorithms, such as Grover's algorithm and quantum simulation algorithm, to solve quantum computing problems;
[0228] S104: Determine the optimal parameter selection for the database based on the quantum computing results.
[0229] Afterwards, the computer device can apply the optimal parameter selection to the database query configuration to improve the efficiency and accuracy of the query optimization.
[0230] In summary, this application leverages the characteristics of quantum computing to solve parameter tuning problems more quickly and efficiently, thereby improving the efficiency and accuracy of overall database queries. Compared to classical computers, quantum computers can process data at an exponential level, while leveraging the properties of quantum superposition and quantum parallelism to simultaneously process or estimate the performance of multiple possible parameter combinations, thereby improving the final database query efficiency. In addition, quantum computers can optimize query performance through the properties of quantum entanglement and quantum interference, thereby improving query accuracy and efficiency.
[0231] The present application can solve parameter problems 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. Among them, the above-mentioned database can be a database corresponding to a 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 that provides 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 networks (CDNs), and big data and artificial intelligence platforms.
[0232] Database parameter tuning optimizes database system performance and reliability to meet diverse business and user needs. Database system parameters include cache size, thread pool size, log size, and lock granularity. Different parameter configurations have varying impacts on database system performance and reliability. Therefore, selecting the optimal parameter configuration is crucial for database system performance and reliability.
[0233] This application utilizes the latest quantum computing technology and has strong practical significance for improving the competitiveness and technological influence of distributed databases.
[0234] Quantum computing is an emerging technology that leverages the principles of quantum mechanics to process large amounts of data and complex computational problems in a short period of time. When it comes to database parameter tuning, quantum computing can bring the following benefits:
[0235] 1. Faster parameter tuning speed: Quantum computing technology can process large amounts of data and complex computing problems in a short period of time, so the parameter tuning process can be completed faster and the tuning efficiency can be improved.
[0236] 2. More accurate parameter tuning results: Quantum computing technology can handle more complex computing problems, so it can more accurately analyze the relationship between database system performance and parameter configuration, improving the accuracy of tuning results.
[0237] 3. More comprehensive parameter tuning solutions: Quantum computing technology can process more data and parameter combinations, so it can generate more comprehensive parameter tuning solutions and improve the tuning effect.
[0238] 4. More efficient resource utilization: Quantum computing technology can optimize the resource utilization of database systems, including CPU utilization, memory utilization, disk utilization, etc. This can improve the efficiency and sustainable development capabilities of database systems.
[0239] 5. Better scalability: Quantum computing technology can handle larger-scale data and computing problems, so it can better meet the scalability requirements of database systems and improve the sustainable development capabilities of database systems.
[0240] In short, quantum computing technology can bring faster, more accurate, more comprehensive, more efficient and more scalable parameter tuning solutions, improve the performance and reliability of database systems, and enhance the business efficiency and competitiveness of enterprises.
[0241] FIG11 is a block diagram of a parameter setting device according to an exemplary embodiment of the present application. The device may be used to execute all or part of the steps executed by a computer device in the method shown in FIG3 , FIG4 , FIG5 , FIG6 , or FIG9 . The device includes:
[0242] The acquisition module 1101 is used to obtain the parameter value ranges of various parameters of the database and the objective function of the database; the objective function is used to measure the performance indicators of the database;
[0243] A first model building module 1102 is configured to build a traveling salesman problem (TSP) model based on parameter ranges of multiple parameters and an objective function, wherein a path in the TSP model is a combination of parameter values of the multiple parameters; and a path length in the TSP model is an objective function.
[0244] The second model building module 1103 is used to build a quantum algorithm model based on the TSP model;
[0245] A solution module 1104 is used to solve the optimal solution of the TSP model based on the quantum algorithm model;
[0246] The parameter setting module 1105 is used to set various parameters of the database based on the parameter value combination corresponding to the optimal solution of the TSP model.
[0247] In some embodiments, the second model construction module 1103 is used 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 problem, 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 parameter value combination of multiple parameters.
[0248] In some embodiments, the first quantum algorithm model is a Hamiltonian circuit problem model; each solution in the solution space corresponds to a Hamiltonian circuit in the Hamiltonian circuit problem model.
[0249] In some embodiments, the second quantum algorithm model is a Grover algorithm model; each solution in the solution space corresponds to a quantum bit state in the Grover algorithm model.
[0250] In some embodiments, the solution 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; map each solution in the solution space to a quantum bit state in the second quantum algorithm model, and run the quantum circuit corresponding to the second quantum algorithm model to obtain the probability of the quantum bit state corresponding to each solution in the solution space; and determine the solution with the highest probability of the corresponding quantum bit state among the solutions in the solution space as the optimal solution of the TSP model.
[0251] In some embodiments, the apparatus further includes: a processing module configured to perform a normalization process on the parameter value ranges of the multiple parameters before the first model building module 1102 builds the TSP model based on the parameter value ranges of the multiple parameters and the objective function, wherein the normalization process is configured to normalize the parameter value ranges of the multiple parameters to a specified numerical range;
[0252] The first model building module 1102 is used to build a TSP model based on the parameter ranges of the normalized parameters and the objective function.
[0253] In some embodiments, the parameter setting module 1105 is used to 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 tuned parameter values of multiple parameters; and set multiple parameters of the database based on the tuned parameter values of multiple parameters.
[0254] In some embodiments, the plurality of parameters include parameters corresponding to a query configuration of a database.
[0255] In some embodiments, the plurality of parameters include a plurality of the following parameters: cache parameters, concurrent connection parameters, query optimization parameters, index parameters, log parameters, memory allocation parameters, disk input / output parameters, and processor utilization parameters.
[0256] FIG12 shows a block diagram of a computer device 1200 according to an exemplary embodiment of the present application. 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 CPU 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.
[0257] The mass storage device 1206 is connected to the central processing unit 1201 via a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1206 and its associated computer-readable media provide non-volatile storage for the computer device 1200. In other words, the mass storage device 1206 may include a computer-readable medium (not shown) such as a hard disk or a Compact Disc Read-Only Memory (CD-ROM) drive.
[0258] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include 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 include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, tape cassettes, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above-mentioned ones. The above-mentioned system memory 1204 and mass storage device 1206 can be collectively referred to as memory.
[0259] According to various embodiments of the present disclosure, the computer device 1200 may also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 1200 may be connected to the network 1208 via the network interface unit 1207 connected to the system bus 1205, or the network interface unit 1207 may be used to connect to other types of networks or remote computer systems (not shown).
[0260] The memory further includes at least one computer program, which is stored in the memory. The central processing unit 1201 implements all or part of the steps in the methods shown in the above embodiments by executing the at least one computer program.
[0261] In an exemplary embodiment, a chip is further provided. The chip includes a programmable logic circuit and / or program instructions. When the chip runs on a computer device, it is used to implement the parameter setting method in the above aspect.
[0262] In an exemplary embodiment, a computer program product is also provided. The computer program product includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions from the computer-readable storage medium to implement the parameter setting methods provided in the above-mentioned method embodiments.
[0263] In an exemplary embodiment, a computer-readable storage medium is further provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the parameter setting methods provided by the above-mentioned method embodiments.
[0264] Please refer to Figure 13, which shows a schematic diagram of the structure of a parameter setting system provided by an exemplary embodiment of the present application. As shown in Figure 13, the system may include a database 1310, a classical computer 1320, and a quantum computer 1330.
[0265] A classical computer 1320 is configured to obtain parameter ranges of various parameters of the database 1310 and an objective function of the database 1310; the objective function is configured to measure a performance indicator of the database 1310; a traveling salesman problem (TSP) model is constructed based on the parameter ranges of the various parameters and the objective function, wherein a path in the TSP model is a combination of parameter values of the various parameters; the path length in the TSP model is the objective function; and a quantum algorithm model is constructed based on the TSP model.
[0266] Quantum computer 1330, used to find the optimal solution to the TSP model based on a quantum algorithm model;
[0267] The classical computer 1320 is used to set various parameters of the database based on the parameter value combination corresponding to the optimal solution of the TSP model.
[0268] The classical computer 1320 may be implemented as the computer 24 in the application scenario shown in FIG2 ; the quantum computer 1330 may be implemented as the quantum computing device 21 , the dilution refrigerator 22 , and the control device 23 in the application scenario shown in FIG2 .
[0269] In an exemplary embodiment, a quantum computer is also provided. The quantum computer is used in a quantum algorithm model to solve the optimal solution of the TSP model, so that a classical computer can set multiple parameters of a database based on the parameter value combination corresponding to the optimal solution of the TSP model; wherein the quantum algorithm model obtains the parameter value ranges of the multiple parameters of the database and the objective function of the database by the classical computer, constructs a traveling salesman problem TSP model based on the parameter value ranges of the multiple parameters and the objective function, and builds a model based on the constructed TSP model; wherein the objective function is used to measure the performance index of the database; the path in the TSP model is a parameter value combination of multiple parameters; and the path length in the TSP model is the objective function.
Claims
1. A parameter setting method, characterized in that: The method is performed by a computer device, and the method comprises: Obtaining parameter value ranges of multiple parameters of a database and an objective function of the database; the objective function is used to measure performance indicators 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, wherein the path in the TSP model is a combination of the parameter values of the multiple parameters; and the path length in the TSP model is the objective function; Based on the TSP model, a quantum algorithm model is constructed; Based on the quantum algorithm model, solving the optimal solution of the TSP model; The multiple parameters of the database are set based on a combination of parameter values corresponding to an optimal solution of the TSP model.
2. The method according to claim 1, characterized in that: The step of constructing a quantum algorithm model based on the TSP model includes: Based on the TSP model, a first quantum algorithm model and a second quantum algorithm model are constructed, wherein the first quantum algorithm model is used to query the solution space of the TSP problem, and the second quantum algorithm model is used to query the optimal solution in the solution space; Each solution in the solution space corresponds to a parameter value combination of the multiple parameters.
3. The method according to claim 2, characterized in that The first quantum algorithm model is a Hamiltonian circuit problem model; Each solution in the solution space corresponds to a Hamiltonian circuit in the Hamiltonian circuit problem model.
4. The method according to claim 2 or 3, characterized in that: The second quantum algorithm model is a Grover algorithm model; Each solution in the solution space corresponds to a quantum bit state in the Grover algorithm model.
5. The method according to any one of claims 2 to 4, characterized in that: Solving the optimal solution of the TSP model based on the 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 quantum bit state in the second quantum algorithm model, and running the quantum circuit corresponding to the second quantum algorithm model to obtain the probability of the quantum bit state corresponding to each solution in the solution space; Among the solutions in the solution space, the solution with the highest probability of the corresponding quantum bit state is determined as the optimal solution of the TSP model.
6. The method according to any one of claims 1 to 5, characterized in that: Before constructing the TSP model based on the parameter value ranges of the multiple parameters and the objective function, the method further includes: Performing a normalization process on the parameter value ranges of the plurality of parameters, wherein the normalization process is used to unify the parameter value ranges of the plurality of parameters into a specified numerical range; The constructing of the traveling salesman problem (TSP) model based on the parameter value ranges of the multiple parameters and the objective function includes: The TSP model is constructed based on the parameter value ranges of the multiple parameters after normalization and the objective function.
7. The method according to claim 6, characterized in that The parameter value combination corresponding to the optimal solution of the TSP model is used to set the multiple parameters of the database, including: Performing an inverse process of the normalization process on the parameter values in the parameter value combination corresponding to the optimal solution to obtain tuned parameter values of the multiple parameters; The various parameters of the database are set based on the tuned parameter values of the various parameters.
8. The method according to any one of claims 1 to 7, characterized in that: The multiple parameters include parameters corresponding to the query configuration of the database.
9. The method according to any one of claims 1 to 8, characterized in that: 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.
10. A parameter setting device, characterized in that: The device comprises: An acquisition module, used to acquire parameter value ranges of various parameters of a database, and an objective function of the database; the objective function is used to measure a performance index of the database; A first model building module is used to build a TSP model of the traveling salesman problem based on the parameter value ranges of the multiple parameters and the objective function, wherein the path in the TSP model is a combination of the parameter values of the multiple parameters; and the path length in the TSP model is the objective function; A second model building module is used to build a quantum algorithm model based on the TSP model; A solution module, used for solving the optimal solution of the TSP model based on the quantum algorithm model; The parameter setting module 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.
11. The device according to claim 10, characterized in that The second model building module is used to: Based on the TSP model, a first quantum algorithm model and a second quantum algorithm model are constructed, wherein the first quantum algorithm model is used to query the solution space of the TSP problem, and the second quantum algorithm model is used to query the optimal solution in the solution space; Each solution in the solution space corresponds to a parameter value combination of the multiple parameters.
12. The device according to claim 11, characterized in that The first quantum algorithm model is a Hamiltonian circuit problem model; Each solution in the solution space corresponds to a Hamiltonian circuit in the Hamiltonian circuit problem model.
13. The device according to claim 11 or 12, characterized in that The second quantum algorithm model is a Grover algorithm model; Each solution in the solution space corresponds to a quantum bit state in the Grover algorithm model.
14. The device according to any one of claims 11 to 13, characterized in that: The solution module is used to: 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 quantum bit state in the second quantum algorithm model, and running the quantum circuit corresponding to the second quantum algorithm model to obtain the probability of the quantum bit state corresponding to each solution in the solution space; Among the solutions in the solution space, the solution with the highest probability of the corresponding quantum bit state is determined as the optimal solution of the TSP model.
15. The device according to any one of claims 10 to 14, characterized in that: The device also includes: A processing module is used for performing a normalization process on the parameter value ranges of the multiple parameters before the first model building module builds the TSP model based on the parameter value ranges of the multiple parameters and the objective function, wherein the normalization process The processing is used to unify the parameter value ranges of the plurality of parameters into a specified value range; The first model building module is used to build the TSP model based on the parameter value ranges of the multiple parameters after normalization and the objective function.
16. The device according to claim 15, characterized in that The parameter setting module is used to: Performing an inverse process of the normalization process on the parameter values in the parameter value combination corresponding to the optimal solution to obtain tuned parameter values of the multiple parameters; The various parameters of the database are set based on the tuned parameter values of the various parameters.
17. A computer device, characterized in that: The computer device includes a processor and a memory, wherein 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 9.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer instruction, and the computer instruction is loaded and executed by a processor to implement the parameter setting method according to any one of claims 1 to 9.
19. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; the computer instructions are read and executed by a processor of a computer device to implement the parameter setting method according to any one of claims 1 to 9.
20. A parameter setting system, characterized in that: The system comprises: Databases, classical computers, and quantum computers; The classical computer is used to obtain parameter value ranges of multiple parameters of a database and an objective function of the database; the objective function is used to measure the performance index 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, wherein the path in the TSP model is a combination of parameter values of the multiple parameters; the path length in the TSP model is the objective function; and a quantum algorithm model is constructed based on the TSP model; The quantum computer is used to solve the optimal solution of the TSP model based on the 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
Database performance adjustment method, device, equipment and system and storage medium
CN110019151A
Integer decomposition optimization method and system based on Grover quantum computing search algorithm
CN112182494A
MMC PI parameter optimization method based on ant colony simulated annealing algorithm
CN112528561A
Hybrid quantum algorithm-based combinatorial optimization solving method, system and solver architecture
CN113392580A
Quantum shortest path method based on QAOA
CN114723060A
Cited By
Database tuning method and device based on quantum computing, medium and equipment
CN120804062A
Database tuning method and apparatus based on quantum computing, medium, and device
CN120804062B