WO2021169322A1 - Execution plan processing method, device, and system - Google Patents

Execution plan processing method, device, and system Download PDF

Info

Publication number
WO2021169322A1
WO2021169322A1 PCT/CN2020/121193 CN2020121193W WO2021169322A1 WO 2021169322 A1 WO2021169322 A1 WO 2021169322A1 CN 2020121193 W CN2020121193 W CN 2020121193W WO 2021169322 A1 WO2021169322 A1 WO 2021169322A1
Authority
WO
WIPO (PCT)
Prior art keywords
execution plan
performance
execution
sql statement
database system
Prior art date
Application number
PCT/CN2020/121193
Other languages
French (fr)
Chinese (zh)
Inventor
赵俊
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021169322A1 publication Critical patent/WO2021169322A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Definitions

  • This application relates to the field of databases, and in particular to a processing method, equipment and system for executing plans.
  • the query engine can generate an execution plan for a SQL statement, and process data based on the execution plan within a period of time.
  • the execution plan also called SQL execution plan
  • SQL execution plan is used to indicate the actions to be executed, and the sequence of actions to be executed, etc.
  • each execution plan will be used continuously for a period of time (such as several weeks), if the execution plan itself has poor performance, it will affect the performance of the database during this period of time.
  • the embodiments of the present application provide a processing method, equipment, and system for executing a plan.
  • the technical solution is as follows:
  • a method for processing an execution plan is provided.
  • the method can be executed by a database system.
  • the method includes:
  • the second execution plan will be used to replace the first execution plan to avoid the use of the first execution plan of the performance degradation of the database, and reduce the performance degradation of the execution plan to the database. The impact of this to ensure the performance of the database.
  • the second execution plan is different from the first execution plan. Further optionally, the performance of the second execution plan is better than the performance of the first execution plan, which can effectively guarantee the performance of the database.
  • the first method of obtaining obtaining the historical execution plan of the SQL statement; when the performance of the historical execution plan is better than the performance of the first execution plan, the historical execution plan is used as the second execution plan.
  • the historical execution plan may be determined in other execution plans of the SQL statement (the other execution plan is an execution plan generated before the first execution plan) to determine whether the historical execution plan can be used as the second execution plan.
  • the historical execution plan may be the execution plan with the best performance among other execution plans of the SQL statement, the execution plan with the longest historical use time, or the execution plan that meets other set conditions.
  • the historical execution plan since the historical execution plan has been generated in advance, the historical execution plan with better performance than the first execution plan can be quickly acquired as the second execution plan, which can realize the rapid optimization of the execution plan and improve the optimization efficiency.
  • the second way to obtain generate the second execution plan of the SQL statement.
  • the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or the duration of the second execution plan for generating the SQL statement is greater than The duration of the first execution plan for generating the SQL statement.
  • the generation time and/or the occupied computing resources reduce the restriction on the process of generating the execution plan, it can be ensured that the performance of the finally determined second execution plan is better than the performance of the first execution plan.
  • the database system provided in the embodiment of the present application also supports an alarm function.
  • the processing method of the execution plan further includes: sending alarm indication information when the performance of the first execution plan of the SQL statement deteriorates.
  • the alarm indication information may include SQL statements, that is, SQL statements that produce performance degradation; the alarm indication information may also include tasks that indicate intervention in the execution plan. The user can know the SQL statement that currently has performance degradation based on the warning indication information, and determine whether to intervene in the execution plan.
  • the warning indication information is presented to the user through the user interface, and the user controls whether to optimize the execution plan, which can prevent the automatic execution plan optimization in the background from affecting the user's operation or affecting the user business being executed, and improve The flexibility in the time of execution of the planned intervention improves the user experience.
  • the process of obtaining the second execution plan of the SQL statement can be triggered in multiple ways. For example, after receiving the execution plan optimization instruction, the second execution plan of the SQL statement is obtained.
  • the execution plan optimization instruction may be triggered by the user through the application program, or may be triggered by a designated device.
  • the execution plan optimization instruction is used to instruct to intervene in the degraded execution plan.
  • the method further includes: when the performance of the new version of the execution plan is better than the performance of the second execution plan, executing the new version of the execution plan to replace the execution of the second execution plan.
  • the database system executes the new version of the execution plan to replace the execution of the second execution plan, so as to prevent the database from adopting a new version with degraded performance.
  • the execution plan reduces the impact of the performance-degraded execution plan on the database, thereby ensuring the performance of the database.
  • the performance of the new version of the execution plan is better than that of the second execution plan, the performance of the database can be effectively guaranteed, the database version is prevented from rolling back, and the duration of business interruption is reduced.
  • the running index is used to reflect the running effect of the corresponding execution plan, and can also reflect the performance of the corresponding SQL statement.
  • the performance of the first execution plan can be determined through the operation indicators of the first execution plan. Then, when the operation index of the first execution plan is abnormal, it is determined that the performance of the first execution plan of the SQL statement is degraded.
  • the operation indicators of the first execution plan include one or more of the following: IO indicators, delay (delay), error (error) information, execution times, and processing duration of the SQL statement.
  • the process for the database system to analyze whether the operating indicators of the first execution plan are abnormal may include: for each operating indicator in the operating indicators of the first execution plan, the operating indicator data group corresponding to the operating indicator and the corresponding history The operation index data group is compared to determine whether each operation index is abnormal; based on the abnormality determination result of each operation index, it is determined whether the operation index of the first execution plan (that is, the overall operation index of the first execution plan) is abnormal.
  • the achievable manner for determining whether the operating indicator is abnormal may include:
  • the first possible implementation manner is that for each operating indicator in the operating indicators of the first execution plan, when the performance indicated by the operating indicator data group corresponding to the operating indicator is lower than the historical operating indicator of the SQL statement corresponding to the operating indicator The performance indicated by the data group determines that the operation index is abnormal.
  • the database system compares the corresponding operation index data group with the corresponding historical operation index data group based on a specified comparison rule to detect whether the performance indicated by the operation index data group is lower than that indicated by the corresponding historical operation index data group. performance.
  • the database system maintains an expert experience database, which records at least one specified comparison rule determined based on expert experience. Based on the specified comparison rule, the database system performs the operation index data group corresponding to the operation index and the corresponding historical operation index Comparison of data sets.
  • the database system compares the performance curve of the operating indicator data set with the performance baseline of the operating indicator to detect whether the performance indicated by the operating indicator data set is lower than the performance indicated by the historical operating indicator data set.
  • the performance curve of the operating indicator data set corresponding to the operating indicator does not match the performance baseline of the operating indicator, it is determined that the performance indicated by the operating indicator data set corresponding to the operating indicator is lower than the performance indicated by the historical operating indicator data set.
  • the performance baseline of the operating indicator is determined based on the historical operating indicator data set.
  • the database system may also generate the performance baseline of the operating indicator based on the second artificial intelligence model and the historical operating indicator data set.
  • the performance baseline of the operating index is generated by the artificial intelligence model. On the basis of ensuring the accuracy of the performance baseline, the efficiency of obtaining the performance baseline can also be improved.
  • the database system uses the AI model to identify whether the first operating indicator is abnormal.
  • the process is as follows:
  • the operating indicator data set corresponding to the operating indicator is input into the first artificial intelligence model, and when the first artificial intelligence model outputs indication information indicating that the operating indicator is abnormal, It is determined that the operation index is abnormal.
  • the method provided by the first achievable method is executed first to perform a rough screening of abnormal operating index data sets. There may be certain errors in the rough screening process. Determine the non-abnormal operation index data group as the abnormal operation index data group; then perform the method provided by the second achievable method for the operation index data group whose rough screening result is abnormal to perform the abnormal operation index data group Of fine screening.
  • the operation index data group is input into the first artificial intelligence model, when the first artificial intelligence model outputs indication information indicating that the operation index data group is abnormal, it is determined that the operation index data group of the first execution plan is abnormal (that is, the operation is determined by fine screening. Index data group abnormality), compared to the second achievable manner described above, the accuracy of determining the abnormality of the operating index data group can be improved.
  • the performance indicated by the running index data set is not lower than the performance indicated by the historical running index data set of the SQL statement (that is, the running index data set is determined to be normal through coarse screening)
  • the running index data set is determined to be normal through coarse screening
  • the computational cost of the first artificial intelligence model can be reduced.
  • the database system may determine whether the operation index of the first execution plan is abnormal based on the abnormality determination result of each operation index.
  • the database system may determine whether the operation index of the first execution plan is abnormal.
  • the operation index of the first execution plan when at least one operation index of the first execution plan is abnormal, it is determined that the operation index of the first execution plan is abnormal; when all the operation indexes of the first execution plan are not abnormal, it is determined that the first execution plan is not abnormal. There is no abnormality in the operational indicators of the execution plan.
  • the operation index score of the first execution plan is determined.
  • the operation index score is greater than the specified score threshold, it is determined that the operation index of the first execution plan is abnormal ;
  • the running index score is not greater than the specified score threshold, it is determined that the running index of the first execution plan is not abnormal. That is, the higher the running index score, the higher the probability of abnormality.
  • the processing method of the execution plan further includes: converting the second execution plan into a second execution plan matching the management node. To ensure that the management node can quickly analyze the transformed second execution plan, thereby reducing the analysis delay generated by the management node, and improving the efficiency of loading and using the second execution plan by the management node.
  • the process of transforming the second execution plan into a second execution plan matching the management node includes:
  • the second execution plan carries a description prompt label, and the description prompt label is used to identify the corresponding execution plan as an intervention plan. This can facilitate the database system to distinguish which execution plans are intervened execution plans.
  • the process of generating the second execution plan of the SQL statement may include: generating multiple candidate execution plans based on the optimization rule information and/or optimization cost information of the database where the management node is located; traversing the multiple candidate executions Plan to get the second execution plan.
  • the processing method of the execution plan may further include: receiving a rule setting instruction, where the rule setting instruction includes a set rule.
  • the rules in the database system may include at least one of the following: SQL performance comparison rules, description prompt label setting rules, alarm rules, and routing rules.
  • a method for processing an execution plan is provided.
  • the method can be executed by a database system.
  • the method includes:
  • Execute the first execution plan of the structured query language SQL statement obtain the second execution plan of the new version of the SQL statement; execute the second execution when the performance of the second execution plan is better than that of the first execution plan Plan to replace the execution of the first execution plan.
  • the database system executes the second execution plan to replace the execution of the first execution plan, so as to prevent the database from adopting new performance degradation
  • the version of the execution plan reduces the impact of the degraded execution plan on the database, thereby ensuring the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
  • the method further includes: The execution plan is transformed into a second execution plan that matches the management node. To ensure that the management node can quickly analyze the transformed second execution plan, thereby reducing the analysis delay generated by the management node, and improving the efficiency of loading and using the second execution plan by the management node.
  • the process of converting the second execution plan into a second execution plan matching the management node includes: querying the correspondence between the specified management node and the execution plan format to obtain the execution plan format corresponding to the management node; The second execution plan is converted into a second execution plan conforming to the execution plan format.
  • obtaining the second execution plan of the new version of the SQL statement includes: generating the second execution plan of the SQL statement, and the process of generating the second execution plan of the SQL statement may include: optimization based on the database where the management node is located Rule information and/or optimization cost information to generate multiple candidate execution plans; traverse the multiple candidate execution plans to obtain the second execution plan.
  • the present application provides a database system
  • the database system may include at least one module
  • the at least one module may be used to implement the execution plan processing method provided in the first aspect or various possible implementations of the first aspect.
  • the present application provides a database system, which may include at least one module, and the at least one module may be used to implement the execution plan processing method provided by the foregoing first aspect or various possible implementations of the first aspect.
  • this application provides a computer device including a processor and a memory.
  • the memory stores computer instructions; the processor executes the computer instructions stored in the memory, so that the computer device executes the methods provided by the foregoing first aspect or various possible implementations of the first aspect, so that the computer device deploys the foregoing third aspect or the first aspect.
  • Various possible implementations of the three aspects provide the database system.
  • this application provides a computer device including a processor and a memory.
  • the memory stores computer instructions; the processor executes the computer instructions stored in the memory, so that the computer device executes the foregoing second aspect or the methods provided by various possible implementations of the second aspect, so that the computer device deploys the foregoing fourth aspect or the first aspect.
  • the present application provides a computer-readable storage medium having computer instructions stored in the computer-readable storage medium, and the computer instructions instruct the computer device to execute the foregoing first aspect or various possible implementations of the first aspect.
  • the method or the computer instruction instructs the computer device to deploy the database system provided by the foregoing third aspect or various possible implementations of the third aspect.
  • the present application provides a computer-readable storage medium having computer instructions stored in the computer-readable storage medium, and the computer instructions instruct the computer device to execute the above-mentioned second aspect or various possible implementations of the second aspect.
  • the method or the computer instruction instructs the computer device to deploy the database system provided by the foregoing fourth aspect or various possible implementations of the fourth aspect.
  • this application provides a computer program product.
  • 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 can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned first aspect or the methods provided by various possible implementations of the first aspect, so that the computer
  • the device deploys the database system provided by the third aspect or various possible implementations of the third aspect.
  • the present application provides a computer program product.
  • 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 can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned second aspect or the methods provided by various possible implementations of the second aspect, so that the computer
  • the equipment deploys the database system provided by the foregoing fourth aspect or various possible implementations of the fourth aspect.
  • a chip in an eleventh aspect, is provided, the chip may include a programmable logic circuit and/or program instructions, and when the chip is running, it is used to implement the processing method of any execution plan as in the first aspect. Or, when the chip is running, it is used to implement the processing method of any one of the execution plans as in the second aspect.
  • the embodiment of the application After analyzing the performance degradation of the first execution plan, the embodiment of the application will replace the first execution plan with the second execution plan to avoid the use of the degraded first execution plan for the database and reduce the impact of the degraded execution plan on the database , So as to ensure the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, thereby effectively ensuring the performance of the database.
  • the database system executes the second execution plan to replace the execution of the first execution plan, so as to prevent the database from adopting new performance degradation
  • the version of the execution plan reduces the impact of the degraded execution plan on the database, thereby ensuring the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
  • FIG. 1 is a schematic diagram of an application environment of a database system involved in a method for processing an execution plan provided by an embodiment of the present application;
  • FIG. 2 is a schematic flowchart of a method for processing an execution plan provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of data flow in an exemplary database system provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a performance baseline of a first operating index provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a comparison scenario between a performance curve of a first operating indicator data set and a performance baseline of the first operating indicator according to an embodiment of the present application;
  • FIG. 6 is a schematic diagram of a comparison scenario between the numerical points of the first operating index data set and the performance baseline of the first operating index provided by an embodiment of the present application;
  • FIG. 7 is a schematic diagram of a schematic user interface provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a database system provided by an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of a method for processing an execution plan provided by an embodiment of the present application.
  • FIG. 10 is a block diagram of a database system provided by an embodiment of the present application.
  • FIG. 11 is a block diagram of another database system provided by an embodiment of the present application.
  • FIG. 12 is a block diagram of another database system provided by an embodiment of the present application.
  • FIG. 13 is a block diagram of still another database system provided by an embodiment of the present application.
  • FIG. 14 is a block diagram of a database system provided by another embodiment of the present application.
  • Fig. 15 is a block diagram of a computer device provided by an embodiment of the present application.
  • FIG. 1 is a schematic diagram of an application environment of a database system (DBS) 10 involved in a method for processing an execution plan provided by an embodiment of the present application.
  • the database system 10 may be a server or a server cluster composed of multiple servers.
  • the database system includes a database management system (Database Management System, DBMS) and at least one database (Database, DB) (not shown in FIG. 1).
  • DBMS database Management System
  • database database, DBMS
  • database database management system
  • DB database management system
  • database Database, DB
  • the application program can transparently operate the database through the database management system, and the data in the database is managed by the database management system.
  • the aforementioned database may be a relational database, which refers to a database that uses a relational model to organize data. It stores data in the form of rows and columns.
  • Each relational model can be called a relational table.
  • relational databases can be divided into distributed relational databases and non-distributed relational databases.
  • the database system 10 includes: a management node (also called a query engine, a SQL engine, a database engine or a coordinator) 101, a plurality of data nodes 102, and an optimization node 103.
  • the database system 10 may include one or more management nodes 101, each management node 101 belongs to a database, and the management node 101 is used to manage the data nodes 102 in the corresponding database.
  • the management node 101 may be a single node, or a designated data node among multiple data nodes 102 or a data node obtained by election, and it may be a server or a server cluster composed of multiple servers.
  • the management node 101 is configured to generate an execution plan of the SQL statement after receiving the SQL statement sent by the application program, so as to control the data node managed by the management node 101 to execute the execution plan.
  • the execution plan is used to indicate the actions to be executed and the sequence of actions to be executed. In other words, when to do something and so on.
  • the optimization node 103 is used to intervene in the execution plan of the management node 101 (also called optimization).
  • each data node may be a server or a server cluster composed of multiple servers; in another implementation, each data node represents a set minimum processing unit of the database system.
  • each data node may be a virtual machine or a container, an application instance or a database execution process that manages and/or stores data.
  • the optimization node 103 can be integrated on the management node 101.
  • each management node 101 in the database system can be integrated with an optimization node 103, or the designated management node 101 in the database system can be integrated An optimized node 103.
  • the optimization node 103 can also be independently set outside the management node 101.
  • the management node 101 provides an interface for the optimization node 103 to intervene in the execution plan of the management node 101.
  • the optimization node 103 is independently arranged outside the management node 101, the impact on the performance of the management node 101 can be reduced.
  • Fig. 2 is a schematic flowchart of a method for processing an execution plan provided by an embodiment of the present application. This method can be executed by the aforementioned database system 10. Subsequent embodiments take the execution plan intervention of a management node as an example for description. It is assumed that the management node is the first management node, the database corresponding to the first management node is the first database, and the execution plan intervention is performed on other management nodes. The process can refer to the process of performing execution plan intervention on the first management node. As shown in Figure 2, the processing method (ie intervention process) of the execution plan includes:
  • Step 201 The database system executes the first execution plan of the SQL statement.
  • the first management node When users need to perform data operations (such as data query operations) on the first database, they can input SQL statements to the first management node through the application. After receiving the SQL statements, the first management node will follow the optimization rules of the first database (rule based on optimizer, RBO) information and/or cost based on optimizer (CBO) information to generate an execution plan, and continue to use the execution plan for a period of time after the execution plan is generated.
  • RBO resource based on optimizer
  • CBO cost based on optimizer
  • the optimization rule information may include table partition information and/or reliability indicators (available indicators).
  • the relational table is divided into multiple subsets called partitions, and each subset is a partition table.
  • each subset is a partition table.
  • the partitioning rules of the partition table may include: partitioning according to storage date and/or partitioning according to location, etc.
  • the partition table obtained by dividing the data in the relational table according to the location includes: a partition table corresponding to Shanghai and a partition table corresponding to Beijing.
  • the reliability index is an index used to reflect the reliability of the database.
  • the database When the data in the database exceeds the range specified by the reliability index, the database will become unstable, that is, the database is no longer reliable.
  • the reliability index may include: allowable interruption duration and/or input/output (input/output, IO) upper limit.
  • IO input/output
  • the database may have services that can be noticed by the user. Interruption, loss of the database system.
  • the optimization cost information may include statistical information of the database.
  • the statistical information is used to reflect the data distribution of the relational table of the corresponding database. For example, the distribution ratio of different types of data in the table, or the data nodes where different types of data are stored (or mainly stored), etc.
  • the relational table of the first database records data indexed as "male” and "female”
  • the statistical information of the first database may include the proportion of data indexed as "male” and "female” in all data and the main Which data nodes are stored in.
  • which data nodes are mainly stored in refers to which data nodes are stored in which data greater than a specified threshold is stored.
  • the SQL statement in step 201 is an SQL statement input to the first management node
  • the first execution plan is an execution plan generated by the first management node based on the SQL statement.
  • the first execution plan for the database system to execute the SQL statement refers to that the first management node controls the data node it manages to execute the first execution plan.
  • the database system After the database system generates and executes the first execution plan, it records the first execution plan so that the first database can continue to use the first execution plan in a subsequent period of time.
  • FIG. 3 is a schematic diagram of data flow in a schematic database system provided by an embodiment of the present application. It is assumed that the optimization node 103 is set independently of the first management node 101a. After generating the first execution plan, the first management node 101a controls the managed data node to execute the first execution plan (that is, use the first execution plan), and the executed first execution plan is stored in the system table 1042, The execution plan stored in the system table 1042 can be synchronized to the index database 1041, and the optimization node 103 can obtain the first execution plan from the index database 1041, and detect whether the performance of the first execution plan is degraded.
  • the optimization node 103 is set independently of the first management node 101a.
  • the first management node 101a controls the managed data node to execute the first execution plan (that is, use the first execution plan), and the executed first execution plan is stored in the system table 1042,
  • the execution plan stored in the system table 1042 can be synchronized to the index database 1041, and the optimization node 103
  • the system table is used to record the execution plan currently used (or called the current time period) in the database system.
  • the currently used execution plan refers to that the execution plan continues to be used after being executed for the first time (that is, it is not replaced).
  • multiple databases may respectively set system tables corresponding to each other; in another optional implementation manner, multiple databases may share system tables.
  • the corresponding system table records the execution plan currently used by the first database. Since there may be multiple SQL statements recently acquired by the first management node, the number of currently used execution plans corresponding to each SQL statement is one.
  • the system table records a one-to-one corresponding multiple execution plans of multiple SQL statements of the first management node, and the multiple execution plans include the first execution plan.
  • the first management node needs to reuse the previously executed execution plan next time (that is, the execution plan is inherited)
  • the first management node queries the system table to obtain the required execution plan.
  • the execution plan stored in the system table 1042 can be periodically synchronized to the indicator database 1041; or, when the execution plan stored in the system table 1042 is updated, the execution plan stored in the system table 1042 is synchronized (ie, full synchronization) To the index database 1041; or, when there is an update to the execution plan stored in the system table 1042, the updated execution plan in the system table 1042 is synchronized (that is, incremental synchronization) to the index database 1041.
  • the corresponding indicator database records the execution plan for each synchronization of the system table of the first management node.
  • the indicator database includes at least the historical execution plan of the first management node, and may also include the execution plan currently used by the first database, and the historical execution plan is an execution plan whose use period is before the use period of the currently used execution plan.
  • the corresponding historical execution plan is other execution plans of the SQL statement that existed before the first execution plan was generated.
  • the indicator database includes the execution plan currently used by the first database is affected by the frequency with which the first database table synchronizes the execution plan with the indicator database.
  • the indicator database records all executed execution plans (including historical execution plans and currently used execution plans) of the first management node. Assume that the indicator database records all execution plans that have been executed by the first management node. Since there may be multiple SQL statements recently acquired by the first management node, the number of all executed execution plans corresponding to each SQL statement is at least one. Therefore, the index database records multiple execution plan groups corresponding to multiple SQL statements of the first management node, and each execution plan group includes at least one execution plan of the corresponding SQL statement.
  • the optimization node may obtain the first execution plan of the SQL statement from the index database 1041.
  • the latest execution plan is acquired as the first execution plan.
  • the latest execution plan is the execution plan with the synchronization time closest to the current time.
  • the optimization node may obtain the first execution plan of the SQL statement from the system table 1042.
  • the execution plan corresponding to the SQL statement of the first management node recorded in the system table 1042 is taken as the first execution plan.
  • FIG. 3 schematically takes the system table stored in a database as an example for description, and the storage method of the system table may also have other methods, which are not limited in the embodiment of the present application.
  • the plans generated in the database system but not executed can also be recorded in the index database 1041, so that the execution plan in the database system can be monitored, and the performance of the database system can be easily analyzed.
  • Step 202 The database system analyzes whether the performance of the first execution plan of the SQL statement has deteriorated.
  • the database system (such as an optimization node) can determine whether to intervene in the first execution plan by analyzing whether the performance of the first execution plan of the SQL statement has deteriorated, so as to restore the performance of the SQL statement.
  • the process of analyzing whether the performance of the first execution plan of the SQL statement has deteriorated includes:
  • Step A1 The database system analyzes whether the operation index of the first execution plan is abnormal. Perform step A2 or step A3.
  • the running index is used to reflect the running effect of the corresponding execution plan, and can also reflect the performance of the corresponding SQL statement.
  • the performance of the first execution plan can be determined through the operation indicators of the first execution plan.
  • the operation indicators of the first execution plan include one or more of the following: IO indicators, delay (delay), error (error) information, execution times, and processing duration of the SQL statement.
  • the IO indicator refers to; the number of IOs generated when the execution plan is executed; the delay refers to the delay caused by the execution of the execution plan; the error message refers to the content of the error caused by the execution of the execution plan, And/or, the percentage of different types of errors caused by the execution of the execution plan in the overall errors generated, that is, the ratio of the number of each type of error to the number of overall errors; the number of executions refers to the execution The number of times the plan is executed; the processing time can be the time that the execution plan occupies the processor when the execution plan is executed, such as the processing time of the central processing unit (CPU). The processing time of the CPU is called the CPU time (CPU time). ).
  • the database system can periodically analyze whether the operating indicators are abnormal.
  • the analysis period ranges from 1 minute to 10 minutes.
  • a database system (such as an optimized node) can deploy an agent module on the host (also known as the database host) where each database in the database system is located, and each agent module is used to monitor the corresponding running indicators on the deployed database host The data.
  • each agent module may collect data corresponding to the operating indicators on the deployed database host, and periodically send the collected data to a node of the management agent module, such as an optimization node.
  • the range of the sending period of the data corresponding to the aforementioned operating indicators is 5 seconds to 10 minutes.
  • each operating indicator corresponds to an operating indicator data group.
  • the operating indicator data group usually includes multiple data of corresponding operating indicators.
  • the multiple data are usually data collected within a specified period of time. For example, the specified duration is one day; the multiple data may also be data collected at specified sampling intervals. For example, the specified sampling interval is 1 second.
  • each operating indicator also corresponds to a historical operating indicator data group.
  • the collection time corresponding to the historical operating indicator data group (that is, the collection time corresponding to the data in the collected data group) and the collection of the operating indicator data group
  • the duration is the same, and the acquisition period of the historical operation indicator data group is before the acquisition period of the operation execution data group.
  • the data collection time of both is 1 day.
  • the number of data in the historical operating indicator data group is the same as the number of data in the operating indicator data group.
  • the number of data in the historical operating indicator data group and the number of data in the operating indicator data group are both 10,000; optionally, the data in the historical operating indicator data group and the data in the operating indicator data group There is a one-to-one correspondence between the acquisition moments of the data.
  • the data in the historical operating indicator data group and the data in the operating indicator data group are both acquired at the same sampling interval within one day.
  • the data in the historical operating indicator data group is sampled at 9:00 Corresponding to the data sampled at 9:00 in the operating indicator data group, the data sampled at 9:01 in the historical operating indicator data group corresponds to the data sampled at 9:01 in the operating indicator data group.
  • the process of analyzing whether the operation index of the first execution plan is abnormal by the database system may include:
  • Step A11 For each operating indicator in the operating indicators of the first execution plan, compare the operating indicator data group corresponding to the operating indicator with the corresponding historical operating indicator data group to determine whether each operating indicator is abnormal.
  • Step A12 Based on the abnormality determination result of each operation index, determine whether the operation index of the first execution plan (that is, the overall operation index of the first execution plan) is abnormal.
  • the first operating indicator is one of the operating indicators of the first execution plan
  • the operating indicator data set corresponding to the first operating indicator is the first operating indicator data set
  • the first operating indicator is the first operating indicator.
  • the historical operating indicator data group corresponding to the operating indicator is the first historical operating indicator data group
  • the process of determining whether the first operating indicator is abnormal may include the following two implementation methods:
  • the database system determines that the first operating indicator is abnormal; when the first operating indicator data set indicates The performance is not lower than the performance indicated by the first historical operation index data group, and the database system determines that the first operation index is not abnormal (that is, normal).
  • the database system compares the first operating index data set with the first historical operating indicator data set based on a specified comparison rule to detect whether the performance indicated by the first operating indicator data set is lower than the first historical operating indicator data set Indicated performance.
  • the database system maintains an expert experience database.
  • the expert experience database records at least one specified comparison rule determined based on expert experience. Based on the specified comparison rule, the database system performs the first operation index data set and the first historical operation index data Group comparison.
  • the at least one specified comparison rule includes a year-on-year comparison rule and/or a chain comparison rule, where the chain comparison rule means obtaining a chain change between the historical operation index data group and the operation index data group.
  • the comparison rule can be based on the chain decrease
  • the rate formula obtains the month-on-month decline rate.
  • the formula for the month-on-month decline rate includes:
  • Momentum drop rate (operation index data group-historical operation index data group)/historical operation index data group ⁇ 100%.
  • the year-on-year comparison rule means obtaining the year-on-year changes between the historical operation index data group and the operation index data group. Using this comparison rule, the year-on-year decline rate can be obtained based on the year-on-year decline rate formula.
  • the year-on-year decline rate formula includes:
  • Year-on-year decline rate (operation index data group-historical operation index data group)/
  • the performance indicated by the first operating indicator data set is lower than the performance indicated by the first historical operating indicator data set.
  • the database system compares the performance curve of the first operating indicator data set with the performance baseline of the first operating indicator to detect whether the performance indicated by the first operating indicator data set is lower than the first historical operating indicator data set Indicated performance.
  • the process is as follows:
  • Step A111 The database system determines a performance baseline of the first operating index.
  • the performance baseline of the first operating indicator is a baseline established based on the data in the historical operating indicator data group and used to reflect the performance of the SQL statement with respect to the first operating indicator.
  • the database system may generate a performance baseline of the first operating indicator of the SQL statement based on the second artificial intelligence model and the first historical operating indicator data set.
  • the database system may obtain the candidate operating index data set of the first operating indicator of the SQL statement, and the number of data included in the candidate operating indicator data set is greater than or equal to the first historical operating indicator data The number of data in the group; the database system then determines the historical operation index data group based on the obtained candidate operation index data group of the first operation index; finally, the database system inputs the first historical operation index data group into the second artificial intelligence model , The second artificial intelligence model generates the performance baseline of the first operating indicator of the SQL statement.
  • the database system may determine the first historical operation index data group in the following ways based on the obtained candidate operation index data group of the first operation index:
  • the first type is to filter the target collection time data in the candidate operation index data group to obtain the first historical operation index data group.
  • the target collection time data can be randomly selected in the candidate operating index data group, or it can be the data with the best corresponding performance filtered from the candidate operating indicator data group through a sliding window.
  • the width of the sliding window can be The acquisition duration corresponds to the width of the target.
  • the candidate operating index data group includes M sub-data groups of target collection time length, and the average data of the M sub-data groups is determined as the first historical operating indicator data group, that is, the first historical operating indicator data group
  • Each data in is the mean value of corresponding data in M sub-data groups.
  • the candidate operating index data group includes 4 days of data, and the target collection time is 1 day, then the data of a sub-data group is one day of data, and the average data of the 4 days of data is used as the first historical operating index data Group.
  • the first historical operation index data group may also have other determination methods, for example, determination based on expert experience.
  • the embodiment of the present application merely illustrates this schematically and does not limit it.
  • the database system can obtain the candidate operating indicator data group of the first operating indicator of the SQL statement, and the number of data included in the candidate operating indicator data group is greater than or equal to that in the historical operating indicator data group.
  • the amount of data the database system inputs the acquired candidate operating indicator data set of the first operating indicator into the second artificial intelligence model, and the second artificial intelligence model generates the performance baseline of the first operating indicator of the SQL statement.
  • the second artificial intelligence model first obtains the first historical operating indicator data set of the SQL statement, and then generates a performance baseline of the operating indicator.
  • each operating indicator in the operating indicators of the first execution plan corresponds to a second artificial intelligence model.
  • the corresponding second artificial intelligence model can be composed of multiple historical operating indicator data sets of the first operating indicator. Obtained as a training sample.
  • the number of data in each historical operating index data group used for training is the same as the number of data in the historical operating indicator data group;
  • the quantity of data in each historical operation index data group used for training is the same as the quantity of data in the candidate historical operation index data group.
  • first historical operation indicator data group of the aforementioned SQL statement may be updated periodically or after receiving an update instruction, and the performance baseline of the first performance indicator is also updated accordingly. In this way, it can be ensured that the first historical operation index data group can better reflect the historical performance of the first performance index of the SQL statement.
  • the performance baseline of the operating index is generated by the artificial intelligence model. On the basis of ensuring the accuracy of the performance baseline, the efficiency of obtaining the performance baseline can also be improved.
  • the database system may also obtain the performance baseline of the first operating index in other ways, for example, generating the performance baseline through a statistical model, or obtaining the performance baseline through manual drawing.
  • FIG. 4 is a schematic diagram of a performance baseline of a first operating index provided by an embodiment of the present application.
  • the performance baseline can be located in a two-dimensional coordinate system.
  • the performance baseline includes a high-level line, a low-level line, and a median line.
  • the horizontal axis represents the collection time
  • the vertical axis represents the numerical value of the operating index.
  • the high line is a straight line determined based on the maximum value in the first historical operating index data set, which is usually a straight line parallel to the horizontal axis passing through the maximum; the low line is based on the minimum value in the first historical operating indicator data set.
  • a straight line determined by the value which is usually a straight line parallel to the horizontal axis passing through the minimum;
  • the median line is a straight line between the high line and the bottom line determined based on the data in the first historical operating index data set, the median The line is usually a straight line parallel to the horizontal axis passing through the median value, and the median value is the average value of the data in the first historical operating indicator data group.
  • Step A112 The database system determines the performance curve of the first operating index data group. Perform step A113 or step A114.
  • the first operating index data group may form a performance curve in the coordinate system where the performance baseline of the first operating index is located.
  • the database system can directly calibrate the performance curve of the first operating index data set in the coordinate system. For example, the value points corresponding to every two adjacent data in the first operating index data group are connected by a line segment to obtain the performance curve.
  • Step A113 When the performance curve of the first operating index data set does not match the performance baseline of the first operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is lower than the first historical operating indicator of the SQL statement The performance indicated by the data group.
  • the database system compares the performance curve of the first operating index data set with the performance baseline of the first operating index. When the performance curve of the first operating index data set does not match the performance baseline of the first operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is lower than the first historical operating indicator data set of the SQL statement. Performance.
  • the condition for matching the performance curve of the first operating index data group with the corresponding performance baseline is preset, and there may be multiple setting methods.
  • the matching condition refers to: the deviation of the numerical point on the performance curve from the performance baseline is within a specified range. That is, the deviation of the numerical point from the performance baseline is within the specified range, and the performance curve of the first operating index data set matches the corresponding performance baseline; when the deviation of the numerical point from the performance baseline is not within the specified range, the first run The performance curve of the indicator data set does not match the corresponding performance baseline.
  • the deviation of the numerical point on the curve from the performance baseline may be reflected by the distance between the numerical point and the performance baseline.
  • the performance baseline includes a high line, a low line, and a median line
  • the deviation of a value point on the curve from the performance baseline may be reflected by the distance between the value point and at least one of the high line, the low line, and the median line.
  • the distance from the numerical point to the median line is greater than the first specified distance threshold; or, when the distance from the numerical point to the median line is greater than the first specified distance threshold, and the distance from the numerical point to the high line is greater than the first specified distance threshold. 2.
  • a designated distance threshold or, when the distance from the numerical point to the median line is greater than the first designated distance threshold, and the distance from the numerical point to the low line is greater than the third designated distance threshold, it is determined that the numerical point deviates from the performance baseline.
  • FIG. 5 is a schematic diagram of a comparison scenario between the performance curve of the first operating indicator data set and the performance baseline of the first operating indicator provided by an embodiment of the present application. By comparing whether the performance curve matches the performance baseline, it can be determined whether the performance indicated by the first operation index data group is lower than the performance indicated by the first historical operation index data group of the SQL statement.
  • Step A114 When the performance curve of the first operating index data set matches the performance baseline of the first operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is not lower than the first historical operating indicator of the SQL statement The performance indicated by the data group.
  • the database system can also directly calibrate the numerical points (usually a set of discrete numerical points) corresponding to the first operational index data group in the coordinate system where the performance baseline is located based on the first operational index data group. There is no need to determine the performance curve corresponding to the first operating index data set. Then the foregoing step A112 can be deleted, and step A113 is replaced with when the value point of the first operating index data set does not match the performance baseline of the operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is lower than that of the SQL statement The performance indicated by the first historical operating indicator data set. Step A114 is replaced by the database system determining that the performance indicated by the first running index data group is not lower than the first historical running index data group indication of the SQL sentence when the numerical points of the running index data group match the performance baseline of the running index of the SQL statement Performance.
  • the database system can also directly calibrate the numerical points (usually a set of discrete numerical points) corresponding to the first operational index data group in the coordinate system where the
  • the condition for matching the numerical points of the first operating index data group with the corresponding performance baseline is preset, and there may be multiple setting methods.
  • the matching condition refers to: the first type: the number of numerical points deviating from the performance baseline in the first operating index data group is less than the specified number threshold, or the second type: the first operating index The proportion of the numerical points that deviate from the performance baseline in the numerical points of the data set to the total number of numerical points is less than the specified ratio threshold.
  • the degree of deviation of the numerical point from the performance baseline may be reflected by the distance between the numerical point and the performance baseline.
  • the performance baseline includes a high line, a low line, and a median line
  • the degree of deviation of the value point from the performance baseline may be reflected by the distance between the value point and at least one of the high line, the low line, and the median line.
  • the relevant explanation can refer to the explanation of the degree of deviation from the performance baseline of the numerical point on the aforementioned curve.
  • FIG. 6 is a schematic diagram of a comparison scenario between the numerical points of the first operating indicator data set and the performance baseline of the first operating indicator provided by an embodiment of the present application.
  • the performance baseline By comparing whether the corresponding multiple discrete numerical points of the first operating indicator data set match the performance baseline, it can be determined whether the performance indicated by the first operating indicator data set is lower than the performance indicated by the first historical operating indicator data set. For example, suppose the matching condition is the aforementioned first matching condition, and the number of value points that deviate from the performance baseline among the 6 value points is 4.
  • the specified number threshold is 3
  • the value points of the first operating index data group deviate from The number of numerical points of the performance baseline is greater than the specified number threshold, then the corresponding 6 discrete numerical points of the first operating index data group do not match the performance baseline, and accordingly, it is determined that the performance indicated by the first operating index data group is lower than The performance indicated by the first historical operating index data set.
  • the database system uses the AI model to identify whether the first operating indicator is abnormal.
  • the process is as follows:
  • the database system inputs the first operation index data group into the first artificial intelligence model, and when the first artificial intelligence model outputs indication information indicating that the first operation index data group is abnormal, it is determined that the first operation index is abnormal.
  • the content in the first operating index data group can refer to the introduction in the previous first implementable manner.
  • the structure of the indication information can be multiple.
  • each time an operating index data set is input to the first artificial intelligence model the indication information may include an indication label (or a classification label).
  • the instruction information may include The operating indicator data group of the indicator label, that is, the output operating indicator data group is the same as the input operating indicator data group, but each operating indicator data group carries an indicator label; in another optional method, each time When at least one operating index data group is input to the first artificial intelligence model, the indication information may include an abnormal operating index data group, that is, only an abnormal operating index data group that is output, and no normal operating index data group is output.
  • each operating indicator in the operating indicators of an execution plan corresponds to a first artificial intelligence model.
  • the corresponding first artificial intelligence model can be run by multiple historical operations corresponding to the operating indicator.
  • the index data set is trained as a training sample.
  • the foregoing two implementation methods can be combined according to actual conditions. For example, when there are multiple operation index data groups obtained, for example, operation index data groups corresponding to multiple SQL statements are obtained, or one operation of a SQL statement is obtained.
  • the method provided in the first achievable mode can be executed first to perform a rough screening of abnormal operating indicator data sets. There are certain errors in the rough screening process, and non-abnormal results may occur.
  • the operation index data group is determined to be an abnormal operation index data group; then the operation index data group obtained by rough screening (for example, the rough screening result is abnormal) is executed by the method provided by the second achievable way to perform abnormal operation Fine screening of indicator data sets.
  • the index data will be run Group input first artificial intelligence model, when the first artificial intelligence model outputs indication information indicating that the operation index data group is abnormal, it is determined that the operation index data group of the first execution plan is abnormal, which can improve Determine the accuracy of the abnormality of the operating index data set.
  • the performance indicated by the running index data set is not lower than the performance indicated by the historical running index data set of the SQL statement, there is no need to input the running index data set into the first artificial intelligence model.
  • the first method can be reduced. The computational cost of an artificial intelligence model.
  • the combination of the first achievable method and the second achievable method can improve the screening accuracy compared to the method provided by the first achievable method, and the screening accuracy can be improved compared to the method provided by the second achievable method only. Method, can improve the efficiency of screening.
  • the process of determining whether other operating indicators in the operating indicators of the first execution plan are abnormal refers to the process of determining whether the first operating indicator is abnormal. This is not repeated in the embodiment of the application.
  • the database system may determine whether the operation index of the first execution plan is abnormal based on the abnormality determination result of each operation index.
  • the operation index of the first execution plan is abnormal.
  • the operation index of the first execution plan when at least one operation index of the first execution plan is abnormal, it is determined that the operation index of the first execution plan is abnormal; when all the operation indexes of the first execution plan are not abnormal, it is determined that the first execution plan is not abnormal. There is no abnormality in the operational indicators of the execution plan.
  • the operation index score of the first execution plan is determined.
  • the operation index score is greater than the specified score threshold, it is determined that the operation index of the first execution plan is abnormal ;
  • the running index score is not greater than the specified score threshold, it is determined that the running index of the first execution plan is not abnormal. That is, the higher the running index score, the higher the probability of abnormality.
  • the operating index score S satisfies the score calculation formula:
  • Xi represents the abnormal level of the operating indicator data group corresponding to the i-th operating indicator, 1 ⁇ i ⁇ N, N is the total number of operating indicators, Pi is the weight of the i-th operating indicator, Pi is run by the i-th operating indicator The importance (or priority) of the indicator is determined.
  • the abnormality level of each operation index is determined based on the abnormality determination result of each operation index.
  • the abnormality level reflects the degree of abnormality of the data in the operation index data group corresponding to the operation index. Generally, the more abnormal data, the The higher the anomaly level.
  • S represents the weighted sum of the abnormality levels of the operation index data group corresponding to the N operation indexes.
  • the aforementioned second optional method is to define the operation index score in a way that the operation index score is positively correlated with the probability of occurrence of an abnormality.
  • Index score that is, the higher the running index score, the lower the probability of abnormality, and the score calculation formula is adjusted accordingly.
  • the updated running index score S' is 1/S
  • S is the aforementioned running index score. This is not repeated in the embodiment of the application.
  • Step A2 When the operation index of the first execution plan is abnormal, it is determined that the performance of the first execution plan of the SQL statement is degraded.
  • Step A3 When the operation index of the first execution plan is not abnormal, it is determined that the performance of the first execution plan of the SQL statement has not deteriorated.
  • Step 203 After analyzing the performance degradation of the first execution plan of the SQL statement, the database system obtains the second execution plan of the SQL statement.
  • the performance of the second execution plan is different from the performance of the first execution plan. Further optionally, the performance of the second execution plan is better than the performance of the first execution plan.
  • the first acquisition method the database system acquires the historical execution plan of the SQL statement; when the performance of the historical execution plan is better than that of the first execution plan, the historical execution plan is determined as the second execution plan.
  • the database system (such as the optimization node or the first management node) may have generated other execution plans of the SQL statement before the first execution plan (that is, the other execution plan is the execution plan generated before the first execution plan), Since the first execution plan is the currently used execution plan, it can be known that this other execution plan has become a historical execution plan.
  • the database system can determine the historical execution plan in the other execution plans of the SQL statement to determine whether the historical execution plan can be used as the first execution plan. 2.
  • the historical execution plan may be the execution plan with the best performance among other execution plans of the SQL statement, the execution plan with the longest historical use time, or the execution plan that meets other set conditions.
  • the database system can compare the performance of the historical execution plan with the performance of the first execution plan to determine the pros and cons of the two. There may be many ways to compare the performance of the historical execution plan with the performance of the first execution plan. Assuming that the running index score is positively correlated with the probability of abnormality, the database system can determine the running index score of the first execution plan, and obtain the running index score of the historical execution plan.
  • the database system compares the running index scores of the two, when the first execution plan If the running index score of the first execution plan is less than the running index score of the historical execution plan, it is determined that the performance of the first execution plan generated by the first management node is better than that of the historical execution plan; when the running index score of the first execution plan is not less than the running index of the historical execution plan The index score determines that the performance of the first execution plan generated by the first management node is not better than the performance of the historical execution plan.
  • the method for determining the running index score of the first execution plan can refer to the second optional method in step A12 above.
  • step 202 Since each time a new execution plan of the SQL statement is adopted, the database system will analyze whether the performance of the execution plan is degraded. In the process of analyzing whether the performance of the execution plan is degraded, Obtain instruction information indicating the performance of the execution plan, for example, the instruction information includes the data corresponding to the operation index of the execution plan (for example, the operation index data group corresponding to each operation index in the operation index of the execution plan) or the execution plan The database system can record the obtained performance indication information. In this way, the database system records the instruction information of each historical execution plan. Then the database system can determine the operation index score of the historical execution plan based on the pre-recorded indication information of the historical execution plan, and the operation index score reflects the performance of the historical execution plan.
  • the instruction information includes the data corresponding to the operation index of the execution plan (for example, the operation index data group corresponding to each operation index in the operation index of the execution plan) or the execution plan
  • the database system can record the obtained performance indication information. In this way, the
  • the generated execution plan carries estimated performance overhead, and the larger the performance overhead, the worse the performance of the execution plan.
  • the database system may determine the running index score of the historical execution plan based on the performance overhead, and the running index score reflects the performance of the historical execution plan.
  • the performance overhead may include data of estimated operating indicators of the execution plan.
  • the performance overhead of the historical execution plan includes: estimated IO indicators, time delay, error information, execution times, and/or processing time data of the historical execution plan (or the abnormality level converted from the data).
  • the operating index score is determined based on the estimated data of each of the foregoing operating indicators, and the determination method may refer to the second optional method in the foregoing step A12.
  • the performance overhead may directly include the estimated running index score.
  • the embodiment of the present application may also compare the performance of the historical execution plan with the performance of the first execution plan in other ways, for example, compare the operation indexes of the historical execution plan with the operation indexes of the first execution plan one by one, and based on the comparison result, It is determined whether the performance of the historical execution plan is better than the performance of the first execution plan, which is not limited in the embodiment of the present application.
  • the first acquisition method can quickly acquire a historical execution plan that has better performance than the first execution plan as the second execution plan, which can achieve rapid optimization of the execution plan and improve optimization efficiency.
  • the second method of obtaining the database system generates the second execution plan of the SQL statement.
  • the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or the duration of the second execution plan for generating the SQL statement is greater than that for generating the SQL statement The duration of the first execution plan.
  • the first execution plan is usually generated online by the first management node.
  • the time length of the first execution plan generation has a certain limit.
  • the first execution plan needs to be generated within the first duration threshold.
  • the first management node may perform the following steps: generate multiple candidate execution plans based on the optimization rule information and/or optimization cost information of the first database, and determine among the multiple candidate execution plans The first execution plan.
  • the duration of generating the candidate execution plan and determining the first execution plan needs to be within the first duration threshold.
  • the computing resources occupied when the first execution plan is generated are also limited to a certain extent.
  • the computing resources occupied by generating the first execution plan are less than the first computing resource threshold. That is, the computing resources occupied by the foregoing process of generating the candidate execution plan and determining the first execution plan is less than the first computing resource threshold.
  • the computing resources may include CPU resources, memory resources, and/or hard disk resources required by the first management node during operation.
  • the first duration threshold may be determined based on the allowable interruption duration in the foregoing reliability index, for example, the first duration threshold is less than or equal to the allowable interruption duration; the first computing resource threshold may be based on the IO upper limit in the foregoing reliability index or other The parameters related to computing resources are determined.
  • the database system may generate multiple candidate execution plans based on the optimization rule information and/or optimization cost information of the first database, and determine the first execution plan among the multiple candidate execution plans.
  • the process of determining the second execution plan can be an offline calculation process. Because the second execution plan does not affect the normal business of the first database when it is generated offline, and is not restricted by the business of the first database, it can occupy more More time and/or computing resources to determine the second execution plan of the SQL statement.
  • the process of generating the candidate execution plan and determining the second execution plan by the database system can refer to the corresponding process of generating the first execution plan described above.
  • the generation principle of the second execution plan and the first execution plan may be the same.
  • the computing resources occupied by the second execution plan for generating the SQL statement; and/or the duration of the second execution plan for generating the SQL statement is not constrained, or is less constrained relative to the process of generating the first execution plan.
  • that the aforementioned database system generates multiple alternative execution plans based on the optimization rule information and/or optimization cost information of the first database means that the database system is based on the optimization rule information of the first database and/or other information in the optimization cost information , Generate multiple alternative execution plans, and the other information is information other than information related to computing resources and computing time in the optimization rule information and/or optimization cost information.
  • the computing resources occupied by the second execution plan of the SQL statement generated by the database system are greater than the computing resources occupied by the first execution plan for generating the SQL statement; and/or the duration of the second execution plan for generating the SQL statement is greater than that of the generated SQL statement The duration of the first execution plan of the SQL statement.
  • the second duration threshold and the second computing resource threshold may be set for the database system.
  • the second duration threshold is greater than the first duration threshold
  • the second computing resource threshold is greater than the first resource threshold.
  • the database system generates an alternative execution plan under the constraints of the second duration threshold and the second computing resource threshold, and then determines the second execution plan in the alternative execution plan.
  • this process please refer to the corresponding method for generating the first execution plan. process.
  • the performance is usually better than that of the first execution plan.
  • the first execution plan is generated by the first management node, and the second execution plan is generated by the optimization node.
  • the number of candidate execution plans generated by the first management node (such as 100) is less than the number of candidate execution plans generated by the optimized node (such as 10000).
  • the first management node traverses
  • the multiple candidate execution plans generated are used to determine the first execution plan.
  • the multiple candidate execution plans generated by the node traversal are optimized to determine the second execution plan.
  • the two traversal processes are the same, but due to the optimization node There are more alternative execution plans available, and the final second execution plan is more likely to be better than the first execution plan.
  • the number of candidate execution plans generated by the first management node and the number of candidate execution plans generated by the optimization node are 10,000), but are limited by the first duration threshold, the first The management node cannot traverse (can only enumerate) the generated multiple candidate execution plans to determine the first execution plan, while the optimization node can traverse the generated multiple candidate execution plans to determine the second execution plan.
  • the same number of candidate execution plans are generated, the number of candidate execution plans scanned by the first management node and the optimized node are different, and the finally determined second execution plan is more likely to be better than the first execution plan.
  • the optimization rule information of the first database indicates that the query data of the SQL statement is returned in 5 milliseconds, and the first duration threshold is 0.5 milliseconds.
  • the first management node generates 1000 alternative execution plans. Within 0.5 milliseconds, the first management node can only scan 100 alternative executions among the 1000 alternative execution plans. plan. Then the first management node determines the first execution plan based on the 100 candidate execution plans. Assuming that the optimization node generates 1000 candidate execution plans, which are the same as the 1000 candidate execution plans generated by the first management node, the optimization node traverses the 1000 candidate execution plans to determine among the 1000 candidate execution plans The second execution plan.
  • the generation time and/or the occupied computing resources reduce the restriction on the process of generating the execution plan, it can be ensured that the performance of the finally determined second execution plan is better than the performance of the first execution plan.
  • first acquisition method and the second acquisition method can also be used in combination.
  • the database system cannot obtain the historical execution plan of the SQL statement (for example, there are no other execution plans for the SQL statement, or other existing execution plans do not meet the conditions, resulting in the inability to obtain the historical execution plan); or, although the historical execution plan can be obtained , But the performance of the historical execution plan is not better than that of the first execution plan, then the second acquisition method mentioned above is executed.
  • the database system may also use other methods to obtain the second execution plan of the SQL statement.
  • the user may input an execution plan update instruction, and correspondingly, the database system may receive an execution plan update instruction, and the execution plan update instruction includes the second execution plan.
  • the user can also control whether to intervene in the execution plan.
  • the database system may also send an alarm indication information.
  • the warning indication information indicates that the performance of the first execution plan of the SQL statement has deteriorated.
  • the alarm indication information may include SQL statements, that is, SQL statements that produce performance degradation; the alarm indication information may also include tasks that indicate intervention in the execution plan.
  • the user can know the SQL statement that currently has performance degradation based on the warning indication information, and determine whether to intervene in the execution plan.
  • the database system obtains the second execution plan of the SQL statement.
  • the execution plan optimization instruction is used to instruct to intervene in the degraded execution plan.
  • the execution plan optimization instruction and the execution plan update instruction may be the same instruction.
  • the warning indication information may be presented through a user interface.
  • FIG. 7 is a schematic diagram of an exemplary user interface 30 provided by an embodiment of the present application.
  • the user interface 30 may also present a determination option 302, a prohibition option 303, and/or a delay optimization option 304.
  • the determination option 302 is triggered.
  • the database system receives the execution instruction and optimizes the execution plan based on the execution instruction; when the user determines that the optimization of the execution plan is prohibited, the prohibition is triggered
  • Option 303 the database system receives an execution prohibition instruction, and the optimization of the execution plan is prohibited based on the execution prohibition instruction; when the user determines to delay the optimization of the execution plan, the delay optimization option 304 is triggered, and accordingly, the database system receives When the deferred execution instruction is reached, the execution plan is optimized based on the deferred execution instruction after reaching the time point indicated by the deferred execution instruction.
  • the time point indicated by the delay optimization option may be a preset time point, such as a shutdown time point or a power-on time point; or, the time point indicated by the delay optimization option may be a time point set by the user, such as one hour later or one day later.
  • the warning indication information is presented to the user through the user interface, and the user controls whether to optimize the execution plan, which can prevent the automatic execution plan optimization in the background from affecting the user's operation or affecting the user business being executed, and improve The flexibility in the time of execution of the planned intervention improves the user experience.
  • Step 204 The database system converts the second execution plan into a second execution plan matching the first management node.
  • the second execution plan obtained by the database system needs to be parsed by the first management node when it is used.
  • the second execution plan can be parsed by the first management node, it is possible that the second execution plan is not fully adapted to the first management node, which affects the speed at which the first management node parses the second execution plan, which in turn leads to the The first management node generates a longer analysis delay, which affects the efficiency of loading and using the second execution plan.
  • the second execution plan can be converted into a second execution plan that matches the first management node, so as to ensure that the first management node can quickly analyze the converted second execution plan, thereby reducing the generation of the first management node. Analyze the time delay and improve the efficiency of loading and using the second execution plan by the first management node.
  • the database system may use the method of querying the correspondence relationship to convert the second execution plan into a second execution plan matching the first management node.
  • the process includes: the database system queries the correspondence relationship between the specified management node and the execution plan format , The execution plan format corresponding to the first management node is obtained; the database system converts the second execution plan into a second execution plan conforming to the execution plan format.
  • Step 205 The optimization node executes the second execution plan to replace the execution of the first execution plan.
  • the optimization node may not execute the foregoing step 204, and directly execute the second execution plan to replace the execution of the first execution plan; in another optional manner, the optimization node The second execution plan transformed in step 204 may be executed to replace the execution of the first execution plan.
  • the second execution plan carries a hint tag, which is used to identify the corresponding execution plan as an updated execution plan (or called an intervened execution plan).
  • a database system such as an optimization node
  • the first management node can determine that the corresponding execution plan is an execution plan after the intervention of the database system (such as an optimization node) based on the description prompt label.
  • the description prompt label may be composed of one or more characters, and the characters may be numeric characters, alphabetic characters, and so on.
  • the second execution plan added with the description prompt label is still stored in the aforementioned system table 1042.
  • the second execution plan will replace the first execution plan recorded in the system table 1042.
  • the first execution plan may be deleted first, and then the second execution plan may be added; in another optional manner, the second execution plan may be used to overwrite the first execution plan.
  • the execution plan in the traditional database system does not add a description prompt label.
  • the embodiment of the present application adds a description prompt label to the second execution plan, which can be distinguished from the execution plan normally generated by the first management node 101a.
  • the first management node 101a loads the second execution plan to which the description prompt label is added.
  • the performance of the second execution plan is better than that of the first execution plan, so that the optimization of the execution plan is realized.
  • a partition storage method may be used to distinguish the updated execution plan from the normally generated execution plan.
  • the database system (such as the optimization node) stores the second execution plan in other system tables, and the other system tables are used to record the updated execution plan.
  • the updated execution plan is not allowed to be used (for example, stop the first execution plan)
  • the updated execution plan corresponding to the first management node in the other system tables can be cleared.
  • other system tables usually have the following two states, one is a state in which an updated execution plan of the first management node is stored, and the other is a state in which an updated execution plan of the first management node is not stored.
  • the first management node When the first management node needs to load the execution plan of the SQL statement, it can first query other system tables. If the execution plan of the SQL statement is stored in the other system table, the execution plan is loaded; if the execution plan of the SQL statement is not stored in the other system table , Load the execution plan of the SQL statement in the aforementioned system table.
  • step 205 are described by taking the performance degradation of the first execution plan as an example.
  • the performance of the first execution plan is analyzed in step 202 as degradation, the use of the first execution plan can be maintained.
  • the first management node 101a obtains from the system table 1042 is still the first execution plan (not shown in FIG. 3).
  • Step 206 When the performance of the new version of the execution plan is better than the performance of the second execution plan, the database system executes the new version of the execution plan to replace the execution of the second execution plan.
  • the database system (such as the first management node) will generate a new version of the execution plan, assuming that the new version of the execution plan is the third execution plan.
  • the database system can analyze the performance of the third execution plan, and if the performance of the third execution plan is better than that of the second execution plan, the database system executes the new version of the execution plan to replace the execution of the second execution plan.
  • the performance of the third execution plan is not better than the performance of the second execution plan, it indicates that the performance of the second execution plan is still better, and the database system still maintains the execution of the second execution plan.
  • each time the database system generates a third execution plan it compares the performance of the second execution plan with the performance of the third execution plan until the performance of the third execution plan is better than that of the second execution plan. , The database system executes the new version of the execution plan to replace the execution of the second execution plan.
  • the database system can determine the running index score of the third execution plan based on the performance cost, and obtain the running index score of the second execution plan, and the database system compares the running index scores of the two , When the operating index score of the third execution plan is less than the operating index score of the second execution plan, it is determined that the performance of the third execution plan is better than that of the second execution plan; when the third execution plan’s operation index score is not less than the second execution plan The running index score of the plan determines that the performance of the third execution plan is not better than the performance of the second execution plan.
  • the performance overhead may include data corresponding to the estimated operating indicators of the third execution plan (that is, the operating indicator data group corresponding to each operating indicator in the operating indicators of the execution plan).
  • the performance overhead of the third execution plan includes: the estimated IO indicators, time delay, error information, execution times, and/or processing time data of the third execution plan (or the abnormality level converted from the data).
  • the operating index score is determined based on the estimated data of each of the foregoing operating indicators, and the determination method may refer to the second optional method in the foregoing step A12.
  • the performance overhead may directly include the estimated running index score.
  • the embodiment of the present application can also compare the performance of the second execution plan with the performance of the third execution plan in other ways. As a result, it is determined whether the performance of the third execution plan is better than the performance of the second execution plan, which is not limited in the embodiment of the present application.
  • the database system can also obtain the third execution plan of the SQL statement (that is, the aforementioned new version of the execution plan) in other ways.
  • the user can input an execution plan version update instruction, and accordingly, the database system can receive the execution plan version.
  • An update instruction, and the execution plan version update instruction includes a third execution plan.
  • the user can also set the rules in the database system.
  • the method for processing the execution plan provided in the embodiment of the present application may further include: receiving a rule setting instruction, where the rule setting instruction includes the set rule.
  • the rules in the database system may include at least one of the following: SQL performance comparison rules, description prompt label setting rules, alarm rules, and routing rules.
  • the SQL performance comparison rule is a rule that instructs the database system how to determine whether the performance of the first execution plan of the SQL statement is degraded. For example, based on the SQL performance comparison rule, the database system can execute the aforementioned steps A1 to A3.
  • the description prompt label setting rule is a rule that instructs the database system how to set the description prompt label. For example, based on the setting rules of the description prompt label, the database system may use the method provided in the foregoing step 205 to add the description prompt label.
  • the alarm rule is a rule that instructs the database system how to alarm. For example, based on the alarm rule, the database system can issue the aforementioned alarm indication information.
  • the routing rule is a rule that instructs the database system how to store the acquired data (such as the data corresponding to the running index). For example, based on routing rules, the database system may store the acquired data in the operating index data group in a designated storage space.
  • the embodiment of the present application will replace the first execution plan with the second execution plan to avoid the use of the first execution plan of performance degradation in the database and reduce the execution of performance degradation.
  • Plan the impact on the database to ensure the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, thereby effectively ensuring the performance of the database.
  • the database system of the embodiment of the present application supports the function of intervention in the execution plan of the management node, and this function can be triggered in a variety of ways. For example, in an optional manner, after receiving the execution plan intervention instruction, the database system executes the intervention process of the execution plan of the management node, such as starting to execute step 202 to step 206, that is, after receiving the execution plan optimization instruction After that, start to analyze whether the performance of the first execution plan of the SQL statement is degraded.
  • the execution plan intervention instruction can be triggered by the user through the application or by a designated device; in another alternative, the database system periodically Perform an intervention process to the execution plan of the first management node, such as step 202 to step 206.
  • Fig. 8 is a schematic structural diagram of the database system provided by an embodiment of the present application.
  • the database system includes optimization nodes.
  • Figure 8 assumes that the optimization nodes are located outside the management node (not shown in Figure 8).
  • the optimization nodes include processing modules, artificial intelligence computing engines, analysis modules, and operation modules. And alarm module.
  • the analysis module includes a diagnosis sub-module and an optimization sub-module
  • the operation module includes a cluster management sub-module and an instance management sub-module.
  • the artificial intelligence calculation engine may store the aforementioned first artificial intelligence model and the aforementioned second artificial intelligence model, and perform corresponding calculations based on the stored artificial intelligence model. For example, perform the calculation corresponding to the aforementioned step A111 and the second method provided by the aforementioned step A114.
  • the analysis module is used to analyze whether the performance of the first execution plan of the SQL statement is deteriorated, and after determining that the performance of the first execution plan is deteriorated, perform replacement of the first execution plan.
  • the diagnosis sub-module is used to diagnose whether the performance of the first execution plan of the SQL statement is degraded, which can execute the aforementioned step 202; the optimization sub-module is used to perform the first execution after the diagnosis sub-module determines that the performance of the first execution plan is degraded For the planned replacement, it can execute the aforementioned step 203 to step 205.
  • the operation module is used to manage operations in the database system, where the cluster management sub-module is used to manage the database cluster, and the instance management sub-module is used to manage the database instance.
  • the alarm module is used to send alarm indication information.
  • the database system also includes multiple databases, the multiple databases including: one or more relational databases, one or more index databases, and a configuration database.
  • the relational database is the database mainly maintained by the database system.
  • Fig. 8 takes a total of 3 relational databases, databases 1 to 3 respectively, as an example for illustration.
  • Each database includes a management node and one or more data nodes managed by the management node, and each database can provide system views, SQL indicators, and/or an application programming interface (API) of the management node.
  • the SQL indicator refers to the operation indicator of the execution plan of the aforementioned SQL statement.
  • the management node API refers to the API of the management node in the database.
  • the index database is used to store the data involved in the processing method of the execution plan provided in the embodiment of the present application.
  • the number of the index database may increase according to the increase in the amount of stored data.
  • Figure 8 takes a total of 3 index databases, namely index databases 1 to 3 as examples.
  • the configuration database is used to store rules in the database system, such as SQL performance comparison rules, description prompt label setting rules, alarm rules and/or routing rules.
  • the database system is maintained with an operating system (OS), and the operating system may be a Linux or Windows operating system.
  • the operating system can control CPU, disk, memory, network, and/or mainboard, etc.
  • the database system Based on the original database service, the database system adds a collection layer, a storage and processing layer, a service layer, and a page (view) layer according to functions. Among them, there is an API between the collection layer and the storage and processing layer, and there is an API between the service layer and the page layer.
  • the page layer can provide visual pages. Through this visualization page, the user can control whether to intervene in the execution plan, or enter the execution plan version update instruction, or enter the execution plan intervention instruction.
  • the visualization page may present a user interface as shown in FIG. 7.
  • the optimization node can arrange proxy modules on the host where each database in the database system is located, and each proxy module collects data corresponding to the running indicators on the deployed database host, and sends the collected data to the processing module.
  • the proxy module may use a message queue (MQ) method to send the collected data to the processing module, and the processing module performs streaming processing on the received data.
  • MQ message queue
  • the processing module can store the execution plans of all SQL statements stored in the system table of the database system (such as the system table in the foregoing embodiment) into the index database corresponding to the management node.
  • the way the processing module performs streaming processing can be divided into online (online) and offline (offline) two ways.
  • the processing module may obtain the performance baseline of each operation index calculated by the artificial intelligence calculation engine, and store the performance baseline of each operation index in the index database.
  • the user can set routing rules through the aforementioned rule setting instructions.
  • the processing module stores the data corresponding to the operating indicators of the execution plan of the SQL statement in the indicator database based on the set routing rules and/or the performance baseline of each operating indicator. .
  • the analysis module analyzes whether the performance of the first execution plan of the SQL statement in the database X has deteriorated, and after determining the performance deterioration of the first execution plan, the optimization sub-module The second execution plan of the SQL statement is acquired, and the database X is controlled to execute the second execution plan to replace the execution of the first execution plan.
  • the alarm module sends out alarm indication information after reaching the alarm condition.
  • the embodiment of the present application will replace the first execution plan with the second execution plan to prevent the database from using the first execution plan with performance degradation and reduce the impact of the performance plan on the database. Influence, thereby ensuring the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, database version rollbacks can be avoided, and the duration of business interruption can be reduced.
  • FIG. 9 is a schematic flowchart of the processing method of the execution plan provided in an embodiment of the present application. This method can be executed by the aforementioned database system 10. The method includes:
  • Step 401 The database system executes the first execution plan of the SQL statement.
  • step 401 For the process of step 401, reference may be made to the process of step 201, which is not described in detail in the embodiment of the present application.
  • Step 402 The database system obtains the second execution plan of the new version of the SQL statement.
  • the process of obtaining the second execution plan of the new version of the SQL statement by the database system in step 402 can refer to the process of obtaining the execution plan of the new version of the SQL statement by the database system in step 206 (that is, the third execution plan). Do repeat.
  • the second execution plan is generated by the management node or input by the user through the execution plan version update instruction.
  • obtaining the second execution plan of the new version of the SQL statement includes: generating the second execution plan of the SQL statement, and the process of generating the second execution plan of the SQL statement may include: optimization based on the database where the management node is located Rule information and/or optimization cost information to generate multiple candidate execution plans; traverse the multiple candidate execution plans to obtain the second execution plan.
  • Step 403 When the performance of the second execution plan is better than the performance of the first execution plan, the database system executes the second execution plan to replace the execution of the first execution plan.
  • the process of step 403 may refer to the process of executing the third execution plan by the database system in step 206 to replace the execution of the second execution plan, which is not described in detail in the embodiment of the present application.
  • the second execution plan in step 403 is equivalent to the third execution plan in step 206
  • the first execution plan in step 403 is equivalent to the second execution plan in step 206.
  • the execution plan processing method also supports other functions provided in the foregoing embodiments. For example, before step 403, for example, after determining that the performance of the second execution plan is better than that of the first execution plan, the database The system converts the second execution plan into a second execution plan that matches the management node. For this process, refer to the aforementioned step 204. This is not repeated in the embodiment of the application.
  • the management node when the management node generates a new version of the execution plan, it directly executes the new version of the execution plan to replace the execution of the original execution plan, and the new version of the execution plan will continue for a period of time (such as a few weeks) Use, if the performance of the new version of the execution plan itself is poor, it will affect the performance of the database during this period of time. In severe cases, large-scale database versions will be rolled back, causing long-term business interruption.
  • the database system executes the second execution plan to replace the execution of the first execution plan, so as to avoid the use of degraded performance in the database.
  • the new version of the execution plan reduces the impact of degraded execution plans on the database, thereby ensuring the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
  • FIG. 10 is a block diagram of a database system 50 provided by an embodiment of the present application.
  • the database system 50 includes:
  • the execution module 501 is used to execute the first execution plan of the structured query language SQL statement.
  • the obtaining module 502 is configured to obtain the second execution plan of the SQL statement when the performance of the first execution plan of the SQL statement deteriorates.
  • the execution module 502 is also used to execute the second execution plan to replace the execution of the first execution plan.
  • the execution module will replace the first execution plan with the second execution plan, so as to avoid the use of the first execution plan of the performance deterioration of the database, and reduce the effect of the execution plan of the performance deterioration on the database. The impact of this to ensure the performance of the database.
  • the second execution plan is different from the first execution plan.
  • the performance of the second execution plan is better than the performance of the first execution plan.
  • the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, database version rollbacks can be avoided, and the duration of business interruption can be reduced.
  • the obtaining module 502 is configured to: obtain a historical execution plan of the SQL statement; when the performance of the historical execution plan is better than that of the first execution plan, use the historical execution plan as the second execution plan .
  • the obtaining module 502 is configured to generate a second execution plan of the SQL statement.
  • the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or the duration of the second execution plan for generating the SQL statement is greater than The duration of the first execution plan for generating the SQL statement.
  • FIG. 11 is a block diagram of a database system 50 provided by an embodiment of the present application.
  • the database system 50 includes an alarm module 503 for sending alarm indication information when the performance of the first execution plan of the SQL statement deteriorates.
  • the obtaining module 502 is configured to obtain the second execution plan of the SQL statement after receiving the execution plan optimization instruction.
  • the execution module 501 is further configured to execute the new version of the execution plan to replace the execution of the second execution plan when the performance of the new version of the execution plan is better than the performance of the second execution plan.
  • the database system 50 further includes: a determining module 504, configured to determine the first SQL statement when an abnormality occurs in the operation index of the first execution plan. The performance of the execution plan is degraded.
  • the operation indicators of the first execution plan include one or more of the following: input and output IO indicators, time delay, error information, execution times, and processing duration of the first execution plan.
  • the determining module 504 is configured to: for each operating indicator in the operating indicators of the first execution plan, when the performance indicated by the operating indicator data group corresponding to the operating indicator is lower than the SQL corresponding to the operating indicator The performance indicated by the statement’s historical operating indicator data group is determined to be abnormal; and/or, for each operating indicator in the operating indicators of the first execution plan, the operating indicator data group corresponding to the operating indicator is entered in the first An artificial intelligence model, when the first artificial intelligence model outputs indication information indicating that the operation index is abnormal, it is determined that the operation index is abnormal.
  • the determining module 504 is configured to:
  • the database system 50 further includes: a baseline generation module 505, configured to generate the operating index based on the second artificial intelligence model and the historical operating indicator data set. Performance baseline.
  • a database system provided by an embodiment of the present application may also be the database system shown in FIG. 1 or FIG. 8 described above.
  • the foregoing execution module 501 can be integrated in the management node 101 and the data node 102, so that the management node 101 and the data node 102 cooperate to complete the execution module
  • the function of 501, or the aforementioned execution module 501 can be integrated in the management node 101, so that the management node 101 completes the function of the execution module 501; one of the acquisition module 502, the alarm module 503, the determination module 504 and the baseline generation module 505 or Multiple modules may be integrated in the optimization node 103, so that the optimization node 103 completes the function of the one or more modules.
  • the execution module 501 may be integrated in the database, such as at least one of the databases 1 to 3, so that the at least one database Complete the function of the execution module 501; the acquisition module 502 can be integrated in the processing module to complete the function of the acquisition module 502 by the processing module.
  • the function of the alarm module 503 is the same as that of the alarm module in FIG. 8; the determination module 504 can be integrated In the analysis module, the analysis module completes the function of the determination module 504; the baseline generation module 505 can be integrated into the artificial intelligence calculation engine, so that the artificial intelligence calculation engine completes the function of the baseline generation module 505.
  • FIG. 14 is a block diagram of another database system 60 provided by an embodiment of the present application.
  • the database system 60 includes:
  • the execution module 601 is used to execute the first execution plan of the structured query language SQL statement; the obtaining module 602 is used to obtain the second execution plan of the new version of the SQL statement; the execution module 602 is also used to execute the second execution plan of the SQL statement.
  • the second execution plan is executed to replace the execution of the first execution plan.
  • a database system provided by an embodiment of the present application may also be the database system shown in FIG. 1 described above.
  • the foregoing execution module 601 can be integrated in the management node 101 and the data node 102, so that the management node 101 and the data node 102 cooperate to complete the execution module
  • the function of 601, or the aforementioned execution module 601 can be integrated in the management node 101, so that the management node 101 completes the function of the execution module 601;
  • the acquisition module 602 can be integrated in the optimization node 103, so that the optimization node 103 completes the execution module 602 Function.
  • the execution module executes the second execution plan to replace the execution of the first execution plan, so as to avoid performance degradation of the database adoption
  • the new version of the execution plan reduces the impact of performance-degraded execution plans on the database, thereby ensuring the performance of the database.
  • the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
  • FIG. 15 schematically provides a possible basic hardware architecture of the computer device of the present application.
  • the computer device 700 includes a processor 701, a memory 702, a communication interface 703, and a bus 704.
  • the number of processors 701 may be one or more, and FIG. 15 only illustrates one of the processors 701.
  • the processor 701 may be a central processing unit (CPU). If the computer device 700 has multiple processors 701, the types of the multiple processors 701 may be different or may be the same.
  • multiple processors 701 of the computer device 700 may also be integrated into a multi-core processor.
  • the memory 702 stores computer instructions and data; the memory 702 may store computer instructions and data required to implement the processing method of the execution plan provided in the present application. For example, the memory 702 stores instructions for implementing the steps of the processing method of the execution plan.
  • the memory 702 may be any one or any combination of the following storage media: non-volatile memory (for example, read only memory (ROM), solid state drive (SSD), hard disk (HDD), optical disc), volatile memory.
  • the communication interface 703 may be any one or any combination of the following devices: a network interface (for example, an Ethernet interface), a wireless network card, and other devices with a network access function.
  • the communication interface 703 is used for data communication between the computer device 700 and other computer devices or terminals.
  • the bus 704 can connect the processor 701 with the memory 702 and the communication interface 703. In this way, through the bus 704, the processor 701 can access the memory 702, and can also use the communication interface 703 to interact with other computer devices or terminals.
  • the computer device 700 executes the computer instructions in the memory 702, so that the computer device 700 implements the processing method of the execution plan provided in this application, or causes the computer device 700 to deploy a database system.
  • non-transitory computer-readable storage medium including instructions, such as a memory including instructions, which can be executed by a processor of a server to complete the execution plan shown in each embodiment of the present application.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
  • the computer may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • software it may be implemented in the form of a computer program product in whole or in part, and the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data.
  • the center transmits to another website, computer, server, or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium, or a semiconductor medium (for example, a solid state hard disk).
  • the program can be stored in a computer-readable storage medium.
  • the storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

An execution plan processing method, device, and system, relating to the field of databases. The method comprises: executing a first execution plan of a structured query language (SQL) sentence; when the performance of the first execution plan of the SQL sentence is degraded, obtaining a second execution plan of the SQL sentence; and executing the second execution plan to replace the execution of the first execution plan. The method is used for executing an execution plan in a database, thereby reducing the influence of a degraded execution plan on the database.

Description

执行计划的处理方法、设备及系统Method, equipment and system for processing execution plan
本申请要求于2020年2月27日提交的申请号为202010124587.2、发明名称为“执行计划性能裂变自恢复方法”的中国专利申请的优先权,以及要求于2020年03月30日提交的申请号为202010238039.2、发明名称为“执行计划的处理方法、设备及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on February 27, 2020 with the application number 202010124587.2 and the invention title of "Performance Fission Self-Recovery Method of Execution Plan", and the application number filed on March 30, 2020 It is the priority of the Chinese patent application of 202010238039.2 and the invention title is "Processing method, equipment and system of execution plan", the entire content of which is incorporated into this application by reference.
技术领域Technical field
本申请涉及数据库领域,特别涉及一种执行计划的处理方法、设备及系统。This application relates to the field of databases, and in particular to a processing method, equipment and system for executing plans.
背景技术Background technique
在数据库中,用户采用结构化查询语言(Structured Query Language)SQL语句进行数据的查询。查询引擎可以为一条SQL语句生成一个执行计划,并在一段时间内基于该执行计划进行数据的处理。其中,执行计划(也称SQL执行计划)用于指示执行的动作,以及执行动作的先后顺序等。In the database, users use Structured Query Language (Structured Query Language) SQL statements to query data. The query engine can generate an execution plan for a SQL statement, and process data based on the execution plan within a period of time. Among them, the execution plan (also called SQL execution plan) is used to indicate the actions to be executed, and the sequence of actions to be executed, etc.
但是,由于每个执行计划会在一段时间(如几周)内持续使用,若该执行计划本身性能较差,会在该段时间内影响数据库的性能。However, since each execution plan will be used continuously for a period of time (such as several weeks), if the execution plan itself has poor performance, it will affect the performance of the database during this period of time.
发明内容Summary of the invention
本申请实施例提供了一种执行计划的处理方法、设备及系统。所述技术方案如下:The embodiments of the present application provide a processing method, equipment, and system for executing a plan. The technical solution is as follows:
第一方面,提供一种执行计划的处理方法,该方法可以由数据库系统执行,该方法包括:In a first aspect, a method for processing an execution plan is provided. The method can be executed by a database system. The method includes:
执行结构化查询语言SQL语句的第一执行计划;在该SQL语句的第一执行计划的性能劣化时,获取该SQL语句的第二执行计划;执行该第二执行计划来替换对该第一执行计划的执行。Execute the first execution plan of the structured query language SQL statement; when the performance of the first execution plan of the SQL statement deteriorates, obtain the second execution plan of the SQL statement; execute the second execution plan to replace the first execution Implementation of the plan.
本申请实施例中,在分析到第一执行计划的性能劣化后,会采用第二执行计划替换第一执行计划,以避免数据库使用性能劣化的第一执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。In the embodiment of this application, after the performance degradation of the first execution plan is analyzed, the second execution plan will be used to replace the first execution plan to avoid the use of the first execution plan of the performance degradation of the database, and reduce the performance degradation of the execution plan to the database. The impact of this to ensure the performance of the database.
可选地,该第二执行计划与该第一执行计划不同。进一步可选地,该第二执行计划的性能优于该第一执行计划的性能,可以有效保证数据库的性能。Optionally, the second execution plan is different from the first execution plan. Further optionally, the performance of the second execution plan is better than the performance of the first execution plan, which can effectively guarantee the performance of the database.
可选地,获取SQL语句的第二执行计划的实现方式有多种,本申请实施例以以下两种获取方式为例进行说明:Optionally, there are multiple implementation modes for obtaining the second execution plan of the SQL statement, and the embodiment of the present application takes the following two obtaining modes as examples for description:
第一种获取方式:获取该SQL语句的历史执行计划;当该历史执行计划的性能优于该第一执行计划的性能时,将该历史执行计划作为该第二执行计划。The first method of obtaining: obtaining the historical execution plan of the SQL statement; when the performance of the historical execution plan is better than the performance of the first execution plan, the historical execution plan is used as the second execution plan.
可选地,可以在SQL语句的其他执行计划(该其他执行计划是在第一执行计划之前生成的执行计划)中确定历史执行计划,以判定该历史执行计划是否可以作为第二执行计划。示例的,该历史执行计划可以是SQL语句的其他执行计划中性能最优的执行计划、历史使用时间最长的执行计划或符合其他设定条件的执行计划。Optionally, the historical execution plan may be determined in other execution plans of the SQL statement (the other execution plan is an execution plan generated before the first execution plan) to determine whether the historical execution plan can be used as the second execution plan. For example, the historical execution plan may be the execution plan with the best performance among other execution plans of the SQL statement, the execution plan with the longest historical use time, or the execution plan that meets other set conditions.
采用该第一种获取方式,由于历史执行计划已经预先生成,因此可以快速获取优于第一执行计划的性能的历史执行计划作为第二执行计划,能够实现执行计划的快速优化,提高优化效率。By adopting the first acquisition method, since the historical execution plan has been generated in advance, the historical execution plan with better performance than the first execution plan can be quickly acquired as the second execution plan, which can realize the rapid optimization of the execution plan and improve the optimization efficiency.
第二种获取方式:生成该SQL语句的第二执行计划。The second way to obtain: generate the second execution plan of the SQL statement.
可选地,生成该SQL语句的第二执行计划所占用的计算资源大于生成该SQL语句的第一执行计划所占用的计算资源,和/或,生成该SQL语句的第二执行计划的时长大于生成该SQL语句的第一执行计划的时长。Optionally, the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or the duration of the second execution plan for generating the SQL statement is greater than The duration of the first execution plan for generating the SQL statement.
由于在生成时间和/或占用的计算资源上减少了对生成执行计划过程的限制,可以保证最终确定的第二执行计划的性能优于第一执行计划的性能。Since the generation time and/or the occupied computing resources reduce the restriction on the process of generating the execution plan, it can be ensured that the performance of the finally determined second execution plan is better than the performance of the first execution plan.
可选地,本申请实施例提供的数据库系统还支持告警功能。相应的,该执行计划的处理方法还包括:在该SQL语句的第一执行计划的性能劣化时,发送告警指示信息。可选地,该告警指示信息可以包括SQL语句,即产生性能劣化的SQL语句;该告警指示信息还可以包括指示进行执行计划的干预的任务。用户可以基于该告警指示信息知晓当前出现性能劣化的SQL语句,并判定是否进行执行计划的干预。Optionally, the database system provided in the embodiment of the present application also supports an alarm function. Correspondingly, the processing method of the execution plan further includes: sending alarm indication information when the performance of the first execution plan of the SQL statement deteriorates. Optionally, the alarm indication information may include SQL statements, that is, SQL statements that produce performance degradation; the alarm indication information may also include tasks that indicate intervention in the execution plan. The user can know the SQL statement that currently has performance degradation based on the warning indication information, and determine whether to intervene in the execution plan.
本申请实施例中,通过用户界面将告警指示信息呈现给用户,由用户来控制是否进行执行计划的优化,可以避免后台自动进行执行计划的优化影响用户的操作或影响正在执行的用户业务,提高执行计划干预的时间上的灵活性,提高用户体验。In the embodiment of the present application, the warning indication information is presented to the user through the user interface, and the user controls whether to optimize the execution plan, which can prevent the automatic execution plan optimization in the background from affecting the user's operation or affecting the user business being executed, and improve The flexibility in the time of execution of the planned intervention improves the user experience.
获取SQL语句的第二执行计划的过程可以有多种触发方式,例如,在接收到执行计划优化指令后,获取该SQL语句的第二执行计划。该执行计划优化指令可以是用户通过应用程序触发,也可以由指定设备触发。该执行计划优化指令用于指示对劣化的执行计划进行干预。The process of obtaining the second execution plan of the SQL statement can be triggered in multiple ways. For example, after receiving the execution plan optimization instruction, the second execution plan of the SQL statement is obtained. The execution plan optimization instruction may be triggered by the user through the application program, or may be triggered by a designated device. The execution plan optimization instruction is used to instruct to intervene in the degraded execution plan.
可选地,该方法还包括:在新版本的执行计划的性能优于该第二执行计划的性能时,执行该新版本的执行计划来替换对该第二执行计划的执行。Optionally, the method further includes: when the performance of the new version of the execution plan is better than the performance of the second execution plan, executing the new version of the execution plan to replace the execution of the second execution plan.
本申请实施例在新版本的执行计划的性能优于第二执行计划的性能时,数据库系统才执行新版本的执行计划来替换对第二执行计划的执行,以避免数据库采用性能劣化的新版本的执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。并且,由于该新版本的执行计划的性能优于第二执行计划的性能,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。In the embodiment of this application, when the performance of the new version of the execution plan is better than the performance of the second execution plan, the database system executes the new version of the execution plan to replace the execution of the second execution plan, so as to prevent the database from adopting a new version with degraded performance. The execution plan reduces the impact of the performance-degraded execution plan on the database, thereby ensuring the performance of the database. Moreover, since the performance of the new version of the execution plan is better than that of the second execution plan, the performance of the database can be effectively guaranteed, the database version is prevented from rolling back, and the duration of business interruption is reduced.
运行指标用于反映对应的执行计划的运行效果,也可以反映对应的SQL语句的性能。通过第一执行计划的运行指标可以确定第一执行计划的性能。则当该第一执行计划的运行指标出现异常时,确定该SQL语句的第一执行计划的性能劣化。示例的,第一执行计划的运行指标包括以下的一种或多种:SQL语句的IO指标、时延(delay)、错误(error)信息、执行次数和处理时长。The running index is used to reflect the running effect of the corresponding execution plan, and can also reflect the performance of the corresponding SQL statement. The performance of the first execution plan can be determined through the operation indicators of the first execution plan. Then, when the operation index of the first execution plan is abnormal, it is determined that the performance of the first execution plan of the SQL statement is degraded. For example, the operation indicators of the first execution plan include one or more of the following: IO indicators, delay (delay), error (error) information, execution times, and processing duration of the SQL statement.
可选地,数据库系统分析第一执行计划的运行指标是否异常的过程可以包括:对于第一执行计划的运行指标中的每个运行指标,将该运行指标对应的运行指标数据组与对应的历史运行指标数据组对比,来确定每个运行指标是否异常;基于每个运行指标的异常判定结果,确定第一执行计划的运行指标(即第一执行计划整体的运行指标)是否异常。Optionally, the process for the database system to analyze whether the operating indicators of the first execution plan are abnormal may include: for each operating indicator in the operating indicators of the first execution plan, the operating indicator data group corresponding to the operating indicator and the corresponding history The operation index data group is compared to determine whether each operation index is abnormal; based on the abnormality determination result of each operation index, it is determined whether the operation index of the first execution plan (that is, the overall operation index of the first execution plan) is abnormal.
可选地,对于该第一执行计划的运行指标中的每个运行指标,确定该运行指标是否异常的可实现方式可以包括:Optionally, for each operating indicator in the operating indicators of the first execution plan, the achievable manner for determining whether the operating indicator is abnormal may include:
第一种可实现方式,对于该第一执行计划的运行指标中的每个运行指标,当该运行指标 对应的运行指标数据组指示的性能低于该运行指标对应的该SQL语句的历史运行指标数据组指示的性能,确定该运行指标出现异常。The first possible implementation manner is that for each operating indicator in the operating indicators of the first execution plan, when the performance indicated by the operating indicator data group corresponding to the operating indicator is lower than the historical operating indicator of the SQL statement corresponding to the operating indicator The performance indicated by the data group determines that the operation index is abnormal.
其中,对于该第一执行计划的运行指标中的每个运行指标,确定该运行指标对应的运行指标数据组指示的性能是否低于该运行指标对应的该SQL语句的历史运行指标数据组指示的性能的方式可以有以下两种:Wherein, for each operating indicator in the operating indicators of the first execution plan, it is determined whether the performance indicated by the operating indicator data set corresponding to the operating indicator is lower than that indicated by the historical operating indicator data set of the SQL statement corresponding to the operating indicator There are two ways of performance:
第一种方式,数据库系统基于指定比较规则将对应的运行指标数据组与对应的历史运行指标数据组进行比较,以检测运行指标数据组指示的性能是否低于对应的历史运行指标数据组指示的性能。In the first way, the database system compares the corresponding operation index data group with the corresponding historical operation index data group based on a specified comparison rule to detect whether the performance indicated by the operation index data group is lower than that indicated by the corresponding historical operation index data group. performance.
例如,数据库系统维护有专家经验库,该专家经验库记载有基于专家经验确定的至少一个指定比较规则,数据库系统基于该指定比较规则,进行运行指标对应的运行指标数据组与对应的历史运行指标数据组的比较。For example, the database system maintains an expert experience database, which records at least one specified comparison rule determined based on expert experience. Based on the specified comparison rule, the database system performs the operation index data group corresponding to the operation index and the corresponding historical operation index Comparison of data sets.
又例如,数据库系统通过将运行指标数据组的性能曲线与运行指标的性能基线进行比较,以检测运行指标数据组指示的性能是否低于历史运行指标数据组指示的性能。For another example, the database system compares the performance curve of the operating indicator data set with the performance baseline of the operating indicator to detect whether the performance indicated by the operating indicator data set is lower than the performance indicated by the historical operating indicator data set.
当该运行指标对应的运行指标数据组的性能曲线与该运行指标的性能基线不匹配时,确定该运行指标对应的运行指标数据组指示的性能低于该历史运行指标数据组指示的性能,该运行指标的性能基线基于该历史运行指标数据组确定。When the performance curve of the operating indicator data set corresponding to the operating indicator does not match the performance baseline of the operating indicator, it is determined that the performance indicated by the operating indicator data set corresponding to the operating indicator is lower than the performance indicated by the historical operating indicator data set. The performance baseline of the operating indicator is determined based on the historical operating indicator data set.
可选地,在使用该运行指标的性能基线之前,数据库系统还可以基于第二人工智能模型以及该历史运行指标数据组,生成该运行指标的性能基线。Optionally, before using the performance baseline of the operating indicator, the database system may also generate the performance baseline of the operating indicator based on the second artificial intelligence model and the historical operating indicator data set.
运行指标的性能基线由人工智能模型生成,在保证性能基线的准确性的基础上,还可以提高性能基线的获取效率。The performance baseline of the operating index is generated by the artificial intelligence model. On the basis of ensuring the accuracy of the performance baseline, the efficiency of obtaining the performance baseline can also be improved.
第二种可实现方式,数据库系统通过AI模型来识别该第一运行指标是否出现异常。该过程如下:In the second achievable manner, the database system uses the AI model to identify whether the first operating indicator is abnormal. The process is as follows:
对于该第一执行计划的运行指标中的每个运行指标,将该运行指标对应的运行指标数据组输入第一人工智能模型,当该第一人工智能模型输出指示该运行指标异常的指示信息,确定该运行指标出现异常。For each operating indicator in the operating indicators of the first execution plan, the operating indicator data set corresponding to the operating indicator is input into the first artificial intelligence model, and when the first artificial intelligence model outputs indication information indicating that the operating indicator is abnormal, It is determined that the operation index is abnormal.
前述两种可实现方式可以根据实际情况进行结合,例如,先执行第一种可实现方式提供的方法,以进行异常的运行指标数据组的粗筛选,该粗筛选过程存在一定的误差,可能出现把非异常的运行指标数据组确定为异常的运行指标数据组的情况;再对粗筛选结果为异常的运行指标数据组执行第二种可实现方式提供的方法,以进行异常的运行指标数据组的精筛选。The foregoing two achievable methods can be combined according to actual conditions. For example, the method provided by the first achievable method is executed first to perform a rough screening of abnormal operating index data sets. There may be certain errors in the rough screening process. Determine the non-abnormal operation index data group as the abnormal operation index data group; then perform the method provided by the second achievable method for the operation index data group whose rough screening result is abnormal to perform the abnormal operation index data group Of fine screening.
对于第一执行计划的运行指标中的每个运行指标,当该运行指标数据组指示的性能低于SQL语句的历史运行指标数据组指示的性能(即通过粗筛选确定该运行指标数据组异常),将运行指标数据组输入第一人工智能模型,当第一人工智能模型输出指示运行指标数据组异常的指示信息,确定第一执行计划的运行指标数据组出现异常(即通过精筛选确定该运行指标数据组异常),相对于前述第二种可实现方式,可以提高确定运行指标数据组异常的精确度。当该运行指标数据组指示的性能不低于SQL语句的历史运行指标数据组指示的性能(即通过粗筛选确定该运行指标数据组正常),无需将运行指标数据组输入第一人工智能模型,相对于前述第二种可实现方式,可以减少第一人工智能模型的运算代价。For each running index in the running index of the first execution plan, when the performance indicated by the running index data group is lower than the performance indicated by the historical running index data group of the SQL statement (that is, the running index data group is determined to be abnormal through rough screening) , The operation index data group is input into the first artificial intelligence model, when the first artificial intelligence model outputs indication information indicating that the operation index data group is abnormal, it is determined that the operation index data group of the first execution plan is abnormal (that is, the operation is determined by fine screening. Index data group abnormality), compared to the second achievable manner described above, the accuracy of determining the abnormality of the operating index data group can be improved. When the performance indicated by the running index data set is not lower than the performance indicated by the historical running index data set of the SQL statement (that is, the running index data set is determined to be normal through coarse screening), there is no need to input the running index data set into the first artificial intelligence model. Compared with the foregoing second achievable manner, the computational cost of the first artificial intelligence model can be reduced.
可选地,数据库系统基于每个运行指标的异常判定结果,确定第一执行计划的运行指标是否出现异常的方式可以有多种,本申请实施例以以下几种可选方式为例进行说明:Optionally, the database system may determine whether the operation index of the first execution plan is abnormal based on the abnormality determination result of each operation index. There are many ways for the database system to determine whether the operation index of the first execution plan is abnormal.
在第一种可选方式中,当第一执行计划的至少一个运行指标出现异常,确定第一执行计划的运行指标出现异常;当第一执行计划的所有运行指标均未出现异常,确定第一执行计划的运行指标未出现异常。In the first optional method, when at least one operation index of the first execution plan is abnormal, it is determined that the operation index of the first execution plan is abnormal; when all the operation indexes of the first execution plan are not abnormal, it is determined that the first execution plan is not abnormal. There is no abnormality in the operational indicators of the execution plan.
在第二种可选方式中,基于每个运行指标的异常判定结果,确定第一执行计划的运行指标分数,当该运行指标分数大于指定分数阈值,确定该第一执行计划的运行指标出现异常;当该运行指标分数不大于指定分数阈值,确定该第一执行计划的运行指标未出现异常。也即是该运行指标分数越高,出现异常的概率越高。In the second optional method, based on the abnormality determination result of each operation index, the operation index score of the first execution plan is determined. When the operation index score is greater than the specified score threshold, it is determined that the operation index of the first execution plan is abnormal ; When the running index score is not greater than the specified score threshold, it is determined that the running index of the first execution plan is not abnormal. That is, the higher the running index score, the higher the probability of abnormality.
在一种可能实现方式中,在该获取该SQL语句的第二执行计划之后,该执行计划的处理方法还包括:将该第二执行计划转化为与管理节点匹配的第二执行计划。以保证管理节点能够快速解析转化后的第二执行计划,从而减少管理节点产生的解析时延,提高管理节点对第二执行计划的加载和使用效率。In a possible implementation manner, after acquiring the second execution plan of the SQL statement, the processing method of the execution plan further includes: converting the second execution plan into a second execution plan matching the management node. To ensure that the management node can quickly analyze the transformed second execution plan, thereby reducing the analysis delay generated by the management node, and improving the efficiency of loading and using the second execution plan by the management node.
可选地,该将该第二执行计划转化为与管理节点匹配的第二执行计划的过程,包括:Optionally, the process of transforming the second execution plan into a second execution plan matching the management node includes:
查询指定的管理节点与执行计划格式的对应关系,得到该管理节点对应的执行计划格式;将该第二执行计划转化为符合该执行计划格式的第二执行计划。Query the correspondence between the designated management node and the execution plan format to obtain the execution plan format corresponding to the management node; transform the second execution plan into a second execution plan that conforms to the execution plan format.
可选地,该第二执行计划携带著录提示标签,该著录提示标签用于标识对应的执行计划为经过干预的执行计划。如此可以便于数据库系统区分哪些执行计划是经过干预的执行计划。Optionally, the second execution plan carries a description prompt label, and the description prompt label is used to identify the corresponding execution plan as an intervention plan. This can facilitate the database system to distinguish which execution plans are intervened execution plans.
可选地,该生成该SQL语句的第二执行计划的过程可以包括:基于管理节点所在数据库的优化规则信息和/或优化成本信息,生成多个备选执行计划;遍历该多个备选执行计划,得到该第二执行计划。Optionally, the process of generating the second execution plan of the SQL statement may include: generating multiple candidate execution plans based on the optimization rule information and/or optimization cost information of the database where the management node is located; traversing the multiple candidate executions Plan to get the second execution plan.
可选地,该执行计划的处理方法还可以包括:接收规则设置指令,该规则设置指令包括设置的规则。可选地,数据库系统中的规则可以包括以下至少一种:SQL性能对比规则、著录提示标签设置规则、告警规则和路由规则。Optionally, the processing method of the execution plan may further include: receiving a rule setting instruction, where the rule setting instruction includes a set rule. Optionally, the rules in the database system may include at least one of the following: SQL performance comparison rules, description prompt label setting rules, alarm rules, and routing rules.
第二方面,提供一种执行计划的处理方法,该方法可以由数据库系统执行,该方法包括:In a second aspect, a method for processing an execution plan is provided. The method can be executed by a database system. The method includes:
执行结构化查询语言SQL语句的第一执行计划;获取该SQL语句的新版本的第二执行计划;在该第二执行计划的性能优于该第一执行计划的性能时,执行该第二执行计划来替换对该第一执行计划的执行。Execute the first execution plan of the structured query language SQL statement; obtain the second execution plan of the new version of the SQL statement; execute the second execution when the performance of the second execution plan is better than that of the first execution plan Plan to replace the execution of the first execution plan.
本申请实施例在新版本的第二执行计划的性能优于第一执行计划的性能时,数据库系统才执行第二执行计划来替换对第一执行计划的执行,以避免数据库采用性能劣化的新版本的执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。并且,由于该第二执行计划的性能优于第一执行计划的性能,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。In the embodiments of this application, when the performance of the new version of the second execution plan is better than the performance of the first execution plan, the database system executes the second execution plan to replace the execution of the first execution plan, so as to prevent the database from adopting new performance degradation The version of the execution plan reduces the impact of the degraded execution plan on the database, thereby ensuring the performance of the database. In addition, since the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
在一种可能实现方式中,在获取该SQL语句的第二执行计划之后,例如在确定该第二执行计划的性能优于该第一执行计划的性能后,该方法还包括:将该第二执行计划转化为与管理节点匹配的第二执行计划。以保证管理节点能够快速解析转化后的第二执行计划,从而减少管理节点产生的解析时延,提高管理节点对第二执行计划的加载和使用效率。In a possible implementation manner, after obtaining the second execution plan of the SQL statement, for example, after determining that the performance of the second execution plan is better than the performance of the first execution plan, the method further includes: The execution plan is transformed into a second execution plan that matches the management node. To ensure that the management node can quickly analyze the transformed second execution plan, thereby reducing the analysis delay generated by the management node, and improving the efficiency of loading and using the second execution plan by the management node.
可选地,该将该第二执行计划转化为与管理节点匹配的第二执行计划的过程,包括:查询指定的管理节点与执行计划格式的对应关系,得到该管理节点对应的执行计划格式;将该第二执行计划转化为符合该执行计划格式的第二执行计划。Optionally, the process of converting the second execution plan into a second execution plan matching the management node includes: querying the correspondence between the specified management node and the execution plan format to obtain the execution plan format corresponding to the management node; The second execution plan is converted into a second execution plan conforming to the execution plan format.
可选地,获取该SQL语句的新版本的第二执行计划包括:生成该SQL语句的第二执行 计划,该生成该SQL语句的第二执行计划的过程可以包括:基于管理节点所在数据库的优化规则信息和/或优化成本信息,生成多个备选执行计划;遍历该多个备选执行计划,得到该第二执行计划。Optionally, obtaining the second execution plan of the new version of the SQL statement includes: generating the second execution plan of the SQL statement, and the process of generating the second execution plan of the SQL statement may include: optimization based on the database where the management node is located Rule information and/or optimization cost information to generate multiple candidate execution plans; traverse the multiple candidate execution plans to obtain the second execution plan.
第三方面,本申请提供一种数据库系统,该数据库系统可以包括至少一个模块,该至少一个模块可以用于实现上述第一方面或者第一方面的各种可能实现提供的该执行计划的处理方法。In a third aspect, the present application provides a database system, the database system may include at least one module, and the at least one module may be used to implement the execution plan processing method provided in the first aspect or various possible implementations of the first aspect. .
第四方面,本申请提供一种数据库系统,该数据库系统可以包括至少一个模块,该至少一个模块可以用于实现上述第一方面或者第一方面的各种可能实现提供的该执行计划处理方法。In a fourth aspect, the present application provides a database system, which may include at least one module, and the at least one module may be used to implement the execution plan processing method provided by the foregoing first aspect or various possible implementations of the first aspect.
第五方面,本申请提供一种计算机设备,该计算机设备包括处理器和存储器。该存储器存储计算机指令;该处理器执行该存储器存储的计算机指令,使得该计算机设备执行上述第一方面或者第一方面的各种可能实现提供的方法,使得该计算机设备部署上述第三方面或者第三方面的各种可能实现提供的该数据库系统。In a fifth aspect, this application provides a computer device including a processor and a memory. The memory stores computer instructions; the processor executes the computer instructions stored in the memory, so that the computer device executes the methods provided by the foregoing first aspect or various possible implementations of the first aspect, so that the computer device deploys the foregoing third aspect or the first aspect. Various possible implementations of the three aspects provide the database system.
第六方面,本申请提供一种计算机设备,该计算机设备包括处理器和存储器。该存储器存储计算机指令;该处理器执行该存储器存储的计算机指令,使得该计算机设备执行上述第二方面或者第二方面的各种可能实现提供的方法,使得该计算机设备部署上述第四方面或者第四方面的各种可能实现提供的该数据库系统。In a sixth aspect, this application provides a computer device including a processor and a memory. The memory stores computer instructions; the processor executes the computer instructions stored in the memory, so that the computer device executes the foregoing second aspect or the methods provided by various possible implementations of the second aspect, so that the computer device deploys the foregoing fourth aspect or the first aspect. Four possible implementations of the database system provided.
第七方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,该计算机指令指示该计算机设备执行上述第一方面或者第一方面的各种可能实现提供的方法,或者该计算机指令指示该计算机设备部署上述第三方面或者第三方面的各种可能实现提供的数据库系统。In a seventh aspect, the present application provides a computer-readable storage medium having computer instructions stored in the computer-readable storage medium, and the computer instructions instruct the computer device to execute the foregoing first aspect or various possible implementations of the first aspect. The method or the computer instruction instructs the computer device to deploy the database system provided by the foregoing third aspect or various possible implementations of the third aspect.
第八方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机指令,该计算机指令指示该计算机设备执行上述第二方面或者第二方面的各种可能实现提供的方法,或者该计算机指令指示该计算机设备部署上述第四方面或者第四方面的各种可能实现提供的数据库系统。In an eighth aspect, the present application provides a computer-readable storage medium having computer instructions stored in the computer-readable storage medium, and the computer instructions instruct the computer device to execute the above-mentioned second aspect or various possible implementations of the second aspect. The method or the computer instruction instructs the computer device to deploy the database system provided by the foregoing fourth aspect or various possible implementations of the fourth aspect.
第九方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器可以从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述第一方面或者第一方面的各种可能实现提供的方法,使得该计算机设备部署上述第三方面或者第三方面的各种可能实现提供的数据库系统。In a ninth aspect, this application provides a computer program product. 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 can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned first aspect or the methods provided by various possible implementations of the first aspect, so that the computer The device deploys the database system provided by the third aspect or various possible implementations of the third aspect.
第十方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器可以从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述第二方面或者第二方面的各种可能实现提供的方法,使得该计算机设备部署上述第四方面或者第四方面的各种可能实现提供的数据库系统。In a tenth aspect, the present application provides a computer program product. 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 can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned second aspect or the methods provided by various possible implementations of the second aspect, so that the computer The equipment deploys the database system provided by the foregoing fourth aspect or various possible implementations of the fourth aspect.
第十一方面,提供一种芯片,该芯片可以包括可编程逻辑电路和/或程序指令,当该芯片运行时用于实现如第一方面任一该的执行计划的处理方法。或者,当该芯片运行时用于实现如第二方面任一该的执行计划的处理方法。In an eleventh aspect, a chip is provided, the chip may include a programmable logic circuit and/or program instructions, and when the chip is running, it is used to implement the processing method of any execution plan as in the first aspect. Or, when the chip is running, it is used to implement the processing method of any one of the execution plans as in the second aspect.
本申请实施例提供的技术方案带来的有益效果是:The beneficial effects brought about by the technical solutions provided by the embodiments of the present application are:
本申请实施例在分析到第一执行计划的性能劣化后,会采用第二执行计划替换第一执行计划,以避免数据库使用性能劣化的第一执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。可选地,该第二执行计划的性能优于第一执行计划的性能,从而有效保证数据库的性能。After analyzing the performance degradation of the first execution plan, the embodiment of the application will replace the first execution plan with the second execution plan to avoid the use of the degraded first execution plan for the database and reduce the impact of the degraded execution plan on the database , So as to ensure the performance of the database. Optionally, the performance of the second execution plan is better than the performance of the first execution plan, thereby effectively ensuring the performance of the database.
本申请实施例在新版本的第二执行计划的性能优于第一执行计划的性能时,数据库系统才执行第二执行计划来替换对第一执行计划的执行,以避免数据库采用性能劣化的新版本的执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。并且,由于该第二执行计划的性能优于第一执行计划的性能,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。In the embodiments of this application, when the performance of the new version of the second execution plan is better than the performance of the first execution plan, the database system executes the second execution plan to replace the execution of the first execution plan, so as to prevent the database from adopting new performance degradation The version of the execution plan reduces the impact of the degraded execution plan on the database, thereby ensuring the performance of the database. In addition, since the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
附图说明Description of the drawings
图1是本申请实施例提供的执行计划的处理方法所涉及数据库系统的一种应用环境的示意图;FIG. 1 is a schematic diagram of an application environment of a database system involved in a method for processing an execution plan provided by an embodiment of the present application;
图2是本申请实施例提供的一种执行计划的处理方法的流程示意图;FIG. 2 is a schematic flowchart of a method for processing an execution plan provided by an embodiment of the present application;
图3是本申请实施例提供一示意性的数据库系统中数据流向示意图;FIG. 3 is a schematic diagram of data flow in an exemplary database system provided by an embodiment of the present application; FIG.
图4是本申请实施例提供的一种第一运行指标的性能基线的示意图;FIG. 4 is a schematic diagram of a performance baseline of a first operating index provided by an embodiment of the present application;
图5是本申请实施例提供的一种第一运行指标数据组的性能曲线与第一运行指标的性能基线的比较场景示意图;FIG. 5 is a schematic diagram of a comparison scenario between a performance curve of a first operating indicator data set and a performance baseline of the first operating indicator according to an embodiment of the present application;
图6是本申请实施例提供的一种第一运行指标数据组的数值点与第一运行指标的性能基线的比较场景示意图;6 is a schematic diagram of a comparison scenario between the numerical points of the first operating index data set and the performance baseline of the first operating index provided by an embodiment of the present application;
图7是本申请实施例提供的一种示意性的用户界面的示意图;FIG. 7 is a schematic diagram of a schematic user interface provided by an embodiment of the present application;
图8是本申请实施例提供的一种数据库系统的结构示意图;FIG. 8 is a schematic structural diagram of a database system provided by an embodiment of the present application;
图9是本申请实施例提供的一种执行计划的处理方法的流程示意图;FIG. 9 is a schematic flowchart of a method for processing an execution plan provided by an embodiment of the present application;
图10是本申请实施例提供的一种数据库系统的框图;FIG. 10 is a block diagram of a database system provided by an embodiment of the present application;
图11是本申请实施例提供的另一种数据库系统的框图;FIG. 11 is a block diagram of another database system provided by an embodiment of the present application;
图12是本申请实施例提供的又一种数据库系统的框图;FIG. 12 is a block diagram of another database system provided by an embodiment of the present application;
图13是本申请实施例提供的再一种数据库系统的框图;FIG. 13 is a block diagram of still another database system provided by an embodiment of the present application;
图14是本申请另一实施例提供的一种数据库系统的框图;FIG. 14 is a block diagram of a database system provided by another embodiment of the present application;
图15是本申请实施例提供的一种计算机设备的框图。Fig. 15 is a block diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和原理更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the purpose, technical solutions, and principles of the present application clearer, the implementation manners of the present application will be further described in detail below with reference to the accompanying drawings.
图1是本申请实施例提供的执行计划的处理方法所涉及数据库系统(Database System,DBS)10的一种应用环境的示意图。该数据库系统10可以为一个服务器或者由多个服务器组成的服务器集群。该数据库系统包括数据库管理系统(Database Management System,DBMS)和至少一个数据库(Database,DB)(图1未示出)。在该数据库系统中,应用程序可以通过数据库管理系统对数据库进行透明操作,数据库中的数据由数据库管理系统进行管理。FIG. 1 is a schematic diagram of an application environment of a database system (DBS) 10 involved in a method for processing an execution plan provided by an embodiment of the present application. The database system 10 may be a server or a server cluster composed of multiple servers. The database system includes a database management system (Database Management System, DBMS) and at least one database (Database, DB) (not shown in FIG. 1). In this database system, the application program can transparently operate the database through the database management system, and the data in the database is managed by the database management system.
可选地,前述数据库可以为关系型数据库(relational database),关系型数据库是指采用 了关系模型来组织数据的数据库。其以行和列的形式存储数据。每个关系模型可以称为一个关系表。根据存储原理的不同,关系型数据库可以分为分布式关系型数据库和非分布式关系型数据库。Optionally, the aforementioned database may be a relational database, which refers to a database that uses a relational model to organize data. It stores data in the form of rows and columns. Each relational model can be called a relational table. According to different storage principles, relational databases can be divided into distributed relational databases and non-distributed relational databases.
其中,数据库系统10包括:管理节点(也称查询引擎、SQL引擎、数据库引擎或协调数据节点,coordinator)101、多个数据节点102和优化节点103。数据库系统10可以包括一个或多个管理节点101,每个管理节点101属于一个数据库,管理节点101用于管理相应数据库中的数据节点102。The database system 10 includes: a management node (also called a query engine, a SQL engine, a database engine or a coordinator) 101, a plurality of data nodes 102, and an optimization node 103. The database system 10 may include one or more management nodes 101, each management node 101 belongs to a database, and the management node 101 is used to manage the data nodes 102 in the corresponding database.
本申请实施例中,管理节点101可以为单独的一个节点,或者多个数据节点102中指定数据节点或者选举得到的数据节点,其可以为一个服务器或者由多个服务器组成的服务器集群。管理节点101用于在接收到应用程序发送的SQL语句后,生成该SQL语句的执行计划,以控制管理节点101所管理的数据节点执行该执行计划。其中,执行计划用于指示执行的动作,以及执行动作的先后顺序等。也即是在什么时候做什么动作等。In the embodiment of the present application, the management node 101 may be a single node, or a designated data node among multiple data nodes 102 or a data node obtained by election, and it may be a server or a server cluster composed of multiple servers. The management node 101 is configured to generate an execution plan of the SQL statement after receiving the SQL statement sent by the application program, so as to control the data node managed by the management node 101 to execute the execution plan. Among them, the execution plan is used to indicate the actions to be executed and the sequence of actions to be executed. In other words, when to do something and so on.
该优化节点103用于对管理节点101进行执行计划的干预(也称优化)。The optimization node 103 is used to intervene in the execution plan of the management node 101 (also called optimization).
在一种实现方式中,每个数据节点可以为一个服务器或者由多个服务器组成的服务器集群;在另一实现方式中,每个数据节点表征数据库系统的一个设定的最小处理单元。示例的,每个数据节点可以为一个虚拟机或一个容器,其管理和/或存储数据的一个应用实例或一个数据库执行进程。In one implementation, each data node may be a server or a server cluster composed of multiple servers; in another implementation, each data node represents a set minimum processing unit of the database system. For example, each data node may be a virtual machine or a container, an application instance or a database execution process that manages and/or stores data.
需要说明的是,优化节点103可以集成在管理节点101上,示例的,数据库系统中的每个管理节点101上可以集成一个优化节点103,或者,数据库系统中的指定的管理节点101上可以集成一个优化节点103。优化节点103也可以独立设置在管理节点101之外,当优化节点103设置在管理节点101之外时,管理节点101提供接口,以供优化节点103对管理节点101的执行计划进行干预。当优化节点103独立设置在管理节点101之外,可以减少对管理节点101性能的影响。It should be noted that the optimization node 103 can be integrated on the management node 101. For example, each management node 101 in the database system can be integrated with an optimization node 103, or the designated management node 101 in the database system can be integrated An optimized node 103. The optimization node 103 can also be independently set outside the management node 101. When the optimization node 103 is set outside the management node 101, the management node 101 provides an interface for the optimization node 103 to intervene in the execution plan of the management node 101. When the optimization node 103 is independently arranged outside the management node 101, the impact on the performance of the management node 101 can be reduced.
图2是本申请实施例提供的一种执行计划的处理方法的流程示意图。该方法可以由前述数据库系统10执行。后续实施例以对一个管理节点进行执行计划干预为例进行说明,假设该管理节点为第一管理节点,与该第一管理节点对应的数据库为第一数据库,对其他管理节点进行执行计划干预的过程可以参考对该第一管理节点进行执行计划干预的过程。如图2所示,该执行计划的处理方法(即干预过程)包括:Fig. 2 is a schematic flowchart of a method for processing an execution plan provided by an embodiment of the present application. This method can be executed by the aforementioned database system 10. Subsequent embodiments take the execution plan intervention of a management node as an example for description. It is assumed that the management node is the first management node, the database corresponding to the first management node is the first database, and the execution plan intervention is performed on other management nodes. The process can refer to the process of performing execution plan intervention on the first management node. As shown in Figure 2, the processing method (ie intervention process) of the execution plan includes:
步骤201、数据库系统执行SQL语句的第一执行计划。Step 201: The database system executes the first execution plan of the SQL statement.
用户需要对第一数据库进行数据操作(如数据查询操作)时,可以通过应用程序向第一管理节点输入SQL语句,第一管理节点在接收到该SQL语句后,会根据第一数据库的优化规则(rule based on optimizer,RBO)信息和/或优化成本(cost based on optimizer,CBO)信息来生成执行计划,并在生成该执行计划之后的一段时间内一直沿用该执行计划。When users need to perform data operations (such as data query operations) on the first database, they can input SQL statements to the first management node through the application. After receiving the SQL statements, the first management node will follow the optimization rules of the first database (rule based on optimizer, RBO) information and/or cost based on optimizer (CBO) information to generate an execution plan, and continue to use the execution plan for a period of time after the execution plan is generated.
其中,优化规则信息可以包括分区表(table partition)的信息和/或可靠性指标(available indices)。The optimization rule information may include table partition information and/or reliability indicators (available indicators).
数据库具有分区功能时,将关系表划分为称为分区的多个子集,每个子集即为一个分区表。例如,当关系表中的记录个数超过指定记录个数阈值,即将关系表划分为多个分区表。该分区表的划分规则可以包括:按照入库日期划分和/或按照所在地划分等。例如,按照所在地将关系表中的数据划分得到的分区表包括:上海对应的分区表和北京对应的分区表。When the database has the partition function, the relational table is divided into multiple subsets called partitions, and each subset is a partition table. For example, when the number of records in the relationship table exceeds the specified record number threshold, the relationship table is divided into multiple partition tables. The partitioning rules of the partition table may include: partitioning according to storage date and/or partitioning according to location, etc. For example, the partition table obtained by dividing the data in the relational table according to the location includes: a partition table corresponding to Shanghai and a partition table corresponding to Beijing.
可靠性指标为用于反映数据库的可靠性的指标,当数据库中的数据超出可靠性指标所指定的范围,数据库会出现不稳定的情况,也即是数据库不再可靠。例如,可靠性指标可以包括:允许中断时长和/或输入/输出(input/output,IO)上限。当数据库中的管理节点生成SQL语句的执行计划的时长超过该允许中断时长,或者,数据库中的管理节点生成SQL语句的可执行计划的IO次数超过IO上限,数据库会可能出现用户可察觉的业务中断,数据库系统出现损失。The reliability index is an index used to reflect the reliability of the database. When the data in the database exceeds the range specified by the reliability index, the database will become unstable, that is, the database is no longer reliable. For example, the reliability index may include: allowable interruption duration and/or input/output (input/output, IO) upper limit. When the execution plan of the SQL statement generated by the management node in the database exceeds the allowable interruption time, or the number of IOs of the executable plan of the SQL statement generated by the management node in the database exceeds the IO limit, the database may have services that can be noticed by the user. Interruption, loss of the database system.
优化成本信息可以包括数据库的统计信息。统计信息用于反映对应数据库的关系表的数据分布情况。例如表内不同类型的数据的分布比例,或者,不同类型的数据存储(或者主要存储)在哪些数据节点等。例如,第一数据库的关系表记录有索引为“男”和“女”的数据,该第一数据库的统计信息可以包括索引为“男”和“女”的数据在所有数据中的比例以及主要存储在哪些数据节点。其中,主要存储在哪些数据节点指的是大于指定阈值的数据存储在哪些数据节点。The optimization cost information may include statistical information of the database. The statistical information is used to reflect the data distribution of the relational table of the corresponding database. For example, the distribution ratio of different types of data in the table, or the data nodes where different types of data are stored (or mainly stored), etc. For example, the relational table of the first database records data indexed as "male" and "female", and the statistical information of the first database may include the proportion of data indexed as "male" and "female" in all data and the main Which data nodes are stored in. Among them, which data nodes are mainly stored in refers to which data nodes are stored in which data greater than a specified threshold is stored.
本申请实施例假设步骤201中的SQL语句为输入第一管理节点的SQL语句,第一执行计划是第一管理节点基于该SQL语句生成的执行计划。则数据库系统执行该SQL语句的第一执行计划指的是第一管理节点控制其管理的数据节点执行该第一执行计划。In the embodiment of the present application, it is assumed that the SQL statement in step 201 is an SQL statement input to the first management node, and the first execution plan is an execution plan generated by the first management node based on the SQL statement. Then the first execution plan for the database system to execute the SQL statement refers to that the first management node controls the data node it manages to execute the first execution plan.
可选地,数据库系统在生成并执行第一执行计划后,会记录该第一执行计划,以供第一数据库在后续一段时间沿用该第一执行计划。Optionally, after the database system generates and executes the first execution plan, it records the first execution plan so that the first database can continue to use the first execution plan in a subsequent period of time.
图3是本申请实施例提供一示意性的数据库系统中数据流向示意图。假设优化节点103独立于第一管理节点101a设置。第一管理节点101a在生成第一执行计划后,控制所管理的数据节点执行该第一执行计划(即使用该第一执行计划),被执行后的第一执行计划存储在系统表1042中,系统表1042中存储的执行计划可以同步至指标数据库1041,优化节点103可以从指标数据库1041中获取第一执行计划,并检测第一执行计划的性能是否劣化。FIG. 3 is a schematic diagram of data flow in a schematic database system provided by an embodiment of the present application. It is assumed that the optimization node 103 is set independently of the first management node 101a. After generating the first execution plan, the first management node 101a controls the managed data node to execute the first execution plan (that is, use the first execution plan), and the executed first execution plan is stored in the system table 1042, The execution plan stored in the system table 1042 can be synchronized to the index database 1041, and the optimization node 103 can obtain the first execution plan from the index database 1041, and detect whether the performance of the first execution plan is degraded.
可选地,该系统表用于记录数据库系统中当前使用(或称当前时段使用)的执行计划。该当前使用的执行计划指的是该执行计划首次被执行后持续被沿用(也即是未被替换掉)。由于数据库系统中的数据库可能有多个。在一种可选实现方式中,多个数据库可以分别对应设置系统表;在另一种可选实现方式中,多个数据库可以共用系统表。以第一数据库为例,对应的系统表记录了第一数据库当前使用的执行计划。由于第一管理节点近期获取的SQL语句可以有多个,每个SQL语句对应的当前使用的执行计划的数量为一个。因此,系统表记录了该第一管理节点的多个SQL语句的一一对应的多个执行计划,该多个执行计划包括该第一执行计划。第一管理节点在下次需要重复使用之前已执行的执行计划(也即是沿用该执行计划)时,会查询该系统表,以获取所需的执行计划。Optionally, the system table is used to record the execution plan currently used (or called the current time period) in the database system. The currently used execution plan refers to that the execution plan continues to be used after being executed for the first time (that is, it is not replaced). Because there may be multiple databases in the database system. In an optional implementation manner, multiple databases may respectively set system tables corresponding to each other; in another optional implementation manner, multiple databases may share system tables. Taking the first database as an example, the corresponding system table records the execution plan currently used by the first database. Since there may be multiple SQL statements recently acquired by the first management node, the number of currently used execution plans corresponding to each SQL statement is one. Therefore, the system table records a one-to-one corresponding multiple execution plans of multiple SQL statements of the first management node, and the multiple execution plans include the first execution plan. When the first management node needs to reuse the previously executed execution plan next time (that is, the execution plan is inherited), the first management node queries the system table to obtain the required execution plan.
可选地,系统表1042中存储的执行计划可以周期性同步至指标数据库1041;或者,在系统表1042中存储的执行计划存在更新时,系统表1042中存储的执行计划同步(即全量同步)至指标数据库1041;或者,在系统表1042中存储的执行计划存在更新时,系统表1042中更新的执行计划同步(即增量同步)至指标数据库1041。Optionally, the execution plan stored in the system table 1042 can be periodically synchronized to the indicator database 1041; or, when the execution plan stored in the system table 1042 is updated, the execution plan stored in the system table 1042 is synchronized (ie, full synchronization) To the index database 1041; or, when there is an update to the execution plan stored in the system table 1042, the updated execution plan in the system table 1042 is synchronized (that is, incremental synchronization) to the index database 1041.
与前述系统表1042的设置方式同理的,由于数据库系统中的数据库有多个。在一种可选实现方式中,多个数据库可以分别对应设置指标数据库;在另一种可选实现方式中,多个数据库可以共用指标数据库。以第一数据库为例,对应的指标数据库记录了第一管理节点的系统表每次同步的执行计划。该指标数据库至少包括第一管理节点的历史执行计划,还可以包 括第一数据库当前使用的执行计划,该历史执行计划为使用时段位于当前使用的执行计划的使用时段之前的执行计划。例如,对于SQL语句的第一执行计划,其对应的历史执行计划为在生成第一执行计划之前已存在的该SQL语句的其他执行计划。该指标数据库是否包括第一数据库当前使用的执行计划,受到第一数据库表向指标数据库同步执行计划的频率的影响。通常情况下,指标数据库记录有第一管理节点所有已执行的执行计划(包括历史执行计划以及当前使用的执行计划)。假设指标数据库记录有第一管理节点所有已执行过的执行计划。由于第一管理节点近期获取的SQL语句可以有多个,每个SQL语句对应的所有已执行的执行计划的数量为至少一个。因此,指标数据库记录了该第一管理节点的多个SQL语句的一一对应的多个执行计划组,每个执行计划组包括对应的SQL语句的至少一个执行计划。It is the same as the setting method of the aforementioned system table 1042, because there are multiple databases in the database system. In an optional implementation manner, multiple databases may be correspondingly provided with index databases; in another optional implementation manner, multiple databases may share the index database. Taking the first database as an example, the corresponding indicator database records the execution plan for each synchronization of the system table of the first management node. The indicator database includes at least the historical execution plan of the first management node, and may also include the execution plan currently used by the first database, and the historical execution plan is an execution plan whose use period is before the use period of the currently used execution plan. For example, for the first execution plan of the SQL statement, the corresponding historical execution plan is other execution plans of the SQL statement that existed before the first execution plan was generated. Whether the indicator database includes the execution plan currently used by the first database is affected by the frequency with which the first database table synchronizes the execution plan with the indicator database. Generally, the indicator database records all executed execution plans (including historical execution plans and currently used execution plans) of the first management node. Assume that the indicator database records all execution plans that have been executed by the first management node. Since there may be multiple SQL statements recently acquired by the first management node, the number of all executed execution plans corresponding to each SQL statement is at least one. Therefore, the index database records multiple execution plan groups corresponding to multiple SQL statements of the first management node, and each execution plan group includes at least one execution plan of the corresponding SQL statement.
在一种可选方式中,优化节点可以从指标数据库1041获取SQL语句的第一执行计划。例如,在指标数据库1041中的第一管理节点的SQL语句对应的执行计划组(该执行计划组包括一个或多个执行计划)中,获取最新的执行计划作为第一执行计划。该最新的执行计划为同步时刻距当前时刻最近的执行计划。In an optional manner, the optimization node may obtain the first execution plan of the SQL statement from the index database 1041. For example, in the execution plan group corresponding to the SQL statement of the first management node in the index database 1041 (the execution plan group includes one or more execution plans), the latest execution plan is acquired as the first execution plan. The latest execution plan is the execution plan with the synchronization time closest to the current time.
在另一种可选方式中,优化节点可以从系统表1042获取SQL语句的第一执行计划。例如,将系统表1042记录的第一管理节点的SQL语句对应的执行计划作为第一执行计划。In another optional manner, the optimization node may obtain the first execution plan of the SQL statement from the system table 1042. For example, the execution plan corresponding to the SQL statement of the first management node recorded in the system table 1042 is taken as the first execution plan.
需要说明的是,数据库系统当前使用的执行计划以及历史执行计划的存储方式还可以有其他方式。图3仅以当前使用的执行计划存储在系统表,历史执行计划存储在指标数据库为例进行说明,但并不对此进行限制。只要保证数据库系统能够有效区分和获取当前使用的执行计划以及历史执行计划即可。并且,图3中示意性地以系统表存储在一个数据库中为例进行说明,该系统表的存储方式还可以有其他方式,本申请实施例对此不做限定。It should be noted that the execution plan currently used by the database system and the storage method of the historical execution plan can also be stored in other ways. Figure 3 only takes the currently used execution plan stored in the system table and the historical execution plan stored in the indicator database as an example for illustration, but it does not limit this. As long as it is ensured that the database system can effectively distinguish and obtain the currently used execution plan and historical execution plan. In addition, FIG. 3 schematically takes the system table stored in a database as an example for description, and the storage method of the system table may also have other methods, which are not limited in the embodiment of the present application.
值得说明的是,数据库系统中生成但未被执行的计划也可以记录在指标数据库1041中,如此可以实现对数据库系统中的执行计划的监控,便于对数据库系统的性能进行分析。It is worth noting that the plans generated in the database system but not executed can also be recorded in the index database 1041, so that the execution plan in the database system can be monitored, and the performance of the database system can be easily analyzed.
步骤202、数据库系统分析SQL语句的第一执行计划的性能是否劣化。Step 202: The database system analyzes whether the performance of the first execution plan of the SQL statement has deteriorated.
由于软硬件环境变更(如扩容或内核升级新版本等)或数据库异常,可能导致第一管理节点当前使用的第一执行计划比之前使用的执行计划的性能要差,导致SQL语句的性能下降,甚至整个第一数据库性能的下降。在这种情况下,数据库系统(如优化节点)可以通过分析SQL语句的第一执行计划的性能是否劣化来确定是否进行第一执行计划的干预,以恢复SQL语句的性能。该分析SQL语句的第一执行计划的性能是否劣化的过程,包括:Due to changes in the software and hardware environment (such as capacity expansion or kernel upgrades to new versions, etc.) or database abnormalities, the performance of the first execution plan currently used by the first management node may be worse than that of the previous execution plan, resulting in a decrease in the performance of SQL statements. Even the performance of the entire first database has dropped. In this case, the database system (such as an optimization node) can determine whether to intervene in the first execution plan by analyzing whether the performance of the first execution plan of the SQL statement has deteriorated, so as to restore the performance of the SQL statement. The process of analyzing whether the performance of the first execution plan of the SQL statement has deteriorated includes:
步骤A1、数据库系统分析第一执行计划的运行指标是否异常。执行步骤A2或步骤A3。Step A1. The database system analyzes whether the operation index of the first execution plan is abnormal. Perform step A2 or step A3.
运行指标用于反映对应的执行计划的运行效果,也可以反映对应的SQL语句的性能。通过第一执行计划的运行指标可以确定第一执行计划的性能。示例的,第一执行计划的运行指标包括以下的一种或多种:SQL语句的IO指标、时延(delay)、错误(error)信息、执行次数和处理时长。The running index is used to reflect the running effect of the corresponding execution plan, and can also reflect the performance of the corresponding SQL statement. The performance of the first execution plan can be determined through the operation indicators of the first execution plan. For example, the operation indicators of the first execution plan include one or more of the following: IO indicators, delay (delay), error (error) information, execution times, and processing duration of the SQL statement.
其中,IO指标指的是;执行计划被执行所产生的IO次数;时延指的是执行计划被执行所产生的时延;错误信息指的是;执行计划被执行所产生的错误的内容,和/或,执行计划被执行所产生的不同类型的错误在产生的整体错误中的占比,也即是每种类型的错误的个数与整体错误个数的比值;执行次数指的是执行计划被执行的次数;处理时长可以为执行计划被执行时占用处理器的时长,例如占用中央处理器(CPU,central processing unit)的处理时长,该占用CPU的处理时长称为CPU时长(CPU time)。Among them, the IO indicator refers to; the number of IOs generated when the execution plan is executed; the delay refers to the delay caused by the execution of the execution plan; the error message refers to the content of the error caused by the execution of the execution plan, And/or, the percentage of different types of errors caused by the execution of the execution plan in the overall errors generated, that is, the ratio of the number of each type of error to the number of overall errors; the number of executions refers to the execution The number of times the plan is executed; the processing time can be the time that the execution plan occupies the processor when the execution plan is executed, such as the processing time of the central processing unit (CPU). The processing time of the CPU is called the CPU time (CPU time). ).
可选地,数据库系统可以周期性分析运行指标是否出现异常。示例的,该分析周期的范围为1分钟至10分钟。Optionally, the database system can periodically analyze whether the operating indicators are abnormal. For example, the analysis period ranges from 1 minute to 10 minutes.
数据库系统(例如优化节点)可以在该数据库系统中的每个数据库所在主机(也称数据库主机)上布置代理(agent)模块,每个代理模块用于监测所部署的数据库主机上的运行指标对应的数据。示例的,每个代理模块可以采集所部署的数据库主机上的运行指标对应的数据,并周期性地将采集到数据发送至管理代理模块的节点,如优化节点。示例的,前述运行指标对应的数据的发送周期的范围为5秒至10分钟。A database system (such as an optimized node) can deploy an agent module on the host (also known as the database host) where each database in the database system is located, and each agent module is used to monitor the corresponding running indicators on the deployed database host The data. For example, each agent module may collect data corresponding to the operating indicators on the deployed database host, and periodically send the collected data to a node of the management agent module, such as an optimization node. For example, the range of the sending period of the data corresponding to the aforementioned operating indicators is 5 seconds to 10 minutes.
第一执行计划的运行指标可以有一个或多个,第一执行计划的运行指标中,每个运行指标与一个运行指标数据组对应,该运行指标数据组通常包括对应的运行指标的多个数据,该多个数据通常是在指定时长内采集的数据。例如,该指定时长为一天;该多个数据还可以是以指定采样间隔采集的数据。例如,该指定采样间隔为1秒。第一执行计划的运行指标中,每个运行指标还与一个历史运行指标数据组对应。There may be one or more operating indicators of the first execution plan. In the operating indicators of the first execution plan, each operating indicator corresponds to an operating indicator data group. The operating indicator data group usually includes multiple data of corresponding operating indicators. , The multiple data are usually data collected within a specified period of time. For example, the specified duration is one day; the multiple data may also be data collected at specified sampling intervals. For example, the specified sampling interval is 1 second. In the operating indicators of the first execution plan, each operating indicator also corresponds to a historical operating indicator data group.
对于对应于同一运行指标的历史运行指标数据组和运行指标数据组,该历史运行指标数据组对应的采集时长(即采集数据组中的数据所对应的采集时长)与该运行指标数据组的采集时长相同,历史运行指标数据组的获取时段在运行执行数据组的获取时段之前。例如,两者的数据采集时长均为1天。可选地,该历史运行指标数据组中的数据个数与该运行指标数据组中的数据个数相同。例如,该历史运行指标数据组中的数据个数与该运行指标数据组中的数据个数均为1万个;可选地,该历史运行指标数据组中的数据与该运行指标数据组中的数据的获取时刻一一对应。例如,该历史运行指标数据组中的数据与该运行指标数据组中的数据均为一天之内以相同的采样间隔获取的,则示例的,历史运行指标数据组中9:00采样得到的数据与运行指标数据组中9:00采样得到的数据对应,历史运行指标数据组中9:01采样得到的数据与运行指标数据组中9:01采样得到的数据对应。For the historical operating indicator data group and operating indicator data group corresponding to the same operating indicator, the collection time corresponding to the historical operating indicator data group (that is, the collection time corresponding to the data in the collected data group) and the collection of the operating indicator data group The duration is the same, and the acquisition period of the historical operation indicator data group is before the acquisition period of the operation execution data group. For example, the data collection time of both is 1 day. Optionally, the number of data in the historical operating indicator data group is the same as the number of data in the operating indicator data group. For example, the number of data in the historical operating indicator data group and the number of data in the operating indicator data group are both 10,000; optionally, the data in the historical operating indicator data group and the data in the operating indicator data group There is a one-to-one correspondence between the acquisition moments of the data. For example, the data in the historical operating indicator data group and the data in the operating indicator data group are both acquired at the same sampling interval within one day. For example, the data in the historical operating indicator data group is sampled at 9:00 Corresponding to the data sampled at 9:00 in the operating indicator data group, the data sampled at 9:01 in the historical operating indicator data group corresponds to the data sampled at 9:01 in the operating indicator data group.
本申请实施例中,数据库系统分析第一执行计划的运行指标是否异常的过程可以包括:In the embodiment of the present application, the process of analyzing whether the operation index of the first execution plan is abnormal by the database system may include:
步骤A11、对于第一执行计划的运行指标中的每个运行指标,将该运行指标对应的运行指标数据组与对应的历史运行指标数据组对比,来确定每个运行指标是否异常。Step A11: For each operating indicator in the operating indicators of the first execution plan, compare the operating indicator data group corresponding to the operating indicator with the corresponding historical operating indicator data group to determine whether each operating indicator is abnormal.
步骤A12、基于每个运行指标的异常判定结果,确定第一执行计划的运行指标(即第一执行计划整体的运行指标)是否异常。Step A12: Based on the abnormality determination result of each operation index, determine whether the operation index of the first execution plan (that is, the overall operation index of the first execution plan) is abnormal.
在前述步骤A11中,为了便于描述,假设第一运行指标为所述第一执行计划的运行指标中一个运行指标,第一运行指标对应的运行指标数据组为第一运行指标数据组,第一运行指标对应的历史运行指标数据组为第一历史运行指标数据组,则确定第一运行指标是否异常的过程可以包括以下两种实现方式:In the foregoing step A11, for ease of description, it is assumed that the first operating indicator is one of the operating indicators of the first execution plan, the operating indicator data set corresponding to the first operating indicator is the first operating indicator data set, and the first operating indicator is the first operating indicator. The historical operating indicator data group corresponding to the operating indicator is the first historical operating indicator data group, and the process of determining whether the first operating indicator is abnormal may include the following two implementation methods:
第一种可实现方式,当第一运行指标数据组指示的性能低于第一历史运行指标数据组指示的性能,数据库系统确定该第一运行指标出现异常;当第一运行指标数据组指示的性能不低于第一历史运行指标数据组指示的性能,数据库系统确定该第一运行指标未出现异常(也即是正常)。In the first possible implementation manner, when the performance indicated by the first operating index data set is lower than the performance indicated by the first historical operating indicator data set, the database system determines that the first operating indicator is abnormal; when the first operating indicator data set indicates The performance is not lower than the performance indicated by the first historical operation index data group, and the database system determines that the first operation index is not abnormal (that is, normal).
可选地,数据库系统分析第一运行指标数据组指示的性能低于第一历史运行指标数据组指示的性能的方式有多种。本申请实施例以以下两种方式为例进行说明:Optionally, there are multiple ways for the database system to analyze that the performance indicated by the first operating indicator data set is lower than the performance indicated by the first historical operating indicator data set. The embodiments of this application are described in the following two ways as examples:
第一种方式,数据库系统基于指定比较规则将第一运行指标数据组与第一历史运行指标数据组进行比较,以检测第一运行指标数据组指示的性能是否低于第一历史运行指标数据组 指示的性能。In the first method, the database system compares the first operating index data set with the first historical operating indicator data set based on a specified comparison rule to detect whether the performance indicated by the first operating indicator data set is lower than the first historical operating indicator data set Indicated performance.
示例的,数据库系统维护有专家经验库,该专家经验库记载有基于专家经验确定的至少一个指定比较规则,数据库系统基于该指定比较规则,进行第一运行指标数据组与第一历史运行指标数据组的比较。For example, the database system maintains an expert experience database. The expert experience database records at least one specified comparison rule determined based on expert experience. Based on the specified comparison rule, the database system performs the first operation index data set and the first historical operation index data Group comparison.
例如,该至少一个指定比较规则包括同比比较规则和/或环比比较规则,其中,环比比较规则,表示获取历史运行指标数据组与运行指标数据组的环比变化,采用该比较规则,可以基于环比下降率公式获取环比下降率。例如,该环比下降率公式包括:For example, the at least one specified comparison rule includes a year-on-year comparison rule and/or a chain comparison rule, where the chain comparison rule means obtaining a chain change between the historical operation index data group and the operation index data group. The comparison rule can be based on the chain decrease The rate formula obtains the month-on-month decline rate. For example, the formula for the month-on-month decline rate includes:
环比下降率=(运行指标数据组-历史运行指标数据组)/历史运行指标数据组×100%。Momentum drop rate=(operation index data group-historical operation index data group)/historical operation index data group×100%.
同比比较规则,表示获取历史运行指标数据组与运行指标数据组的同比变化,采用该比较规则,可以基于同比下降率公式获取同比下降率。例如,该同比下降率公式包括:The year-on-year comparison rule means obtaining the year-on-year changes between the historical operation index data group and the operation index data group. Using this comparison rule, the year-on-year decline rate can be obtained based on the year-on-year decline rate formula. For example, the year-on-year decline rate formula includes:
同比下降率=(运行指标数据组-历史运行指标数据组)/|历史运行指标数据组|×100%。Year-on-year decline rate = (operation index data group-historical operation index data group)/|historical operation index data group|×100%.
示例的,当环比下降率大于第一比例阈值和/或同比下降率大于第二比例阈值,确定第一运行指标数据组指示的性能低于第一历史运行指标数据组指示的性能。For example, when the month-on-month decline rate is greater than the first proportion threshold and/or the year-on-year decline rate is greater than the second proportion threshold, it is determined that the performance indicated by the first operating indicator data set is lower than the performance indicated by the first historical operating indicator data set.
第二种方式,数据库系统通过将第一运行指标数据组的性能曲线与第一运行指标的性能基线进行比较,以检测第一运行指标数据组指示的性能是否低于第一历史运行指标数据组指示的性能。该过程如下:In the second way, the database system compares the performance curve of the first operating indicator data set with the performance baseline of the first operating indicator to detect whether the performance indicated by the first operating indicator data set is lower than the first historical operating indicator data set Indicated performance. The process is as follows:
步骤A111、数据库系统确定第一运行指标的性能基线(baseline)。Step A111: The database system determines a performance baseline of the first operating index.
该第一运行指标的性能基线是基于历史运行指标数据组中的数据建立的用于反映SQL语句的关于第一运行指标的性能的基线。可选地,数据库系统可以基于第二人工智能模型以及第一历史运行指标数据组,生成该SQL语句的第一运行指标的性能基线。The performance baseline of the first operating indicator is a baseline established based on the data in the historical operating indicator data group and used to reflect the performance of the SQL statement with respect to the first operating indicator. Optionally, the database system may generate a performance baseline of the first operating indicator of the SQL statement based on the second artificial intelligence model and the first historical operating indicator data set.
在第一种可选方式中,数据库系统可以获取SQL语句的该第一运行指标的备选运行指标数据组,该备选运行指标数据组包括的数据的数量大于或等于第一历史运行指标数据组中的数据的数量;数据库系统再基于获取的第一运行指标的备选运行指标数据组,确定历史运行指标数据组;最后,数据库系统将第一历史运行指标数据组输入第二人工智能模型,由第二人工智能模型生成SQL语句的第一运行指标的性能基线。In the first optional manner, the database system may obtain the candidate operating index data set of the first operating indicator of the SQL statement, and the number of data included in the candidate operating indicator data set is greater than or equal to the first historical operating indicator data The number of data in the group; the database system then determines the historical operation index data group based on the obtained candidate operation index data group of the first operation index; finally, the database system inputs the first historical operation index data group into the second artificial intelligence model , The second artificial intelligence model generates the performance baseline of the first operating indicator of the SQL statement.
可选地,数据库系统基于获取的该第一运行指标的备选运行指标数据组,确定第一历史运行指标数据组的方式可以有如下几种:Optionally, the database system may determine the first historical operation index data group in the following ways based on the obtained candidate operation index data group of the first operation index:
第一种:在备选运行指标数据组中筛选目标采集时长的数据,以得到第一历史运行指标数据组。该目标采集时长的数据可以是在备选运行指标数据组中随机筛选的,也可以是通过滑窗在备选运行指标数据组中筛选得到的对应性能最优的数据,该滑窗的宽度可以为该目标采集时长对应宽度。The first type is to filter the target collection time data in the candidate operation index data group to obtain the first historical operation index data group. The target collection time data can be randomly selected in the candidate operating index data group, or it can be the data with the best corresponding performance filtered from the candidate operating indicator data group through a sliding window. The width of the sliding window can be The acquisition duration corresponds to the width of the target.
第二种:备选运行指标数据组包括M个目标采集时长的子数据组,将M个子数据组的平均数据确定为第一历史运行指标数据组,也即是,第一历史运行指标数据组中每个数据为M个子数据组中对应数据的均值。如,备选运行指标数据组包括4天的数据,目标采集时长为1天,则一个子数据组的数据为一天的数据,则将该4天的数据的平均数据作为第一历史运行指标数据组。The second type: The candidate operating index data group includes M sub-data groups of target collection time length, and the average data of the M sub-data groups is determined as the first historical operating indicator data group, that is, the first historical operating indicator data group Each data in is the mean value of corresponding data in M sub-data groups. For example, the candidate operating index data group includes 4 days of data, and the target collection time is 1 day, then the data of a sub-data group is one day of data, and the average data of the 4 days of data is used as the first historical operating index data Group.
值得说明的是,第一历史运行指标数据组还可以有其他确定方式,例如根据专家经验确定,本申请实施例只是对此示意性说明,并不进行限定。It is worth noting that the first historical operation index data group may also have other determination methods, for example, determination based on expert experience. The embodiment of the present application merely illustrates this schematically and does not limit it.
在第二种可选方式中,数据库系统可以获取SQL语句的第一运行指标的备选运行指标数 据组,该备选运行指标数据组包括的数据的数量大于或等于历史运行指标数据组中的数据的数量;数据库系统将获取的第一运行指标的备选运行指标数据组输入第二人工智能模型,由第二人工智能模型生成SQL语句的第一运行指标的性能基线。如此,第二人工智能模型先获取SQL语句的第一历史运行指标数据组,再生成运行指标的性能基线。In the second optional manner, the database system can obtain the candidate operating indicator data group of the first operating indicator of the SQL statement, and the number of data included in the candidate operating indicator data group is greater than or equal to that in the historical operating indicator data group. The amount of data; the database system inputs the acquired candidate operating indicator data set of the first operating indicator into the second artificial intelligence model, and the second artificial intelligence model generates the performance baseline of the first operating indicator of the SQL statement. In this way, the second artificial intelligence model first obtains the first historical operating indicator data set of the SQL statement, and then generates a performance baseline of the operating indicator.
通常第一执行计划的运行指标中的每个运行指标对应一个第二人工智能模型,对于第一运行指标,对应的第二人工智能模型可以由该第一运行指标的多个历史运行指标数据组作为训练样本训练得到。其中,对应于前述第一种可选方式,训练用的每个历史运行指标数据组中的数据的数量与历史运行指标数据组中的数据的数量相同;对应于前述第二种可选方式,训练用的每个历史运行指标数据组中的数据的数量与备选历史运行指标数据组中的数据的数量相同。Generally, each operating indicator in the operating indicators of the first execution plan corresponds to a second artificial intelligence model. For the first operating indicator, the corresponding second artificial intelligence model can be composed of multiple historical operating indicator data sets of the first operating indicator. Obtained as a training sample. Wherein, corresponding to the aforementioned first optional method, the number of data in each historical operating index data group used for training is the same as the number of data in the historical operating indicator data group; corresponding to the aforementioned second optional method, The quantity of data in each historical operation index data group used for training is the same as the quantity of data in the candidate historical operation index data group.
值得说明的是,前述SQL语句的第一历史运行指标数据组可以周期性更新或者在接收到更新指令后更新,第一性能指标的性能基线也相应更新。如此可以保证第一历史运行指标数据组可以更能反映SQL语句的第一性能指标的历史性能。It is worth noting that the first historical operation indicator data group of the aforementioned SQL statement may be updated periodically or after receiving an update instruction, and the performance baseline of the first performance indicator is also updated accordingly. In this way, it can be ensured that the first historical operation index data group can better reflect the historical performance of the first performance index of the SQL statement.
运行指标的性能基线由人工智能模型生成,在保证性能基线的准确性的基础上,还可以提高性能基线的获取效率。The performance baseline of the operating index is generated by the artificial intelligence model. On the basis of ensuring the accuracy of the performance baseline, the efficiency of obtaining the performance baseline can also be improved.
可选地,数据库系统还可以通过其他方式获取第一运行指标的性能基线,例如通过统计模型生成该性能基线,或者,通过人工绘制的方式获取该性能基线。Optionally, the database system may also obtain the performance baseline of the first operating index in other ways, for example, generating the performance baseline through a statistical model, or obtaining the performance baseline through manual drawing.
示例的,如图4所示,图4是本申请实施例提供的一种第一运行指标的性能基线的示意图。该性能基线可以位于二维坐标系中。例如,该性能基线包括高位线、低位线和中位线,其中,该二维坐标系中,横轴表示采集时刻,纵轴表示运行指标的数值大小。该高位线为基于第一历史运行指标数据组中的最大值确定的直线,其通常为经过该最大值的平行于横轴的直线;该低位线为基于第一历史运行指标数据组中的最小值确定的直线,其通常为经过该最小值的平行于横轴的直线;该中位线基于第一历史运行指标数据组中的数据确定的位于高位线和底线之间的直线,该中位线通常为经过该中位值的平行于横轴的直线,该中位值为第一历史运行指标数据组中的数据的平均值。As an example, as shown in FIG. 4, FIG. 4 is a schematic diagram of a performance baseline of a first operating index provided by an embodiment of the present application. The performance baseline can be located in a two-dimensional coordinate system. For example, the performance baseline includes a high-level line, a low-level line, and a median line. In the two-dimensional coordinate system, the horizontal axis represents the collection time, and the vertical axis represents the numerical value of the operating index. The high line is a straight line determined based on the maximum value in the first historical operating index data set, which is usually a straight line parallel to the horizontal axis passing through the maximum; the low line is based on the minimum value in the first historical operating indicator data set. A straight line determined by the value, which is usually a straight line parallel to the horizontal axis passing through the minimum; the median line is a straight line between the high line and the bottom line determined based on the data in the first historical operating index data set, the median The line is usually a straight line parallel to the horizontal axis passing through the median value, and the median value is the average value of the data in the first historical operating indicator data group.
值得说明的是,本申请实施例提供的一种运行指标的性能基线还可以有其他绘制方式,本申请实施例对此不做限定。It is worth noting that the performance baseline of an operating index provided in the embodiment of the present application may also have other drawing methods, which is not limited in the embodiment of the present application.
步骤A112、数据库系统确定第一运行指标数据组的性能曲线。执行步骤A113或步骤A114。Step A112: The database system determines the performance curve of the first operating index data group. Perform step A113 or step A114.
第一运行指标数据组在第一运行指标的性能基线所在坐标系中可以形成一个性能曲线。数据库系统可以直接在该坐标系中标定第一运行指标数据组的性能曲线。例如将第一运行指标数据组的每两个相邻的数据对应的数值点采用线段连接得到该性能曲线。The first operating index data group may form a performance curve in the coordinate system where the performance baseline of the first operating index is located. The database system can directly calibrate the performance curve of the first operating index data set in the coordinate system. For example, the value points corresponding to every two adjacent data in the first operating index data group are connected by a line segment to obtain the performance curve.
步骤A113、当第一运行指标数据组的性能曲线与SQL语句的第一运行指标的性能基线不匹配时,数据库系统确定第一运行指标数据组指示的性能低于SQL语句的第一历史运行指标数据组指示的性能。Step A113: When the performance curve of the first operating index data set does not match the performance baseline of the first operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is lower than the first historical operating indicator of the SQL statement The performance indicated by the data group.
数据库系统将第一运行指标数据组的性能曲线与第一运行指标的性能基线进行比较。当第一运行指标数据组的性能曲线与SQL语句的第一运行指标的性能基线不匹配时,数据库系统确定第一运行指标数据组指示的性能低于SQL语句的第一历史运行指标数据组指示的性能。The database system compares the performance curve of the first operating index data set with the performance baseline of the first operating index. When the performance curve of the first operating index data set does not match the performance baseline of the first operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is lower than the first historical operating indicator data set of the SQL statement. Performance.
第一运行指标数据组的性能曲线与对应的性能基线匹配的条件是预先设置的,其可以有多种设置方式。示例的,该匹配的条件指的是:该性能曲线上的数值点偏离性能基线的程度 在指定程度范围内。也即是数值点偏离性能基线的程度在指定程度范围内,第一运行指标数据组的性能曲线与对应的性能基线匹配;当数值点偏离性能基线的程度在不在指定程度范围内,第一运行指标数据组的性能曲线与对应的性能基线不匹配。The condition for matching the performance curve of the first operating index data group with the corresponding performance baseline is preset, and there may be multiple setting methods. For example, the matching condition refers to: the deviation of the numerical point on the performance curve from the performance baseline is within a specified range. That is, the deviation of the numerical point from the performance baseline is within the specified range, and the performance curve of the first operating index data set matches the corresponding performance baseline; when the deviation of the numerical point from the performance baseline is not within the specified range, the first run The performance curve of the indicator data set does not match the corresponding performance baseline.
可选地,曲线上的数值点偏离性能基线的程度可以由该数值点与性能基线的距离反映。例如,当性能基线包括高位线、低位线和中位线时,曲线上的数值点偏离性能基线的程度可以由该数值点与高位线、低位线和中位线中至少一者的距离反映。示例的,当该数值点到中位线的距离大于第一指定距离阈值;或者,当该数值点到中位线的距离大于第一指定距离阈值,且该数值点到高位线的距离大于第二指定距离阈值;或者,当该数值点到中位线的距离大于第一指定距离阈值,且该数值点到低位线的距离大于第三指定距离阈值,确定该数值点偏离性能基线。Optionally, the deviation of the numerical point on the curve from the performance baseline may be reflected by the distance between the numerical point and the performance baseline. For example, when the performance baseline includes a high line, a low line, and a median line, the deviation of a value point on the curve from the performance baseline may be reflected by the distance between the value point and at least one of the high line, the low line, and the median line. For example, when the distance from the numerical point to the median line is greater than the first specified distance threshold; or, when the distance from the numerical point to the median line is greater than the first specified distance threshold, and the distance from the numerical point to the high line is greater than the first specified distance threshold. 2. A designated distance threshold; or, when the distance from the numerical point to the median line is greater than the first designated distance threshold, and the distance from the numerical point to the low line is greater than the third designated distance threshold, it is determined that the numerical point deviates from the performance baseline.
如图5所示,图5是本申请实施例提供的一种第一运行指标数据组的性能曲线与第一运行指标的性能基线的比较场景示意图。通过比较性能曲线与性能基线是否匹配,可以确定第一运行指标数据组指示的性能是否低于SQL语句的第一历史运行指标数据组指示的性能。As shown in FIG. 5, FIG. 5 is a schematic diagram of a comparison scenario between the performance curve of the first operating indicator data set and the performance baseline of the first operating indicator provided by an embodiment of the present application. By comparing whether the performance curve matches the performance baseline, it can be determined whether the performance indicated by the first operation index data group is lower than the performance indicated by the first historical operation index data group of the SQL statement.
步骤A114、当第一运行指标数据组的性能曲线与SQL语句的第一运行指标的性能基线匹配时,数据库系统确定第一运行指标数据组指示的性能不低于SQL语句的第一历史运行指标数据组指示的性能。Step A114: When the performance curve of the first operating index data set matches the performance baseline of the first operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is not lower than the first historical operating indicator of the SQL statement The performance indicated by the data group.
值得说明的是,数据库系统也可以基于第一运行指标数据组,直接在性能基线所在坐标系中标定与该第一运行指标数据组对应的数值点(通常为一组离散的数值点)。无需确定第一运行指标数据组对应的性能曲线。则前述步骤A112可以删除,步骤A113替换为当第一运行指标数据组的数值点与SQL语句的运行指标的性能基线不匹配时,数据库系统确定第一运行指标数据组指示的性能低于SQL语句的第一历史运行指标数据组指示的性能。步骤A114替换为当运行指标数据组的数值点与SQL语句的运行指标的性能基线匹配时,数据库系统确定第一运行指标数据组指示的性能不低于SQL语句的第一历史运行指标数据组指示的性能。It is worth noting that the database system can also directly calibrate the numerical points (usually a set of discrete numerical points) corresponding to the first operational index data group in the coordinate system where the performance baseline is located based on the first operational index data group. There is no need to determine the performance curve corresponding to the first operating index data set. Then the foregoing step A112 can be deleted, and step A113 is replaced with when the value point of the first operating index data set does not match the performance baseline of the operating indicator of the SQL statement, the database system determines that the performance indicated by the first operating indicator data set is lower than that of the SQL statement The performance indicated by the first historical operating indicator data set. Step A114 is replaced by the database system determining that the performance indicated by the first running index data group is not lower than the first historical running index data group indication of the SQL sentence when the numerical points of the running index data group match the performance baseline of the running index of the SQL statement Performance.
第一运行指标数据组的数值点与对应的性能基线匹配的条件是预先设置的,其可以有多种设置方式。示例的,该匹配的条件指的是:第一种:第一运行指标数据组的数值点中偏离性能基线的数值点的个数小于指定个数阈值,或者,第二种:第一运行指标数据组的数值点中偏离性能基线的数值点占数值点总数的比例小于指定比例阈值。The condition for matching the numerical points of the first operating index data group with the corresponding performance baseline is preset, and there may be multiple setting methods. For example, the matching condition refers to: the first type: the number of numerical points deviating from the performance baseline in the first operating index data group is less than the specified number threshold, or the second type: the first operating index The proportion of the numerical points that deviate from the performance baseline in the numerical points of the data set to the total number of numerical points is less than the specified ratio threshold.
可选地,数值点偏离性能基线的程度可以由该数值点与性能基线的距离反映。例如,当性能基线包括高位线、低位线和中位线时,数值点偏离性能基线的程度可以由该数值点与高位线、低位线和中位线中至少一者的距离反映。相关解释可以参考前述曲线上的数值点偏离性能基线的程度的解释。Optionally, the degree of deviation of the numerical point from the performance baseline may be reflected by the distance between the numerical point and the performance baseline. For example, when the performance baseline includes a high line, a low line, and a median line, the degree of deviation of the value point from the performance baseline may be reflected by the distance between the value point and at least one of the high line, the low line, and the median line. The relevant explanation can refer to the explanation of the degree of deviation from the performance baseline of the numerical point on the aforementioned curve.
如图6所示,图6是本申请实施例提供的一种第一运行指标数据组的数值点与第一运行指标的性能基线的比较场景示意图。通过比较第一运行指标数据组的对应的多个离散数值点与性能基线是否匹配,可以确定第一运行指标数据组指示的性能是否低于第一历史运行指标数据组指示的性能。例如,假设匹配条件为前述第一种匹配条件,6个数值点中偏离性能基线的数值点个数为4个,若指定个数阈值为3,由于第一运行指标数据组的数值点中偏离性能基线的数值点的个数大于指定个数阈值,则第一运行指标数据组的对应的6个离散数值点与性能基线不匹配,相应的,确定第一运行指标数据组指示的性能低于第一历史运行指标数据组指示的性能。As shown in FIG. 6, FIG. 6 is a schematic diagram of a comparison scenario between the numerical points of the first operating indicator data set and the performance baseline of the first operating indicator provided by an embodiment of the present application. By comparing whether the corresponding multiple discrete numerical points of the first operating indicator data set match the performance baseline, it can be determined whether the performance indicated by the first operating indicator data set is lower than the performance indicated by the first historical operating indicator data set. For example, suppose the matching condition is the aforementioned first matching condition, and the number of value points that deviate from the performance baseline among the 6 value points is 4. If the specified number threshold is 3, the value points of the first operating index data group deviate from The number of numerical points of the performance baseline is greater than the specified number threshold, then the corresponding 6 discrete numerical points of the first operating index data group do not match the performance baseline, and accordingly, it is determined that the performance indicated by the first operating index data group is lower than The performance indicated by the first historical operating index data set.
第二种可实现方式,数据库系统通过AI模型来识别该第一运行指标是否出现异常。该过程如下:In the second achievable manner, the database system uses the AI model to identify whether the first operating indicator is abnormal. The process is as follows:
数据库系统将第一运行指标数据组输入第一人工智能模型,当第一人工智能模型输出指示第一运行指标数据组异常的指示信息,确定第一运行指标出现异常。The database system inputs the first operation index data group into the first artificial intelligence model, and when the first artificial intelligence model outputs indication information indicating that the first operation index data group is abnormal, it is determined that the first operation index is abnormal.
其中,第一运行指标数据组中的内容可以参考前第一种可实现方式中的介绍。指示信息的结构可以有多种,在一种可选方式中,当每次向第一人工智能模型输入一个运行指标数据组时,指示信息可以包括指示标签(或称分类标签),该指示标签用于标识输入第一人工智能模型的运行指标数据组是否异常;在另一种可选方式中,当每次向第一人工智能模型输入多个运行指标数据组时,指示信息可以包括携带有指示标签的运行指标数据组,也即是输出的运行指标数据组与输入的运行指标数据组相同,但每个运行指标数据组携带有指示标签;在又一种可选方式中,当每次向第一人工智能模型输入至少一个运行指标数据组时,指示信息可以包括出现异常的运行指标数据组,也即是仅输出的异常的运行指标数据组,不输出正常的运行指标数据组。Among them, the content in the first operating index data group can refer to the introduction in the previous first implementable manner. The structure of the indication information can be multiple. In an optional manner, each time an operating index data set is input to the first artificial intelligence model, the indication information may include an indication label (or a classification label). It is used to identify whether the operating indicator data set input to the first artificial intelligence model is abnormal; in another optional manner, when multiple operating indicator data sets are input to the first artificial intelligence model each time, the instruction information may include The operating indicator data group of the indicator label, that is, the output operating indicator data group is the same as the input operating indicator data group, but each operating indicator data group carries an indicator label; in another optional method, each time When at least one operating index data group is input to the first artificial intelligence model, the indication information may include an abnormal operating index data group, that is, only an abnormal operating index data group that is output, and no normal operating index data group is output.
值得说明的是,通常一个执行计划的运行指标中的每个运行指标对应一个第一人工智能模型,对于同一运行指标,其对应的第一人工智能模型可以由该运行指标对应的多个历史运行指标数据组作为训练样本训练得到。It is worth noting that, usually, each operating indicator in the operating indicators of an execution plan corresponds to a first artificial intelligence model. For the same operating indicator, the corresponding first artificial intelligence model can be run by multiple historical operations corresponding to the operating indicator. The index data set is trained as a training sample.
前述两种可实现方式可以根据实际情况进行结合,例如,当获取的运行指标数据组有多个时,例如获取了多个SQL语句对应的运行指标数据组,或者获取了一个SQL语句的一个运行指标的多个运行指标数据组时,可以先执行第一种可实现方式提供的方法,以进行异常的运行指标数据组的粗筛选,该粗筛选过程存在一定的误差,可能出现把非异常的运行指标数据组确定为异常的运行指标数据组的情况;再对粗筛选得到的(例如粗筛选结果为异常的)运行指标数据组执行第二种可实现方式提供的方法,以进行异常的运行指标数据组的精筛选。The foregoing two implementation methods can be combined according to actual conditions. For example, when there are multiple operation index data groups obtained, for example, operation index data groups corresponding to multiple SQL statements are obtained, or one operation of a SQL statement is obtained. When there are multiple operating indicator data sets for an indicator, the method provided in the first achievable mode can be executed first to perform a rough screening of abnormal operating indicator data sets. There are certain errors in the rough screening process, and non-abnormal results may occur. The operation index data group is determined to be an abnormal operation index data group; then the operation index data group obtained by rough screening (for example, the rough screening result is abnormal) is executed by the method provided by the second achievable way to perform abnormal operation Fine screening of indicator data sets.
以第一执行计划为例,对于第一执行计划的运行指标中的每个运行指标,当该运行指标数据组指示的性能低于SQL语句的历史运行指标数据组指示的性能,将运行指标数据组输入第一人工智能模型,当第一人工智能模型输出指示运行指标数据组异常的指示信息,确定第一执行计划的运行指标数据组出现异常,相对于前述第一种可实现方式,可以提高确定运行指标数据组异常的精确度。当该运行指标数据组指示的性能不低于SQL语句的历史运行指标数据组指示的性能,无需将运行指标数据组输入第一人工智能模型,相对于前述第二种可实现方式,可以减少第一人工智能模型的运算代价。Taking the first execution plan as an example, for each running index in the running index of the first execution plan, when the performance indicated by the running index data group is lower than the performance indicated by the historical running index data group of the SQL statement, the index data will be run Group input first artificial intelligence model, when the first artificial intelligence model outputs indication information indicating that the operation index data group is abnormal, it is determined that the operation index data group of the first execution plan is abnormal, which can improve Determine the accuracy of the abnormality of the operating index data set. When the performance indicated by the running index data set is not lower than the performance indicated by the historical running index data set of the SQL statement, there is no need to input the running index data set into the first artificial intelligence model. Compared with the foregoing second achievable method, the first method can be reduced. The computational cost of an artificial intelligence model.
因此,采用第一种可实现方式和第二种可实现方式结合的方式,相对于仅执行第一种可实现方式提供的方法可以提高筛选精度,相对于仅执行第二种可实现方式提供的方法,可以提高筛选效率。Therefore, the combination of the first achievable method and the second achievable method can improve the screening accuracy compared to the method provided by the first achievable method, and the screening accuracy can be improved compared to the method provided by the second achievable method only. Method, can improve the efficiency of screening.
前述步骤A11中,确定第一执行计划的运行指标中其他运行指标是否异常的过程参考确定第一运行指标是否异常的过程。本申请实施例对此不再赘述。In the foregoing step A11, the process of determining whether other operating indicators in the operating indicators of the first execution plan are abnormal refers to the process of determining whether the first operating indicator is abnormal. This is not repeated in the embodiment of the application.
在前述步骤A12中,数据库系统基于每个运行指标的异常判定结果,确定第一执行计划的运行指标是否出现异常的方式可以有多种,本申请实施例以以下几种可选方式为例进行说明:In the foregoing step A12, the database system may determine whether the operation index of the first execution plan is abnormal based on the abnormality determination result of each operation index. There are many ways to determine whether the operation index of the first execution plan is abnormal. illustrate:
在第一种可选方式中,当第一执行计划的至少一个运行指标出现异常,确定第一执行计划的运行指标出现异常;当第一执行计划的所有运行指标均未出现异常,确定第一执行计划 的运行指标未出现异常。In the first optional method, when at least one operation index of the first execution plan is abnormal, it is determined that the operation index of the first execution plan is abnormal; when all the operation indexes of the first execution plan are not abnormal, it is determined that the first execution plan is not abnormal. There is no abnormality in the operational indicators of the execution plan.
在第二种可选方式中,基于每个运行指标的异常判定结果,确定第一执行计划的运行指标分数,当该运行指标分数大于指定分数阈值,确定该第一执行计划的运行指标出现异常;当该运行指标分数不大于指定分数阈值,确定该第一执行计划的运行指标未出现异常。也即是该运行指标分数越高,出现异常的概率越高。In the second optional method, based on the abnormality determination result of each operation index, the operation index score of the first execution plan is determined. When the operation index score is greater than the specified score threshold, it is determined that the operation index of the first execution plan is abnormal ; When the running index score is not greater than the specified score threshold, it is determined that the running index of the first execution plan is not abnormal. That is, the higher the running index score, the higher the probability of abnormality.
其中,运行指标分数S满足分数计算公式:
Figure PCTCN2020121193-appb-000001
其中,Xi表示第i个运行指标对应的运行指标数据组的异常等级,1≤i≤N,N为运行指标的总数,Pi为第i个运行指标的权值,Pi是由第i个运行指标的重要性(或称优先级)确定的。每个运行指标的异常等级是基于每个运行指标的异常判定结果确定的,该异常等级反映运行指标对应的运行指标数据组中数据的异常程度,通常出现异常的数据的个数越多,该异常等级越高。S表示N个运行指标对应的运行指标数据组的异常等级的加权和。
Among them, the operating index score S satisfies the score calculation formula:
Figure PCTCN2020121193-appb-000001
Among them, Xi represents the abnormal level of the operating indicator data group corresponding to the i-th operating indicator, 1≤i≤N, N is the total number of operating indicators, Pi is the weight of the i-th operating indicator, Pi is run by the i-th operating indicator The importance (or priority) of the indicator is determined. The abnormality level of each operation index is determined based on the abnormality determination result of each operation index. The abnormality level reflects the degree of abnormality of the data in the operation index data group corresponding to the operation index. Generally, the more abnormal data, the The higher the anomaly level. S represents the weighted sum of the abnormality levels of the operation index data group corresponding to the N operation indexes.
值得说明的是,前述第二种可选方式是以运行指标分数与出现异常的概率正相关的方式定义运行指标分数,实际实现时,还可以定义与出现异常的概率负相关的另一种运行指标分数,也即是运行指标分数越高,出现异常的概率越低,分数计算公式也相应调整,例如更新的运行指标分数S’为1/S,S为前述运行指标分数。本申请实施例对此不做赘述。It is worth noting that the aforementioned second optional method is to define the operation index score in a way that the operation index score is positively correlated with the probability of occurrence of an abnormality. In actual implementation, it is also possible to define another operation that is negatively correlated with the probability of occurrence of an abnormality. Index score, that is, the higher the running index score, the lower the probability of abnormality, and the score calculation formula is adjusted accordingly. For example, the updated running index score S'is 1/S, and S is the aforementioned running index score. This is not repeated in the embodiment of the application.
步骤A2、当第一执行计划的运行指标出现异常,确定SQL语句的第一执行计划的性能劣化。Step A2. When the operation index of the first execution plan is abnormal, it is determined that the performance of the first execution plan of the SQL statement is degraded.
步骤A3、当第一执行计划的运行指标未出现异常,确定SQL语句的第一执行计划的性能未出现劣化。Step A3: When the operation index of the first execution plan is not abnormal, it is determined that the performance of the first execution plan of the SQL statement has not deteriorated.
步骤203、在分析到SQL语句的第一执行计划的性能劣化后,数据库系统获取SQL语句的第二执行计划。Step 203: After analyzing the performance degradation of the first execution plan of the SQL statement, the database system obtains the second execution plan of the SQL statement.
可选地,第二执行计划的性能与第一执行计划的性能不同。进一步可选地,第二执行计划的性能优于第一执行计划的性能。数据库系统获取SQL语句的第二执行计划的方式可以有多种,本申请实施例以以下两种获取方式为例进行说明:Optionally, the performance of the second execution plan is different from the performance of the first execution plan. Further optionally, the performance of the second execution plan is better than the performance of the first execution plan. There may be multiple ways for the database system to obtain the second execution plan of the SQL statement. The embodiment of the present application takes the following two obtaining ways as examples for description:
第一种获取方式:数据库系统获取SQL语句的历史执行计划;当历史执行计划的性能优于第一执行计划的性能时,将历史执行计划确定为第二执行计划。The first acquisition method: the database system acquires the historical execution plan of the SQL statement; when the performance of the historical execution plan is better than that of the first execution plan, the historical execution plan is determined as the second execution plan.
由于在第一执行计划之前,数据库系统(如优化节点或第一管理节点)可能生成过SQL语句的其他执行计划(也即是该其他执行计划是在第一执行计划之前生成的执行计划),由于第一执行计划是当前使用的执行计划,可知该其他执行计划已经成为历史的执行计划,数据库系统可以在SQL语句的其他执行计划中确定历史执行计划,以判定该历史执行计划是否可以作为第二执行计划。示例的,该历史执行计划可以是SQL语句的其他执行计划中性能最优的执行计划、历史使用时间最长的执行计划或符合其他设定条件的执行计划。Because the database system (such as the optimization node or the first management node) may have generated other execution plans of the SQL statement before the first execution plan (that is, the other execution plan is the execution plan generated before the first execution plan), Since the first execution plan is the currently used execution plan, it can be known that this other execution plan has become a historical execution plan. The database system can determine the historical execution plan in the other execution plans of the SQL statement to determine whether the historical execution plan can be used as the first execution plan. 2. Implementation plan. For example, the historical execution plan may be the execution plan with the best performance among other execution plans of the SQL statement, the execution plan with the longest historical use time, or the execution plan that meets other set conditions.
数据库系统可以比较历史执行计划的性能与该第一执行计划的性能,以确定两者的性能优劣。比较历史执行计划的性能与该第一执行计划的性能的方式可以有多种。假设运行指标分数与出现异常的概率正相关,数据库系统可以确定第一执行计划的运行指标分数,并获取历史执行计划的运行指标分数,数据库系统比较两者的运行指标分数,当第一执行计划的运行指标分数小于历史执行计划的运行指标分数,确定第一管理节点生成的第一执行计划的性能优于历史执行计划的性能;当第一执行计划的运行指标分数不小于历史执行计划的运行指标分数,确定第一管理节点生成的第一执行计划的性能不优于历史执行计划的性能。第一执 行计划的运行指标分数的确定方式可以参考前述步骤A12中第二种可选方式。The database system can compare the performance of the historical execution plan with the performance of the first execution plan to determine the pros and cons of the two. There may be many ways to compare the performance of the historical execution plan with the performance of the first execution plan. Assuming that the running index score is positively correlated with the probability of abnormality, the database system can determine the running index score of the first execution plan, and obtain the running index score of the historical execution plan. The database system compares the running index scores of the two, when the first execution plan If the running index score of the first execution plan is less than the running index score of the historical execution plan, it is determined that the performance of the first execution plan generated by the first management node is better than that of the historical execution plan; when the running index score of the first execution plan is not less than the running index of the historical execution plan The index score determines that the performance of the first execution plan generated by the first management node is not better than the performance of the historical execution plan. The method for determining the running index score of the first execution plan can refer to the second optional method in step A12 above.
历史执行计划的运行指标分数的确定方式可以有多种,本申请实施例以以下几种为例进行说明:There may be multiple ways to determine the operating index scores of the historical execution plan. The embodiments of this application take the following as examples for illustration:
在一种可选示例中,请参考步骤202,由于每次采用SQL语句的一个新的执行计划,数据库系统都会分析该执行计划的性能是否劣化,在分析该执行计划的性能是否劣化的过程,会获取指示该执行计划的性能的指示信息,例如该指示信息包括该执行计划的运行指标对应的数据(例如该执行计划的运行指标中,每个运行指标对应的运行指标数据组)或执行计划的运行指标分数,则数据库系统可以记录获取的性能的指示信息。如此,数据库系统记录有每个历史执行计划的指示信息。则数据库系统可以基于预先记录的历史执行计划的指示信息,确定历史执行计划的运行指标分数,该运行指标分数反应历史执行计划的性能。In an optional example, please refer to step 202. Since each time a new execution plan of the SQL statement is adopted, the database system will analyze whether the performance of the execution plan is degraded. In the process of analyzing whether the performance of the execution plan is degraded, Obtain instruction information indicating the performance of the execution plan, for example, the instruction information includes the data corresponding to the operation index of the execution plan (for example, the operation index data group corresponding to each operation index in the operation index of the execution plan) or the execution plan The database system can record the obtained performance indication information. In this way, the database system records the instruction information of each historical execution plan. Then the database system can determine the operation index score of the historical execution plan based on the pre-recorded indication information of the historical execution plan, and the operation index score reflects the performance of the historical execution plan.
在另一种可选示例中,数据库系统中,生成的执行计划中携带预估的性能开销,该性能开销越大指示执行计划的性能越差。数据库系统可以基于该性能开销,确定历史执行计划的运行指标分数,该运行指标分数反应历史执行计划的性能。示例的,该性能开销可以包括预估的该执行计划的运行指标的数据。例如,历史执行计划的性能开销包括:预估的历史执行计划的IO指标、时延、错误信息、执行次数和/或处理时长的数据(或由该数据转化得到的异常等级)。该运行指标分数基于预估的前述每个运行指标的数据确定,确定方式可以参考前述步骤A12中第二种可选方式。又例如,该性能开销可以直接包括预估的运行指标分数。In another optional example, in the database system, the generated execution plan carries estimated performance overhead, and the larger the performance overhead, the worse the performance of the execution plan. The database system may determine the running index score of the historical execution plan based on the performance overhead, and the running index score reflects the performance of the historical execution plan. For example, the performance overhead may include data of estimated operating indicators of the execution plan. For example, the performance overhead of the historical execution plan includes: estimated IO indicators, time delay, error information, execution times, and/or processing time data of the historical execution plan (or the abnormality level converted from the data). The operating index score is determined based on the estimated data of each of the foregoing operating indicators, and the determination method may refer to the second optional method in the foregoing step A12. For another example, the performance overhead may directly include the estimated running index score.
本申请实施例还可以以其他方式比较历史执行计划的性能与该第一执行计划的性能,例如将历史执行计划的运行指标与该第一执行计划的运行指标一一进行对比,基于对比结果,确定历史执行计划的性能是否优于第一执行计划的性能,本申请实施例对此不做限定。The embodiment of the present application may also compare the performance of the historical execution plan with the performance of the first execution plan in other ways, for example, compare the operation indexes of the historical execution plan with the operation indexes of the first execution plan one by one, and based on the comparison result, It is determined whether the performance of the historical execution plan is better than the performance of the first execution plan, which is not limited in the embodiment of the present application.
由于历史执行计划已经预先生成,因此采用该第一种获取方式,可以快速获取优于第一执行计划的性能的历史执行计划作为第二执行计划,能够实现执行计划的快速优化,提高优化效率。Since the historical execution plan has been generated in advance, the first acquisition method can quickly acquire a historical execution plan that has better performance than the first execution plan as the second execution plan, which can achieve rapid optimization of the execution plan and improve optimization efficiency.
第二种获取方式:数据库系统生成SQL语句的第二执行计划。The second method of obtaining: the database system generates the second execution plan of the SQL statement.
可选地,生成SQL语句的第二执行计划所占用的计算资源大于生成SQL语句的第一执行计划所占用的计算资源,和/或,生成SQL语句的第二执行计划的时长大于生成SQL语句的第一执行计划的时长。Optionally, the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or the duration of the second execution plan for generating the SQL statement is greater than that for generating the SQL statement The duration of the first execution plan.
第一执行计划通常是第一管理节点在线生成的。为了避免时延过长,影响用户体验,第一执行计划生成的时长有一定的限制。示例的,该第一执行计划需要在第一时长阈值内生成。例如,在步骤201中,第一管理节点可以执行以下步骤:基于第一数据库的优化规则信息和/或优化成本信息,生成多个备选执行计划,并在该多个备选执行计划中确定第一执行计划。该生成备选执行计划以及确定第一执行计划的时长需要在该第一时长阈值内。The first execution plan is usually generated online by the first management node. In order to avoid too long delay and affect user experience, the time length of the first execution plan generation has a certain limit. For example, the first execution plan needs to be generated within the first duration threshold. For example, in step 201, the first management node may perform the following steps: generate multiple candidate execution plans based on the optimization rule information and/or optimization cost information of the first database, and determine among the multiple candidate execution plans The first execution plan. The duration of generating the candidate execution plan and determining the first execution plan needs to be within the first duration threshold.
并且,为了避免对计算资源的占用,影响其他用户业务,第一执行计划生成时所占用的计算资源也有一定的限制。示例的,生成该第一执行计划占用的计算资源小于第一计算资源阈值。也即是,前述该生成备选执行计划以及确定第一执行计划的过程所占用的计算资源小于第一计算资源阈值。其中,计算资源可以包括第一管理节点运行时所需的CPU资源、内存资源和/或硬盘资源等。In addition, in order to avoid occupying computing resources and affecting other user services, the computing resources occupied when the first execution plan is generated are also limited to a certain extent. For example, the computing resources occupied by generating the first execution plan are less than the first computing resource threshold. That is, the computing resources occupied by the foregoing process of generating the candidate execution plan and determining the first execution plan is less than the first computing resource threshold. Wherein, the computing resources may include CPU resources, memory resources, and/or hard disk resources required by the first management node during operation.
其中,第一时长阈值可以基于前述可靠性指标中的允许中断时长确定,例如,第一时长阈值小于或等于该允许中断时长;第一计算资源阈值可以基于前述可靠性指标中的IO上限或 其他与计算资源相关的参数确定。Wherein, the first duration threshold may be determined based on the allowable interruption duration in the foregoing reliability index, for example, the first duration threshold is less than or equal to the allowable interruption duration; the first computing resource threshold may be based on the IO upper limit in the foregoing reliability index or other The parameters related to computing resources are determined.
而本申请实施例中,数据库系统(例如优化节点)可以基于第一数据库的优化规则信息和/或优化成本信息,生成多个备选执行计划,并在该多个备选执行计划中确定第二执行计划。但该确定第二执行计划的过程可以是一个离线计算的过程,由于第二执行计划在离线生成时不影响第一数据库的正常业务,也不受第一数据库的业务的约束,因此可以占用较多的时间和/或计算资源来确定SQL语句的第二执行计划。在这种情况下,该数据库系统生成备选执行计划以及确定第二执行计划的过程均可以参考前述生成第一执行计划的对应过程。也即是,第二执行计划和第一执行计划的生成原理可以相同。但是,生成SQL语句的第二执行计划所占用的计算资源;和/或,生成SQL语句的第二执行计划的时长不受约束,或者相对于生成第一执行计划的过程受到较少的约束。如此,前述数据库系统基于第一数据库的优化规则信息和/或优化成本信息,生成多个备选执行计划指的是,数据库系统基于第一数据库的优化规则信息和/或优化成本信息中其他信息,生成多个备选执行计划,该其他信息是优化规则信息和/或优化成本信息中除与计算资源相关和计算时间相关的信息之外的信息。In the embodiment of the present application, the database system (for example, the optimization node) may generate multiple candidate execution plans based on the optimization rule information and/or optimization cost information of the first database, and determine the first execution plan among the multiple candidate execution plans. 2. Implementation plan. However, the process of determining the second execution plan can be an offline calculation process. Because the second execution plan does not affect the normal business of the first database when it is generated offline, and is not restricted by the business of the first database, it can occupy more More time and/or computing resources to determine the second execution plan of the SQL statement. In this case, the process of generating the candidate execution plan and determining the second execution plan by the database system can refer to the corresponding process of generating the first execution plan described above. That is, the generation principle of the second execution plan and the first execution plan may be the same. However, the computing resources occupied by the second execution plan for generating the SQL statement; and/or the duration of the second execution plan for generating the SQL statement is not constrained, or is less constrained relative to the process of generating the first execution plan. In this way, that the aforementioned database system generates multiple alternative execution plans based on the optimization rule information and/or optimization cost information of the first database means that the database system is based on the optimization rule information of the first database and/or other information in the optimization cost information , Generate multiple alternative execution plans, and the other information is information other than information related to computing resources and computing time in the optimization rule information and/or optimization cost information.
由此可知,数据库系统生成SQL语句的第二执行计划所占用的计算资源大于生成SQL语句的第一执行计划所占用的计算资源;和/或,生成SQL语句的第二执行计划的时长大于生成SQL语句的第一执行计划的时长。It can be seen that the computing resources occupied by the second execution plan of the SQL statement generated by the database system are greater than the computing resources occupied by the first execution plan for generating the SQL statement; and/or the duration of the second execution plan for generating the SQL statement is greater than that of the generated SQL statement The duration of the first execution plan of the SQL statement.
示例的,可以为数据库系统设置第二时长阈值,以及第二计算资源阈值。该第二时长阈值大于第一时长阈值,第二计算资源阈值大于第一资源阈值。该数据库系统在该第二时长阈值,以及第二计算资源阈值的限制下生成备选执行计划以及再在备选执行计划中确定第二执行计划,该过程可以参考前述生成第一执行计划的对应过程。For example, the second duration threshold and the second computing resource threshold may be set for the database system. The second duration threshold is greater than the first duration threshold, and the second computing resource threshold is greater than the first resource threshold. The database system generates an alternative execution plan under the constraints of the second duration threshold and the second computing resource threshold, and then determines the second execution plan in the alternative execution plan. For this process, please refer to the corresponding method for generating the first execution plan. process.
由于生成第二执行计划受到的限制较少,因此通常性能优于第一执行计划的性能。假设第一执行计划由第一管理节点生成,第二执行计划由优化节点生成。在第一种示例中,第一管理节点生成的备选执行计划个数(如100个)小于优化节点生成的备选执行计划个数(如10000个),示例的,虽然第一管理节点遍历生成的该多个备选执行计划,以确定第一执行计划,同理,优化节点遍历生成的该多个备选执行计划,以确定第二执行计划,两个遍历过程相同,但是由于优化节点的可选择的备选执行计划数量更多,最终确定的第二执行计划优于第一执行计划的概率较高。Since there are fewer restrictions on generating the second execution plan, the performance is usually better than that of the first execution plan. Assume that the first execution plan is generated by the first management node, and the second execution plan is generated by the optimization node. In the first example, the number of candidate execution plans generated by the first management node (such as 100) is less than the number of candidate execution plans generated by the optimized node (such as 10000). For example, although the first management node traverses The multiple candidate execution plans generated are used to determine the first execution plan. Similarly, the multiple candidate execution plans generated by the node traversal are optimized to determine the second execution plan. The two traversal processes are the same, but due to the optimization node There are more alternative execution plans available, and the final second execution plan is more likely to be better than the first execution plan.
在第二种示例中,第一管理节点生成的备选执行计划个数与优化节点生成的备选执行计划个数(如均为10000个),但是,受到第一时长阈值的限制,第一管理节点无法遍历(只能枚举)生成的该多个备选执行计划,以确定第一执行计划,而优化节点可以遍历生成的该多个备选执行计划,以确定第二执行计划。虽然生成相同个数的备选执行计划,但是第一管理节点和优化节点扫描的备选执行计划的个数不同,最终确定的第二执行计划优于第一执行计划的概率较高。In the second example, the number of candidate execution plans generated by the first management node and the number of candidate execution plans generated by the optimization node (for example, both are 10,000), but are limited by the first duration threshold, the first The management node cannot traverse (can only enumerate) the generated multiple candidate execution plans to determine the first execution plan, while the optimization node can traverse the generated multiple candidate execution plans to determine the second execution plan. Although the same number of candidate execution plans are generated, the number of candidate execution plans scanned by the first management node and the optimized node are different, and the finally determined second execution plan is more likely to be better than the first execution plan.
为了便于读者理解,假设第一数据库的优化规则信息指示5毫秒返回SQL语句的查询数据,第一时长阈值为0.5毫秒。In order to facilitate readers' understanding, suppose that the optimization rule information of the first database indicates that the query data of the SQL statement is returned in 5 milliseconds, and the first duration threshold is 0.5 milliseconds.
继续以前述第二种示例为例,假设第一管理节点生成了1000个备选执行计划,在0.5毫秒内,第一管理节点仅能扫描该1000个备选执行计划中的100个备选执行计划。则第一管理节点基于该100个备选执行计划,确定第一执行计划。假设优化节点生成了1000个备选执行计划,与前述第一管理节点生成的1000个备选执行计划相同,优化节点遍历该1000个备选 执行计划,从而在该1000个备选执行计划中确定第二执行计划。Continuing with the foregoing second example as an example, suppose the first management node generates 1000 alternative execution plans. Within 0.5 milliseconds, the first management node can only scan 100 alternative executions among the 1000 alternative execution plans. plan. Then the first management node determines the first execution plan based on the 100 candidate execution plans. Assuming that the optimization node generates 1000 candidate execution plans, which are the same as the 1000 candidate execution plans generated by the first management node, the optimization node traverses the 1000 candidate execution plans to determine among the 1000 candidate execution plans The second execution plan.
综上可知,由于在生成时间和/或占用的计算资源上减少了对生成执行计划过程的限制,可以保证最终确定的第二执行计划的性能优于第一执行计划的性能。In summary, since the generation time and/or the occupied computing resources reduce the restriction on the process of generating the execution plan, it can be ensured that the performance of the finally determined second execution plan is better than the performance of the first execution plan.
值得说明的是,前述第一种获取方式和第二种获取方式还可以结合使用。例如,若数据库系统无法获取SQL语句的历史执行计划(例如,SQL语句不存在其他执行计划,或者存在的其他执行计划不满足条件,导致无法获取历史执行计划);或者,虽然可以获取历史执行计划,但是历史执行计划的性能不优于第一执行计划的性能,则在执行前述第二种获取方式。It is worth noting that the aforementioned first acquisition method and the second acquisition method can also be used in combination. For example, if the database system cannot obtain the historical execution plan of the SQL statement (for example, there are no other execution plans for the SQL statement, or other existing execution plans do not meet the conditions, resulting in the inability to obtain the historical execution plan); or, although the historical execution plan can be obtained , But the performance of the historical execution plan is not better than that of the first execution plan, then the second acquisition method mentioned above is executed.
可选地,数据库系统还可以采用其他方式获取SQL语句的第二执行计划。例如,用户可以输入执行计划更新指令,相应的,数据库系统可以接收执行计划更新指令,该执行计划更新指令包括第二执行计划。Optionally, the database system may also use other methods to obtain the second execution plan of the SQL statement. For example, the user may input an execution plan update instruction, and correspondingly, the database system may receive an execution plan update instruction, and the execution plan update instruction includes the second execution plan.
在本申请实施例中,用户还可以控制是否进行执行计划的干预。则在前述步骤203之前,也即是数据库系统在分析到SQL语句的第一执行计划的性能劣化后,数据库系统还可以发送告警指示信息。该告警指示信息指示该SQL语句的第一执行计划性能劣化。可选地,该告警指示信息可以包括SQL语句,即产生性能劣化的SQL语句;该告警指示信息还可以包括指示进行执行计划的干预的任务。用户可以基于该告警指示信息知晓当前出现性能劣化的SQL语句,并判定是否进行执行计划的干预。相应的,在步骤203中,数据库系统在接收到执行计划优化指令后,获取SQL语句的第二执行计划。该执行计划优化指令用于指示对劣化的执行计划进行干预。可选地,该执行计划优化指令和该执行计划更新指令可以为同一指令。In the embodiment of the present application, the user can also control whether to intervene in the execution plan. Then, before the aforementioned step 203, that is, after the database system analyzes the performance degradation of the first execution plan of the SQL statement, the database system may also send an alarm indication information. The warning indication information indicates that the performance of the first execution plan of the SQL statement has deteriorated. Optionally, the alarm indication information may include SQL statements, that is, SQL statements that produce performance degradation; the alarm indication information may also include tasks that indicate intervention in the execution plan. The user can know the SQL statement that currently has performance degradation based on the warning indication information, and determine whether to intervene in the execution plan. Correspondingly, in step 203, after receiving the execution plan optimization instruction, the database system obtains the second execution plan of the SQL statement. The execution plan optimization instruction is used to instruct to intervene in the degraded execution plan. Optionally, the execution plan optimization instruction and the execution plan update instruction may be the same instruction.
可选地,该告警指示信息可以通过用户界面呈现。图7是本申请实施例提供的一种示意性的用户界面30的示意图,该用户界面30除了告警指示信息301之外,还可以呈现确定选项302、禁止选项303和/或延迟优化选项304。当用户确定进行执行计划的优化后,触发该确定选项302,相应的,数据库系统接收到执行指令,基于该执行指令进行执行计划的优化;当用户确定禁止进行执行计划的优化后,触发该禁止选项303,相应的,数据库系统接收到禁止执行指令,基于该禁止执行指令禁止进行执行计划的优化;当用户确定延期进行执行计划的优化后,触发该延迟优化选项304,相应的,数据库系统接收到延期执行指令,基于该延期执行指令在到达该延期执行指令所指示的时间点后进行执行计划的优化。其中,延迟优化选项指示的时间点可以是预先设置的时间点,如关机时间点或开机时间点;或者,延迟优化选项指示的时间点可以是用户设置的时间点,如一小时后或者一天以后。Optionally, the warning indication information may be presented through a user interface. FIG. 7 is a schematic diagram of an exemplary user interface 30 provided by an embodiment of the present application. In addition to the alarm indication information 301, the user interface 30 may also present a determination option 302, a prohibition option 303, and/or a delay optimization option 304. When the user determines to optimize the execution plan, the determination option 302 is triggered. Correspondingly, the database system receives the execution instruction and optimizes the execution plan based on the execution instruction; when the user determines that the optimization of the execution plan is prohibited, the prohibition is triggered Option 303: Correspondingly, the database system receives an execution prohibition instruction, and the optimization of the execution plan is prohibited based on the execution prohibition instruction; when the user determines to delay the optimization of the execution plan, the delay optimization option 304 is triggered, and accordingly, the database system receives When the deferred execution instruction is reached, the execution plan is optimized based on the deferred execution instruction after reaching the time point indicated by the deferred execution instruction. The time point indicated by the delay optimization option may be a preset time point, such as a shutdown time point or a power-on time point; or, the time point indicated by the delay optimization option may be a time point set by the user, such as one hour later or one day later.
本申请实施例中,通过用户界面将告警指示信息呈现给用户,由用户来控制是否进行执行计划的优化,可以避免后台自动进行执行计划的优化影响用户的操作或影响正在执行的用户业务,提高执行计划干预的时间上的灵活性,提高用户体验。In the embodiment of the present application, the warning indication information is presented to the user through the user interface, and the user controls whether to optimize the execution plan, which can prevent the automatic execution plan optimization in the background from affecting the user's operation or affecting the user business being executed, and improve The flexibility in the time of execution of the planned intervention improves the user experience.
步骤204、数据库系统将第二执行计划转化为与第一管理节点匹配的第二执行计划。Step 204: The database system converts the second execution plan into a second execution plan matching the first management node.
数据库系统获取的第二执行计划在被使用时需要由第一管理节点解析。虽然该第二执行计划可以由第一管理节点解析,但是可能该第二执行计划并不完全适配于第一管理节点,从而影响第一管理节点解析该第二执行计划的速度,进而导致该第一管理节点产生较长的解析时延,影响第二执行计划被加载和使用的效率。The second execution plan obtained by the database system needs to be parsed by the first management node when it is used. Although the second execution plan can be parsed by the first management node, it is possible that the second execution plan is not fully adapted to the first management node, which affects the speed at which the first management node parses the second execution plan, which in turn leads to the The first management node generates a longer analysis delay, which affects the efficiency of loading and using the second execution plan.
本申请实施例中可以将第二执行计划转化为与第一管理节点匹配的第二执行计划,以保证第一管理节点能够快速解析转化后的第二执行计划,从而减少第一管理节点产生的解析时延,提高第一管理节点对第二执行计划的加载和使用效率。In the embodiments of the present application, the second execution plan can be converted into a second execution plan that matches the first management node, so as to ensure that the first management node can quickly analyze the converted second execution plan, thereby reducing the generation of the first management node. Analyze the time delay and improve the efficiency of loading and using the second execution plan by the first management node.
示例的,数据库系统可以采用查询对应关系的方式,将第二执行计划转化为与第一管理节点匹配的第二执行计划,该过程包括:数据库系统查询指定的管理节点与执行计划格式的对应关系,得到第一管理节点对应的执行计划格式;数据库系统将第二执行计划转化为符合该执行计划格式的第二执行计划。For example, the database system may use the method of querying the correspondence relationship to convert the second execution plan into a second execution plan matching the first management node. The process includes: the database system queries the correspondence relationship between the specified management node and the execution plan format , The execution plan format corresponding to the first management node is obtained; the database system converts the second execution plan into a second execution plan conforming to the execution plan format.
步骤205、优化节点执行所述第二执行计划来替换对所述第一执行计划的执行。Step 205: The optimization node executes the second execution plan to replace the execution of the first execution plan.
在第一种可选方式中,围优化节点可以不执行前述步骤204,直接执行所述第二执行计划来替换对所述第一执行计划的执行;在另一种可选方式中,优化节点可以执行采用步骤204转化得到的第二执行计划来替换对所述第一执行计划的执行。In the first optional manner, the optimization node may not execute the foregoing step 204, and directly execute the second execution plan to replace the execution of the first execution plan; in another optional manner, the optimization node The second execution plan transformed in step 204 may be executed to replace the execution of the first execution plan.
在一种示意性实现方式中,第二执行计划携带著录提示标签(hint),该著录提示标签用于标识对应的执行计划为更新后的执行计划(或称干预后的执行计划)。示例的,数据库系统(如优化节点)可以在第二执行计划中添加著录提示标签,第一管理节点基于该著录提示标签可以确定对应的执行计划是数据库系统(如优化节点)干预后的执行计划,并不是第一管理节点本身正常生成(如在线生成的)的执行计划。该著录提示标签可以由一个或多个字符组成,该字符可以为数字字符或字母字符等等。In an exemplary implementation manner, the second execution plan carries a hint tag, which is used to identify the corresponding execution plan as an updated execution plan (or called an intervened execution plan). For example, a database system (such as an optimization node) can add a description prompt label to the second execution plan, and the first management node can determine that the corresponding execution plan is an execution plan after the intervention of the database system (such as an optimization node) based on the description prompt label. , It is not the execution plan normally generated by the first management node itself (such as online generation). The description prompt label may be composed of one or more characters, and the characters may be numeric characters, alphabetic characters, and so on.
可选地,请继续参考图3,添加了著录提示标签的第二执行计划仍然存储在前述系统表1042中。第二执行计划会替换掉该系统表1042中记录的第一执行计划。在一种可选方式中,可以先删除第一执行计划,再添加第二执行计划;在另一种可选方式中,可以采用第二执行计划覆盖第一执行计划。传统的数据库系统中的执行计划不添加著录提示标签,本申请实施例通过在第二执行计划上添加著录提示标签,可以与第一管理节点101a正常生成的执行计划进行区分。第一管理节点101a将添加著录提示标签的第二执行计划加载,而通常第二执行计划的性能优于第一执行计划的性能,如此实现执行计划的优化。Optionally, please continue to refer to FIG. 3, the second execution plan added with the description prompt label is still stored in the aforementioned system table 1042. The second execution plan will replace the first execution plan recorded in the system table 1042. In an optional manner, the first execution plan may be deleted first, and then the second execution plan may be added; in another optional manner, the second execution plan may be used to overwrite the first execution plan. The execution plan in the traditional database system does not add a description prompt label. The embodiment of the present application adds a description prompt label to the second execution plan, which can be distinguished from the execution plan normally generated by the first management node 101a. The first management node 101a loads the second execution plan to which the description prompt label is added. Generally, the performance of the second execution plan is better than that of the first execution plan, so that the optimization of the execution plan is realized.
在另一种示意性实现方式中,可以采用分区存放的方式来区分更新的执行计划和正常生成的执行计划。示例的,数据库系统(如优化节点)将第二执行计划存储在其他系统表中,该其他系统表用于记录更新的执行计划,当该更新的执行计划不允许被使用(例如停止对第一管理节点的执行计划的干预过程)后,可以清空该其他系统表中第一管理节点对应的更新的执行计划。如此,其他系统表通常有以下两种状态,一种是存储有第一管理节点的一个更新的执行计划的状态,另一种是未存储第一管理节点的更新的执行计划的状态。In another exemplary implementation manner, a partition storage method may be used to distinguish the updated execution plan from the normally generated execution plan. For example, the database system (such as the optimization node) stores the second execution plan in other system tables, and the other system tables are used to record the updated execution plan. When the updated execution plan is not allowed to be used (for example, stop the first execution plan) After the intervention process of the execution plan of the management node), the updated execution plan corresponding to the first management node in the other system tables can be cleared. In this way, other system tables usually have the following two states, one is a state in which an updated execution plan of the first management node is stored, and the other is a state in which an updated execution plan of the first management node is not stored.
第一管理节点在需要加载SQL语句的执行计划时,可以先查询其他系统表,若其他系统表存储有SQL语句的执行计划,则加载该执行计划;若其他系统表未存储SQL语句的执行计划,加载前述系统表中的SQL语句的执行计划。When the first management node needs to load the execution plan of the SQL statement, it can first query other system tables. If the execution plan of the SQL statement is stored in the other system table, the execution plan is loaded; if the execution plan of the SQL statement is not stored in the other system table , Load the execution plan of the SQL statement in the aforementioned system table.
值得说明的是,前述204和步骤205是以第一执行计划的性能劣化为例进行说明的,当在步骤202分析得到第一执行计划的性能为劣化,则可以保持第一执行计划的使用,则在此情况下,如图3所示,第一管理节点101a在系统表1042获取的仍然是第一执行计划(图3未示出)。It is worth noting that the foregoing 204 and step 205 are described by taking the performance degradation of the first execution plan as an example. When the performance of the first execution plan is analyzed in step 202 as degradation, the use of the first execution plan can be maintained. In this case, as shown in FIG. 3, what the first management node 101a obtains from the system table 1042 is still the first execution plan (not shown in FIG. 3).
步骤206、在新版本的执行计划的性能优于第二执行计划的性能时,数据库系统执行新版本的执行计划来替换对所述第二执行计划的执行。Step 206: When the performance of the new version of the execution plan is better than the performance of the second execution plan, the database system executes the new version of the execution plan to replace the execution of the second execution plan.
若软硬件环境变更,或者第一管理节点到达生成新版本的执行计划的周期后,数据库系统(如第一管理节点)会生成新版本的执行计划,假设该新版本的执行计划为第三执行计划。数据库系统可以分析该第三执行计划的性能,若第三执行计划的性能优于第二执行计划的性 能,则数据库系统执行新版本的执行计划来替换对所述第二执行计划的执行。当第三执行计划的性能未优于第二执行计划的性能,说明第二执行计划的性能仍然较优,数据库系统仍然保持第二执行计划的执行。在这种情况下,数据库系统在每次生成一个第三执行计划后,比较第二执行计划的性能与该第三执行计划的性能,直至第三执行计划的性能优于第二执行计划的性能,数据库系统执行新版本的执行计划来替换对所述第二执行计划的执行。If the hardware and software environment changes, or the first management node reaches the cycle of generating a new version of the execution plan, the database system (such as the first management node) will generate a new version of the execution plan, assuming that the new version of the execution plan is the third execution plan. The database system can analyze the performance of the third execution plan, and if the performance of the third execution plan is better than that of the second execution plan, the database system executes the new version of the execution plan to replace the execution of the second execution plan. When the performance of the third execution plan is not better than the performance of the second execution plan, it indicates that the performance of the second execution plan is still better, and the database system still maintains the execution of the second execution plan. In this case, each time the database system generates a third execution plan, it compares the performance of the second execution plan with the performance of the third execution plan until the performance of the third execution plan is better than that of the second execution plan. , The database system executes the new version of the execution plan to replace the execution of the second execution plan.
其中,比较第二执行计划的性能与该第三执行计划的性能的方式可以有多种。例如,数据库系统中,生成的执行计划中携带预估的性能开销,该性能开销越大指示执行计划的性能越差。假设运行指标分数与出现异常的概率正相关,数据库系统可以基于该性能开销,确定第三执行计划的运行指标分数,并获取第二执行计划的运行指标分数,数据库系统比较两者的运行指标分数,当第三执行计划的运行指标分数小于第二执行计划的运行指标分数,确定第三执行计划的性能优于第二执行计划的性能;当第三执行计划的运行指标分数不小于第二执行计划的运行指标分数,确定第三执行计划的性能不优于第二执行计划的性能。There are many ways to compare the performance of the second execution plan with the performance of the third execution plan. For example, in a database system, the generated execution plan carries estimated performance overhead, and the larger the performance overhead, the worse the performance of the execution plan. Assuming that the running index score is positively correlated with the probability of abnormality, the database system can determine the running index score of the third execution plan based on the performance cost, and obtain the running index score of the second execution plan, and the database system compares the running index scores of the two , When the operating index score of the third execution plan is less than the operating index score of the second execution plan, it is determined that the performance of the third execution plan is better than that of the second execution plan; when the third execution plan’s operation index score is not less than the second execution plan The running index score of the plan determines that the performance of the third execution plan is not better than the performance of the second execution plan.
示例的,该性能开销可以包括预估的第三执行计划的运行指标对应的数据(即该执行计划的运行指标中,每个运行指标对应的运行指标数据组)。例如,第三执行计划的性能开销包括:预估的第三执行计划的IO指标、时延、错误信息、执行次数和/或处理时长的数据(或由该数据转化得到的异常等级)。该运行指标分数基于预估的前述每个运行指标的数据确定,确定方式可以参考前述步骤A12中第二种可选方式。又例如,该性能开销可以直接包括预估的运行指标分数。For example, the performance overhead may include data corresponding to the estimated operating indicators of the third execution plan (that is, the operating indicator data group corresponding to each operating indicator in the operating indicators of the execution plan). For example, the performance overhead of the third execution plan includes: the estimated IO indicators, time delay, error information, execution times, and/or processing time data of the third execution plan (or the abnormality level converted from the data). The operating index score is determined based on the estimated data of each of the foregoing operating indicators, and the determination method may refer to the second optional method in the foregoing step A12. For another example, the performance overhead may directly include the estimated running index score.
本申请实施例还可以以其他方式比较第二执行计划的性能与该第三执行计划的性能,例如将第二执行计划的运行指标与该第三执行计划的运行指标一一进行对比,基于对比结果,确定第三执行计划的性能是否优于第二执行计划的性能,本申请实施例对此不做限定。The embodiment of the present application can also compare the performance of the second execution plan with the performance of the third execution plan in other ways. As a result, it is determined whether the performance of the third execution plan is better than the performance of the second execution plan, which is not limited in the embodiment of the present application.
可选地,数据库系统还可以采用其他方式获取SQL语句的第三执行计划(即前述新版本的执行计划),例如,用户可以输入执行计划版本更新指令,相应的,数据库系统可以接收执行计划版本更新指令,该执行计划版本更新指令包括第三执行计划。Optionally, the database system can also obtain the third execution plan of the SQL statement (that is, the aforementioned new version of the execution plan) in other ways. For example, the user can input an execution plan version update instruction, and accordingly, the database system can receive the execution plan version. An update instruction, and the execution plan version update instruction includes a third execution plan.
在本申请实施例中,用户还可以对数据库系统中的规则进行设置。则本申请实施例提供的执行计划的处理方法还可以包括:接收规则设置指令,该规则设置指令包括设置的规则。可选地,数据库系统中的规则可以包括以下至少一种:SQL性能对比规则、著录提示标签设置规则、告警规则和路由规则。In the embodiment of the present application, the user can also set the rules in the database system. Then, the method for processing the execution plan provided in the embodiment of the present application may further include: receiving a rule setting instruction, where the rule setting instruction includes the set rule. Optionally, the rules in the database system may include at least one of the following: SQL performance comparison rules, description prompt label setting rules, alarm rules, and routing rules.
该SQL性能对比规则为指示数据库系统如何确定SQL语句的第一执行计划的性能是否劣化的规则。例如基于该SQL性能对比规则,数据库系统可以执行前述步骤A1至A3。该著录提示标签设置规则为指示数据库系统如何设置著录提示标签的规则。例如,基于著录提示标签设置规则,数据库系统可以采用前述步骤205提供的方法添加著录提示标签。告警规则为指示数据库系统如何告警的规则。例如,基于告警规则,数据库系统可以发出前述告警指示信息。路由规则为指示数据库系统如何存储获取的数据(如运行指标对应的数据)的规则。例如,基于路由规则,数据库系统可以将获取的运行指标数据组中的数据存储在指定存储空间中。The SQL performance comparison rule is a rule that instructs the database system how to determine whether the performance of the first execution plan of the SQL statement is degraded. For example, based on the SQL performance comparison rule, the database system can execute the aforementioned steps A1 to A3. The description prompt label setting rule is a rule that instructs the database system how to set the description prompt label. For example, based on the setting rules of the description prompt label, the database system may use the method provided in the foregoing step 205 to add the description prompt label. The alarm rule is a rule that instructs the database system how to alarm. For example, based on the alarm rule, the database system can issue the aforementioned alarm indication information. The routing rule is a rule that instructs the database system how to store the acquired data (such as the data corresponding to the running index). For example, based on routing rules, the database system may store the acquired data in the operating index data group in a designated storage space.
综上所述,本申请实施例在分析到第一执行计划的性能劣化后,会采用第二执行计划替换第一执行计划,以避免数据库使用性能劣化的第一执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。可选地,该第二执行计划的性能优于第一执行计划 的性能,从而有效保证数据库的性能。In summary, after analyzing the performance degradation of the first execution plan, the embodiment of the present application will replace the first execution plan with the second execution plan to avoid the use of the first execution plan of performance degradation in the database and reduce the execution of performance degradation. Plan the impact on the database to ensure the performance of the database. Optionally, the performance of the second execution plan is better than the performance of the first execution plan, thereby effectively ensuring the performance of the database.
需要说明的是,本申请实施例提供的执行计划的处理方法的步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减,例如前述步骤202、204和206可以不执行,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本申请的保护范围之内,因此不再赘述。It should be noted that the order of the steps in the processing method of the execution plan provided in the embodiment of the application can be adjusted appropriately, and the steps can also be increased or decreased according to the situation. For example, the aforementioned steps 202, 204, and 206 may not be executed. Those skilled in the art can easily think of various methods within the technical scope disclosed in this application, which should be covered by the protection scope of this application, and therefore will not be repeated.
本申请实施例的数据库系统支持对管理节点的执行计划的干预功能,该功能可以由多种方式触发。例如,在一种可选方式中,数据库系统接收到执行计划干预指令后,执行对管理节点的执行计划的干预过程,如开始执行步骤202至步骤206,也即是在接收到执行计划优化指令后,开始分析SQL语句的第一执行计划的性能是否劣化,该执行计划干预指令可以是用户通过应用程序触发,也可以由指定设备触发;在另一种可选方式中,数据库系统周期性地执行对第一管理节点的执行计划的干预过程,如步骤202至步骤206。The database system of the embodiment of the present application supports the function of intervention in the execution plan of the management node, and this function can be triggered in a variety of ways. For example, in an optional manner, after receiving the execution plan intervention instruction, the database system executes the intervention process of the execution plan of the management node, such as starting to execute step 202 to step 206, that is, after receiving the execution plan optimization instruction After that, start to analyze whether the performance of the first execution plan of the SQL statement is degraded. The execution plan intervention instruction can be triggered by the user through the application or by a designated device; in another alternative, the database system periodically Perform an intervention process to the execution plan of the first management node, such as step 202 to step 206.
图8是本申请实施例提供的该数据库系统的结构示意图。如图8所示,该数据库系统包括优化节点,图8假设优化节点位于管理节点(图8未绘出)之外,优化节点包括处理(processing)模块、人工智能计算引擎、分析模块、操作模块和告警模块。其中,分析模块包括诊断子模块和优化子模块,操作模块包括集群管理子模块和实例管理子模块。Fig. 8 is a schematic structural diagram of the database system provided by an embodiment of the present application. As shown in Figure 8, the database system includes optimization nodes. Figure 8 assumes that the optimization nodes are located outside the management node (not shown in Figure 8). The optimization nodes include processing modules, artificial intelligence computing engines, analysis modules, and operation modules. And alarm module. Among them, the analysis module includes a diagnosis sub-module and an optimization sub-module, and the operation module includes a cluster management sub-module and an instance management sub-module.
人工智能计算引擎可以存储有前述第一人工智能模型和前述第二人工智能模型,并基于存储的人工智能模型执行相应的计算。例如,执行前述步骤A111,和前述步骤A114提供的第二种方式所对应的计算。分析模块用于分析SQL语句的第一执行计划的性能是否劣化,并在确定第一执行计划的性能劣化后,进行第一执行计划的替换。其中,诊断子模块用于诊断SQL语句的第一执行计划的性能是否劣化,其可以执行前述步骤202;优化子模块用于在诊断子模块确定第一执行计划的性能劣化后,进行第一执行计划的替换,其可以执行前述步骤203至步骤205。操作模块用于对数据库系统中的操作进行管理,其中,集群管理子模块用于管理数据库集群,实例管理子模块用于管理数据库实例。告警模块用于发送告警指示信息。The artificial intelligence calculation engine may store the aforementioned first artificial intelligence model and the aforementioned second artificial intelligence model, and perform corresponding calculations based on the stored artificial intelligence model. For example, perform the calculation corresponding to the aforementioned step A111 and the second method provided by the aforementioned step A114. The analysis module is used to analyze whether the performance of the first execution plan of the SQL statement is deteriorated, and after determining that the performance of the first execution plan is deteriorated, perform replacement of the first execution plan. Among them, the diagnosis sub-module is used to diagnose whether the performance of the first execution plan of the SQL statement is degraded, which can execute the aforementioned step 202; the optimization sub-module is used to perform the first execution after the diagnosis sub-module determines that the performance of the first execution plan is degraded For the planned replacement, it can execute the aforementioned step 203 to step 205. The operation module is used to manage operations in the database system, where the cluster management sub-module is used to manage the database cluster, and the instance management sub-module is used to manage the database instance. The alarm module is used to send alarm indication information.
该数据库系统还包括多个数据库,该多个数据库包括:一个或多个关系型数据库,一个或多个指标数据库以及配置数据库。The database system also includes multiple databases, the multiple databases including: one or more relational databases, one or more index databases, and a configuration database.
其中,关系型数据库为该数据库系统所主要维护的数据库,图8以关系型数据库共3个,分别为数据库1至3为例进行说明。每个数据库包括管理节点和该管理节点所管理的一个或多个数据节点,每个数据库可以提供系统视图、SQL指标和/或管理节点的应用程序接口(Application Programming Interface,API)。该SQL指标指的是前述SQL语句的执行计划的运行指标。管理节点API指的是数据库中的管理节点的API。Among them, the relational database is the database mainly maintained by the database system. Fig. 8 takes a total of 3 relational databases, databases 1 to 3 respectively, as an example for illustration. Each database includes a management node and one or more data nodes managed by the management node, and each database can provide system views, SQL indicators, and/or an application programming interface (API) of the management node. The SQL indicator refers to the operation indicator of the execution plan of the aforementioned SQL statement. The management node API refers to the API of the management node in the database.
指标数据库用于存储本申请实施例提供的执行计划的处理方法所涉及的数据,本申请实施例中,指标数据库的个数可以根据存储的数据量的增长而增长。图8以指标数据库共3个,分别为指标数据库1至3为例进行说明。配置数据库用于存储数据库系统中的规则,如SQL性能对比规则、著录提示标签设置规则、告警规则和/或路由规则。该数据库系统维护有操作系统(operating system,OS),该操作系统可以为Linux或Windows操作系统。该操作系统可以控制CPU、磁盘(disk)、存储器(memory)、网络(network)和/或主板(mainboard)等。The index database is used to store the data involved in the processing method of the execution plan provided in the embodiment of the present application. In the embodiment of the present application, the number of the index database may increase according to the increase in the amount of stored data. Figure 8 takes a total of 3 index databases, namely index databases 1 to 3 as examples. The configuration database is used to store rules in the database system, such as SQL performance comparison rules, description prompt label setting rules, alarm rules and/or routing rules. The database system is maintained with an operating system (OS), and the operating system may be a Linux or Windows operating system. The operating system can control CPU, disk, memory, network, and/or mainboard, etc.
该数据库系统在原有的数据库服务的基础上,按照功能又增加了采集层、存储与处理层、服务层和页面(view)层。其中,采集层与存储与处理层之间具有API,服务层和页面层之间具有API。页面层可以提供可视化页面。通过该可视化页面,用户可以控制是否进行执行 计划的干预,或者输入执行计划版本更新指令,或者输入执行计划干预指令。例如,该可视化页面可以呈现如图7所示的用户界面。Based on the original database service, the database system adds a collection layer, a storage and processing layer, a service layer, and a page (view) layer according to functions. Among them, there is an API between the collection layer and the storage and processing layer, and there is an API between the service layer and the page layer. The page layer can provide visual pages. Through this visualization page, the user can control whether to intervene in the execution plan, or enter the execution plan version update instruction, or enter the execution plan intervention instruction. For example, the visualization page may present a user interface as shown in FIG. 7.
为了便于读者理解,本申请实施例基于图8所示的数据库系统的示意性的结构,对执行计划的处理方法进行示意性说明。优化节点可以在数据库系统中的每个数据库所在主机上布置代理模块,每个代理模块采集所部署的数据库主机上的运行指标对应的数据,并将采集到的数据发送至处理模块。示例的,代理模块可以采用消息队列(message queue,MQ)的方式将采集到的发送至处理模块,由处理模块对接收到的数据进行流式处理。并且处理模块可以将数据库系统的系统表(如前述实施例中的系统表)里存储的所有SQL语句的执行计划存储至与管理节点对应的指标数据库中。处理模块进行流式处理的方式可以分为在线(online)和离线(offline)两种方式。可选地,处理模块可以获取人工智能计算引擎计算得到的各个运行指标的性能基线,并将各个运行指标的性能基线存储至指标数据库中。可选地,用户可以通过前述规则设置指令设置路由规则,相应的,处理模块基于设置的路由规则在指标数据库中存储SQL语句的执行计划的运行指标对应的数据和/或各个运行指标的性能基线。假设数据库X为前述数据库1至3中的任一数据库,分析模块分析数据库X中的SQL语句的第一执行计划的性能是否劣化,并在确定第一执行计划的性能劣化后,由优化子模块获取所述SQL语句的第二执行计划,控制数据库X执行所述第二执行计划来替换对所述第一执行计划的执行。告警模块在达到告警条件后发出告警指示信息。In order to facilitate readers' understanding, the embodiment of the present application is based on the schematic structure of the database system shown in FIG. 8 to schematically illustrate the processing method of the execution plan. The optimization node can arrange proxy modules on the host where each database in the database system is located, and each proxy module collects data corresponding to the running indicators on the deployed database host, and sends the collected data to the processing module. For example, the proxy module may use a message queue (MQ) method to send the collected data to the processing module, and the processing module performs streaming processing on the received data. And the processing module can store the execution plans of all SQL statements stored in the system table of the database system (such as the system table in the foregoing embodiment) into the index database corresponding to the management node. The way the processing module performs streaming processing can be divided into online (online) and offline (offline) two ways. Optionally, the processing module may obtain the performance baseline of each operation index calculated by the artificial intelligence calculation engine, and store the performance baseline of each operation index in the index database. Optionally, the user can set routing rules through the aforementioned rule setting instructions. Correspondingly, the processing module stores the data corresponding to the operating indicators of the execution plan of the SQL statement in the indicator database based on the set routing rules and/or the performance baseline of each operating indicator. . Assuming that the database X is any one of the aforementioned databases 1 to 3, the analysis module analyzes whether the performance of the first execution plan of the SQL statement in the database X has deteriorated, and after determining the performance deterioration of the first execution plan, the optimization sub-module The second execution plan of the SQL statement is acquired, and the database X is controlled to execute the second execution plan to replace the execution of the first execution plan. The alarm module sends out alarm indication information after reaching the alarm condition.
传统的数据库系统,由于每个执行计划会在一段时间(如几周)内持续使用,若该执行计划本身性能较差,会在该段时间内影响数据库的性能,严重的情况下会导致大规模数据库版本回退,造成长时间的业务中断。In traditional database systems, since each execution plan will continue to be used for a period of time (such as several weeks), if the execution plan itself has poor performance, it will affect the performance of the database during this period of time. In severe cases, it will cause large The large-scale database version is rolled back, causing long-term business interruption.
而本申请实施例在分析到第一执行计划的性能劣化后,会采用第二执行计划替换第一执行计划,以避免数据库使用性能劣化的第一执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。可选地,该第二执行计划的性能优于第一执行计划的性能时,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。After analyzing the performance degradation of the first execution plan, the embodiment of the present application will replace the first execution plan with the second execution plan to prevent the database from using the first execution plan with performance degradation and reduce the impact of the performance plan on the database. Influence, thereby ensuring the performance of the database. Optionally, when the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, database version rollbacks can be avoided, and the duration of business interruption can be reduced.
基于与上述实施例提供的执行计划的处理方法的同一构思,本申请实施例提供一种执行计划的处理方法,图9是本申请实施例提供的该执行计划的处理方法的流程示意图。该方法可以由前述数据库系统10执行。所述方法包括:Based on the same concept as the processing method of the execution plan provided in the above embodiment, an embodiment of the present application provides a processing method of an execution plan. FIG. 9 is a schematic flowchart of the processing method of the execution plan provided in an embodiment of the present application. This method can be executed by the aforementioned database system 10. The method includes:
步骤401、数据库系统执行SQL语句的第一执行计划。Step 401: The database system executes the first execution plan of the SQL statement.
步骤401的过程可以参考前述步骤201的过程,本申请实施例对此不做赘述。For the process of step 401, reference may be made to the process of step 201, which is not described in detail in the embodiment of the present application.
步骤402、数据库系统获取SQL语句的新版本的第二执行计划。Step 402: The database system obtains the second execution plan of the new version of the SQL statement.
步骤402的数据库系统获取SQL语句的新版本的第二执行计划过程可以参考前述步骤206数据库系统获取SQL语句的新版本的执行计划(即第三执行计划)的过程,本申请实施例对此不做赘述。The process of obtaining the second execution plan of the new version of the SQL statement by the database system in step 402 can refer to the process of obtaining the execution plan of the new version of the SQL statement by the database system in step 206 (that is, the third execution plan). Do repeat.
例如,第二执行计划由管理节点生成,或者由用户通过执行计划版本更新指令输入。For example, the second execution plan is generated by the management node or input by the user through the execution plan version update instruction.
可选地,获取该SQL语句的新版本的第二执行计划包括:生成该SQL语句的第二执行计划,该生成该SQL语句的第二执行计划的过程可以包括:基于管理节点所在数据库的优化规则信息和/或优化成本信息,生成多个备选执行计划;遍历该多个备选执行计划,得到该第二执行计划。Optionally, obtaining the second execution plan of the new version of the SQL statement includes: generating the second execution plan of the SQL statement, and the process of generating the second execution plan of the SQL statement may include: optimization based on the database where the management node is located Rule information and/or optimization cost information to generate multiple candidate execution plans; traverse the multiple candidate execution plans to obtain the second execution plan.
步骤403、在第二执行计划的性能优于第一执行计划的性能时,数据库系统执行第二执行计划来替换对第一执行计划的执行。Step 403: When the performance of the second execution plan is better than the performance of the first execution plan, the database system executes the second execution plan to replace the execution of the first execution plan.
步骤403的过程可以参考前述步骤206数据库系统执行第三执行计划来替换对第二执行计划的执行的过程,本申请实施例对此不做赘述。其中,步骤403中的第二执行计划相当于步骤206中的第三执行计划,步骤403中的第一执行计划相当于步骤206中的第二执行计划。The process of step 403 may refer to the process of executing the third execution plan by the database system in step 206 to replace the execution of the second execution plan, which is not described in detail in the embodiment of the present application. The second execution plan in step 403 is equivalent to the third execution plan in step 206, and the first execution plan in step 403 is equivalent to the second execution plan in step 206.
值得说明的是,该执行计划的处理方法还支持前述实施例中提供的其他功能,例如在步骤403之前,例如在确定该第二执行计划的性能优于该第一执行计划的性能后,数据库系统将第二执行计划转化为与管理节点匹配的第二执行计划,该过程可以参考前述步骤204。本申请实施例对此不再赘述。It is worth noting that the execution plan processing method also supports other functions provided in the foregoing embodiments. For example, before step 403, for example, after determining that the performance of the second execution plan is better than that of the first execution plan, the database The system converts the second execution plan into a second execution plan that matches the management node. For this process, refer to the aforementioned step 204. This is not repeated in the embodiment of the application.
传统的数据库系统中,当管理节点生成新版本的执行计划后,直接执行新版本的执行计划来替换原执行计划的执行,而该新版本的执行计划会在一段时间(如几周)内持续使用,若该新版本的执行计划本身性能较差,会在该段时间内影响数据库的性能。严重的情况下会导致大规模数据库版本回退,造成长时间的业务中断。In a traditional database system, when the management node generates a new version of the execution plan, it directly executes the new version of the execution plan to replace the execution of the original execution plan, and the new version of the execution plan will continue for a period of time (such as a few weeks) Use, if the performance of the new version of the execution plan itself is poor, it will affect the performance of the database during this period of time. In severe cases, large-scale database versions will be rolled back, causing long-term business interruption.
而本申请实施例在新版本的第二执行计划的性能优于第一执行计划的性能时,数据库系统才执行第二执行计划来替换对第一执行计划的执行,以避免数据库采用性能劣化的新版本的执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。并且,由于该第二执行计划的性能优于第一执行计划的性能,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。In the embodiment of this application, when the performance of the new version of the second execution plan is better than the performance of the first execution plan, the database system executes the second execution plan to replace the execution of the first execution plan, so as to avoid the use of degraded performance in the database. The new version of the execution plan reduces the impact of degraded execution plans on the database, thereby ensuring the performance of the database. In addition, since the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
图10是本申请实施例提供一种数据库系统50的框图,该数据库系统50包括:FIG. 10 is a block diagram of a database system 50 provided by an embodiment of the present application. The database system 50 includes:
执行模块501,用于执行结构化查询语言SQL语句的第一执行计划。获取模块502,用于在该SQL语句的第一执行计划的性能劣化时,获取该SQL语句的第二执行计划。该执行模块502还用于执行该第二执行计划来替换对该第一执行计划的执行。The execution module 501 is used to execute the first execution plan of the structured query language SQL statement. The obtaining module 502 is configured to obtain the second execution plan of the SQL statement when the performance of the first execution plan of the SQL statement deteriorates. The execution module 502 is also used to execute the second execution plan to replace the execution of the first execution plan.
本申请实施例中,执行模块在第一执行计划的性能劣化后,会采用第二执行计划替换第一执行计划,以避免数据库使用性能劣化的第一执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。In the embodiment of the present application, after the performance of the first execution plan is deteriorated, the execution module will replace the first execution plan with the second execution plan, so as to avoid the use of the first execution plan of the performance deterioration of the database, and reduce the effect of the execution plan of the performance deterioration on the database. The impact of this to ensure the performance of the database.
可选地,该第二执行计划与该第一执行计划不同。Optionally, the second execution plan is different from the first execution plan.
可选地,该第二执行计划的性能优于该第一执行计划的性能。该第二执行计划的性能优于第一执行计划的性能时,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。Optionally, the performance of the second execution plan is better than the performance of the first execution plan. When the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, database version rollbacks can be avoided, and the duration of business interruption can be reduced.
可选地,该获取模块502,用于:获取该SQL语句的历史执行计划;当该历史执行计划的性能优于该第一执行计划的性能时,将该历史执行计划作为该第二执行计划。Optionally, the obtaining module 502 is configured to: obtain a historical execution plan of the SQL statement; when the performance of the historical execution plan is better than that of the first execution plan, use the historical execution plan as the second execution plan .
可选地,该获取模块502,用于:生成该SQL语句的第二执行计划。Optionally, the obtaining module 502 is configured to generate a second execution plan of the SQL statement.
可选地,生成该SQL语句的第二执行计划所占用的计算资源大于生成该SQL语句的第一执行计划所占用的计算资源,和/或,生成该SQL语句的第二执行计划的时长大于生成该SQL语句的第一执行计划的时长。Optionally, the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or the duration of the second execution plan for generating the SQL statement is greater than The duration of the first execution plan for generating the SQL statement.
图11是本申请实施例提供一种数据库系统50的框图,该数据库系统50包括:告警模块503,用于在该SQL语句的第一执行计划的性能劣化时,发送告警指示信息。可选地,该获取模块502,用于:在接收到执行计划优化指令后,获取该SQL语句的第二执行计划。FIG. 11 is a block diagram of a database system 50 provided by an embodiment of the present application. The database system 50 includes an alarm module 503 for sending alarm indication information when the performance of the first execution plan of the SQL statement deteriorates. Optionally, the obtaining module 502 is configured to obtain the second execution plan of the SQL statement after receiving the execution plan optimization instruction.
可选地,该执行模块501,还用于:在新版本的执行计划的性能优于该第二执行计划的性能时,执行该新版本的执行计划来替换对该第二执行计划的执行。Optionally, the execution module 501 is further configured to execute the new version of the execution plan to replace the execution of the second execution plan when the performance of the new version of the execution plan is better than the performance of the second execution plan.
图12是本申请实施例提供另一种数据库系统50的框图,该数据库系统50还包括:确定模块504,用于当该第一执行计划的运行指标出现异常时,确定该SQL语句的第一执行计划的性能劣化。12 is a block diagram of another database system 50 provided by an embodiment of the present application. The database system 50 further includes: a determining module 504, configured to determine the first SQL statement when an abnormality occurs in the operation index of the first execution plan. The performance of the execution plan is degraded.
可选地,该第一执行计划的运行指标包括以下的一种或多种:该第一执行计划的输入输出IO指标、时延、错误信息、执行次数和处理时长。Optionally, the operation indicators of the first execution plan include one or more of the following: input and output IO indicators, time delay, error information, execution times, and processing duration of the first execution plan.
可选地,该确定模块504,用于:对于该第一执行计划的运行指标中的每个运行指标,当该运行指标对应的运行指标数据组指示的性能低于该运行指标对应的该SQL语句的历史运行指标数据组指示的性能,确定该运行指标出现异常;和/或,对于该第一执行计划的运行指标中的每个运行指标,将该运行指标对应的运行指标数据组输入第一人工智能模型,当该第一人工智能模型输出指示该运行指标异常的指示信息,确定该运行指标出现异常。Optionally, the determining module 504 is configured to: for each operating indicator in the operating indicators of the first execution plan, when the performance indicated by the operating indicator data group corresponding to the operating indicator is lower than the SQL corresponding to the operating indicator The performance indicated by the statement’s historical operating indicator data group is determined to be abnormal; and/or, for each operating indicator in the operating indicators of the first execution plan, the operating indicator data group corresponding to the operating indicator is entered in the first An artificial intelligence model, when the first artificial intelligence model outputs indication information indicating that the operation index is abnormal, it is determined that the operation index is abnormal.
可选地,该确定模块504,用于:Optionally, the determining module 504 is configured to:
对于该第一执行计划的运行指标中的每个运行指标,当该运行指标对应的运行指标数据组的性能曲线与该运行指标的性能基线不匹配时,确定该运行指标对应的运行指标数据组指示的性能低于该历史运行指标数据组指示的性能,该运行指标的性能基线基于该历史运行指标数据组确定。For each operating indicator in the operating indicators of the first execution plan, when the performance curve of the operating indicator data group corresponding to the operating indicator does not match the performance baseline of the operating indicator, determine the operating indicator data group corresponding to the operating indicator The indicated performance is lower than the performance indicated by the historical operating indicator data set, and the performance baseline of the operating indicator is determined based on the historical operating indicator data set.
图13是本申请实施例提供又一种数据库系统50的框图,该数据库系统50还包括:基线生成模块505,用于基于第二人工智能模型以及该历史运行指标数据组,生成该运行指标的性能基线。13 is a block diagram of another database system 50 provided by an embodiment of the present application. The database system 50 further includes: a baseline generation module 505, configured to generate the operating index based on the second artificial intelligence model and the historical operating indicator data set. Performance baseline.
值得说明的是,本申请实施例提供的一种数据库系统的结构还可以为前述图1或图8所示的数据库系统。It is worth noting that the structure of a database system provided by an embodiment of the present application may also be the database system shown in FIG. 1 or FIG. 8 described above.
示例的,当数据库系统的结构为前述图1所示的数据库系统的结构时,前述执行模块501可以集成在管理节点101和数据节点102中,以由管理节点101和数据节点102配合完成执行模块501的功能,或者,前述执行模块501可以集成在管理节点101中,以由管理节点101完成执行模块501的功能;获取模块502、告警模块503、确定模块504和基线生成模块505中的一个或多个模块可以集成在优化节点103中,以由优化节点103完成该一个或多个模块的功能。For example, when the structure of the database system is the structure of the database system shown in FIG. 1, the foregoing execution module 501 can be integrated in the management node 101 and the data node 102, so that the management node 101 and the data node 102 cooperate to complete the execution module The function of 501, or the aforementioned execution module 501 can be integrated in the management node 101, so that the management node 101 completes the function of the execution module 501; one of the acquisition module 502, the alarm module 503, the determination module 504 and the baseline generation module 505 or Multiple modules may be integrated in the optimization node 103, so that the optimization node 103 completes the function of the one or more modules.
示例的,当数据库系统的结构为前述图8所示的数据库系统的结构时,前述执行模块501可以集成在数据库中,如数据库1至数据库3中的至少一个数据库中,以由该至少一个数据库完成执行模块501的功能;获取模块502可以集成在处理模块中,以由该处理模块完成获取模块502的功能,告警模块503的功能与图8中的告警模块的功能相同;确定模块504可以集成在分析模块中,以由该分析模块完成确定模块504的功能;基线生成模块505可以集成在人工智能计算引擎中,以由该人工智能计算引擎完成基线生成模块505的功能。For example, when the structure of the database system is the structure of the database system shown in FIG. 8, the execution module 501 may be integrated in the database, such as at least one of the databases 1 to 3, so that the at least one database Complete the function of the execution module 501; the acquisition module 502 can be integrated in the processing module to complete the function of the acquisition module 502 by the processing module. The function of the alarm module 503 is the same as that of the alarm module in FIG. 8; the determination module 504 can be integrated In the analysis module, the analysis module completes the function of the determination module 504; the baseline generation module 505 can be integrated into the artificial intelligence calculation engine, so that the artificial intelligence calculation engine completes the function of the baseline generation module 505.
图14是本申请实施例提供又一种数据库系统60的框图,该数据库系统60包括:FIG. 14 is a block diagram of another database system 60 provided by an embodiment of the present application. The database system 60 includes:
执行模块601,用于执行结构化查询语言SQL语句的第一执行计划;获取模块602,用于获取该SQL语句的新版本的第二执行计划;该执行模块602还用于在该第二执行计划的性能优于该第一执行计划的性能时,执行该第二执行计划来替换对该第一执行计划的执行。The execution module 601 is used to execute the first execution plan of the structured query language SQL statement; the obtaining module 602 is used to obtain the second execution plan of the new version of the SQL statement; the execution module 602 is also used to execute the second execution plan of the SQL statement. When the performance of the plan is better than the performance of the first execution plan, the second execution plan is executed to replace the execution of the first execution plan.
值得说明的是,本申请实施例提供的一种数据库系统的结构还可以为前述图1所示的数据库系统。It is worth noting that the structure of a database system provided by an embodiment of the present application may also be the database system shown in FIG. 1 described above.
示例的,当数据库系统的结构为前述图1所示的数据库系统的结构时,前述执行模块601可以集成在管理节点101和数据节点102中,以由管理节点101和数据节点102配合完成执行模块601的功能,或者,前述执行模块601可以集成在管理节点101中,以由管理节点101完成执行模块601的功能;获取模块602可以集成在优化节点103中,以由优化节点103完成执行模块602的功能。For example, when the structure of the database system is the structure of the database system shown in FIG. 1, the foregoing execution module 601 can be integrated in the management node 101 and the data node 102, so that the management node 101 and the data node 102 cooperate to complete the execution module The function of 601, or the aforementioned execution module 601 can be integrated in the management node 101, so that the management node 101 completes the function of the execution module 601; the acquisition module 602 can be integrated in the optimization node 103, so that the optimization node 103 completes the execution module 602 Function.
本申请实施例中,在新版本的第二执行计划的性能优于第一执行计划的性能时,执行模块才执行第二执行计划来替换对第一执行计划的执行,以避免数据库采用性能劣化的新版本的执行计划,减少性能劣化的执行计划对数据库的影响,从而保证数据库的性能。并且,由于该第二执行计划的性能优于第一执行计划的性能,可以有效保证数据库的性能,避免数据库版本回退,减少业务中断时长。In the embodiment of the present application, when the performance of the new version of the second execution plan is better than the performance of the first execution plan, the execution module executes the second execution plan to replace the execution of the first execution plan, so as to avoid performance degradation of the database adoption The new version of the execution plan reduces the impact of performance-degraded execution plans on the database, thereby ensuring the performance of the database. In addition, since the performance of the second execution plan is better than the performance of the first execution plan, the performance of the database can be effectively guaranteed, the database version rollback can be avoided, and the duration of business interruption can be reduced.
可选地,图15示意性地提供本申请该计算机设备的一种可能的基本硬件架构。Optionally, FIG. 15 schematically provides a possible basic hardware architecture of the computer device of the present application.
参见图15,计算机设备700包括处理器701、存储器702、通信接口703和总线704。Referring to FIG. 15, the computer device 700 includes a processor 701, a memory 702, a communication interface 703, and a bus 704.
计算机设备700中,处理器701的数量可以是一个或多个,图15仅示意了其中一个处理器701。可选地,处理器701,可以是中央处理器(central processing unit,CPU)。如果计算机设备700具有多个处理器701,多个处理器701的类型可以不同,或者可以相同。可选地,计算机设备700的多个处理器701还可以集成为多核处理器。In the computer device 700, the number of processors 701 may be one or more, and FIG. 15 only illustrates one of the processors 701. Optionally, the processor 701 may be a central processing unit (CPU). If the computer device 700 has multiple processors 701, the types of the multiple processors 701 may be different or may be the same. Optionally, multiple processors 701 of the computer device 700 may also be integrated into a multi-core processor.
存储器702存储计算机指令和数据;存储器702可以存储实现本申请提供的执行计划的处理方法所需的计算机指令和数据,例如,存储器702存储用于实现执行计划的处理方法的步骤的指令。存储器702可以是以下存储介质的任一种或任一种组合:非易失性存储器(例如只读存储器(ROM)、固态硬盘(SSD)、硬盘(HDD)、光盘),易失性存储器。The memory 702 stores computer instructions and data; the memory 702 may store computer instructions and data required to implement the processing method of the execution plan provided in the present application. For example, the memory 702 stores instructions for implementing the steps of the processing method of the execution plan. The memory 702 may be any one or any combination of the following storage media: non-volatile memory (for example, read only memory (ROM), solid state drive (SSD), hard disk (HDD), optical disc), volatile memory.
通信接口703可以是以下器件的任一种或任一种组合:网络接口(例如以太网接口)、无线网卡等具有网络接入功能的器件。The communication interface 703 may be any one or any combination of the following devices: a network interface (for example, an Ethernet interface), a wireless network card, and other devices with a network access function.
通信接口703用于计算机设备700与其它计算机设备或者终端进行数据通信。The communication interface 703 is used for data communication between the computer device 700 and other computer devices or terminals.
总线704可以将处理器701与存储器702和通信接口703连接。这样,通过总线704,处理器701可以访问存储器702,还可以利用通信接口703与其它计算机设备或者终端进行数据交互。The bus 704 can connect the processor 701 with the memory 702 and the communication interface 703. In this way, through the bus 704, the processor 701 can access the memory 702, and can also use the communication interface 703 to interact with other computer devices or terminals.
在本申请中,计算机设备700执行存储器702中的计算机指令,使得计算机设备700实现本申请提供的执行计划的处理方法,或者使得计算机设备700部署数据库系统。In this application, the computer device 700 executes the computer instructions in the memory 702, so that the computer device 700 implements the processing method of the execution plan provided in this application, or causes the computer device 700 to deploy a database system.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器,上述指令可由服务器的处理器执行以完成本申请各个实施例所示的执行计划的处理方法。例如,该非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as a memory including instructions, which can be executed by a processor of a server to complete the execution plan shown in each embodiment of the present application.的处理方法。 Treatment methods. For example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现,所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产 生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机的可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质,或者半导体介质(例如固态硬盘)等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in the form of a computer program product in whole or in part, and the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, all or part of them are generated in accordance with the procedures or functions described in the embodiments of the present application. The computer may be a general-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data. The center transmits to another website, computer, server, or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium, or a semiconductor medium (for example, a solid state hard disk).
在本申请中,术语“第一”、“第二”和“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。术语“至少一个”表示1个或多个,术语“多个”指两个或两个以上,除非另有明确的限定。A参考B,指的是A与B相同或者A为B的简单变形。In this application, the terms "first", "second" and "third" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance. The term "at least one" means one or more, and the term "plurality" means two or more, unless specifically defined otherwise. A refers to B, which means that A is the same as B or A is a simple modification of B.
需要说明的是:上述实施例提供的数据库系统在执行该执行计划的处理方法时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的数据库系统与执行计划的处理方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the database system provided in the above embodiment executes the processing method of the execution plan, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functions according to needs. Module completion, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the database system provided in the foregoing embodiment and the execution plan processing method embodiment belong to the same concept. For the specific implementation process, please refer to the method embodiment, which will not be repeated here.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person of ordinary skill in the art can understand that all or part of the steps in the above embodiments can be implemented by hardware, or by a program to instruct relevant hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above are only optional embodiments of this application and are not intended to limit this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection of this application. Within range.

Claims (32)

  1. 一种执行计划的处理方法,其特征在于,所述方法包括:An execution plan processing method, characterized in that the method includes:
    执行结构化查询语言SQL语句的第一执行计划;The first execution plan for executing the structured query language SQL statement;
    在所述SQL语句的第一执行计划的性能劣化时,获取所述SQL语句的第二执行计划;When the performance of the first execution plan of the SQL statement deteriorates, acquiring the second execution plan of the SQL statement;
    执行所述第二执行计划来替换对所述第一执行计划的执行。The second execution plan is executed to replace the execution of the first execution plan.
  2. 根据权利要求1所述的方法,其特征在于,所述第二执行计划与所述第一执行计划不同。The method according to claim 1, wherein the second execution plan is different from the first execution plan.
  3. 根据权利要求2所述的方法,其特征在于,所述第二执行计划的性能优于所述第一执行计划的性能。The method according to claim 2, wherein the performance of the second execution plan is better than the performance of the first execution plan.
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述获取所述SQL语句的第二执行计划,包括:The method according to any one of claims 1 to 3, wherein the obtaining the second execution plan of the SQL statement comprises:
    获取所述SQL语句的历史执行计划;Acquiring the historical execution plan of the SQL statement;
    当所述历史执行计划的性能优于所述第一执行计划的性能时,将所述历史执行计划作为所述第二执行计划。When the performance of the historical execution plan is better than the performance of the first execution plan, the historical execution plan is used as the second execution plan.
  5. 根据权利要求1至3任一所述的方法,其特征在于,所述获取所述SQL语句的第二执行计划,包括:The method according to any one of claims 1 to 3, wherein the obtaining the second execution plan of the SQL statement comprises:
    生成所述SQL语句的第二执行计划。Generate a second execution plan of the SQL statement.
  6. 根据权利要求5所述的方法,其特征在于,生成所述SQL语句的第二执行计划所占用的计算资源大于生成所述SQL语句的第一执行计划所占用的计算资源,和/或,生成所述SQL语句的第二执行计划的时长大于生成所述SQL语句的第一执行计划的时长。The method according to claim 5, wherein the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or generating The duration of the second execution plan of the SQL statement is greater than the duration of the first execution plan of the SQL statement.
  7. 根据权利要求1至6任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 6, wherein the method further comprises:
    在所述SQL语句的第一执行计划的性能劣化时,发送告警指示信息。When the performance of the first execution plan of the SQL statement deteriorates, an alarm indication message is sent.
  8. 根据权利要求1至7任一所述的方法,其特征在于,所述获取所述SQL语句的第二执行计划,包括:The method according to any one of claims 1 to 7, wherein the obtaining the second execution plan of the SQL statement comprises:
    在接收到执行计划优化指令后,获取所述SQL语句的第二执行计划。After receiving the execution plan optimization instruction, the second execution plan of the SQL statement is acquired.
  9. 根据权利要求1至8任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 8, wherein the method further comprises:
    在新版本的执行计划的性能优于所述第二执行计划的性能时,执行所述新版本的执行计划来替换对所述第二执行计划的执行。When the performance of the new version of the execution plan is better than the performance of the second execution plan, the new version of the execution plan is executed to replace the execution of the second execution plan.
  10. 根据权利要求1至9任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 9, wherein the method further comprises:
    当所述第一执行计划的运行指标出现异常时,确定所述SQL语句的第一执行计划的性能劣化。When the operation index of the first execution plan is abnormal, it is determined that the performance of the first execution plan of the SQL statement is degraded.
  11. 根据权利要求10所述的方法,其特征在于,所述第一执行计划的运行指标包括以下的一种或多种:The method according to claim 10, wherein the operation index of the first execution plan includes one or more of the following:
    所述第一执行计划的输入输出IO指标、时延、错误信息、执行次数和处理时长。The input and output IO indicators, time delay, error information, execution times, and processing duration of the first execution plan.
  12. 根据权利要求10或11所述的方法,其特征在于,所述方法还包括:The method according to claim 10 or 11, wherein the method further comprises:
    对于所述第一执行计划的运行指标中的每个运行指标,当所述运行指标对应的运行指标数据组指示的性能低于所述运行指标对应的所述SQL语句的历史运行指标数据组指示的性能,确定所述运行指标出现异常;For each operating indicator in the operating indicators of the first execution plan, when the performance indicated by the operating indicator data set corresponding to the operating indicator is lower than the historical operating indicator data set of the SQL statement corresponding to the operating indicator To determine that the operating index is abnormal;
    和/或,对于所述第一执行计划的运行指标中的每个运行指标,将所述运行指标对应的运行指标数据组输入第一人工智能模型,当所述第一人工智能模型输出指示所述运行指标异常的指示信息,确定所述运行指标出现异常。And/or, for each operation index in the operation index of the first execution plan, the operation index data group corresponding to the operation index is input into the first artificial intelligence model, and when the first artificial intelligence model outputs the instruction According to the indication information of abnormal operation index, it is determined that the operation index is abnormal.
  13. 根据权利要求12所述的方法,其特征在于,所述方法还包括:The method according to claim 12, wherein the method further comprises:
    对于所述第一执行计划的运行指标中的每个运行指标,当所述运行指标对应的运行指标数据组的性能曲线与所述运行指标的性能基线不匹配时,确定所述运行指标对应的运行指标数据组指示的性能低于所述历史运行指标数据组指示的性能,所述运行指标的性能基线基于所述历史运行指标数据组确定。For each operating indicator in the operating indicators of the first execution plan, when the performance curve of the operating indicator data group corresponding to the operating indicator does not match the performance baseline of the operating indicator, determine the corresponding operating indicator The performance indicated by the operating index data set is lower than the performance indicated by the historical operating indicator data set, and the performance baseline of the operating indicator is determined based on the historical operating indicator data set.
  14. 根据权利要求13所述的方法,其特征在于,所述方法还包括:The method according to claim 13, wherein the method further comprises:
    基于第二人工智能模型以及所述历史运行指标数据组,生成所述运行指标的性能基线。Based on the second artificial intelligence model and the historical operating indicator data set, a performance baseline of the operating indicator is generated.
  15. 一种执行计划的处理方法,其特征在于,所述方法包括:An execution plan processing method, characterized in that the method includes:
    执行结构化查询语言SQL语句的第一执行计划;The first execution plan for executing the structured query language SQL statement;
    获取所述SQL语句的新版本的第二执行计划;Acquiring a second execution plan of the new version of the SQL statement;
    在所述第二执行计划的性能优于所述第一执行计划的性能时,执行所述第二执行计划来替换对所述第一执行计划的执行。When the performance of the second execution plan is better than the performance of the first execution plan, the second execution plan is executed to replace the execution of the first execution plan.
  16. 一种数据库系统,其特征在于,所述数据库系统包括:A database system, characterized in that, the database system includes:
    执行模块,用于执行结构化查询语言SQL语句的第一执行计划;The execution module is used to execute the first execution plan of the structured query language SQL statement;
    获取模块,用于在所述SQL语句的第一执行计划的性能劣化时,获取所述SQL语句的第二执行计划;An obtaining module, configured to obtain the second execution plan of the SQL statement when the performance of the first execution plan of the SQL statement deteriorates;
    所述执行模块还用于执行所述第二执行计划来替换对所述第一执行计划的执行。The execution module is further configured to execute the second execution plan to replace the execution of the first execution plan.
  17. 根据权利要求16所述的数据库系统,其特征在于,所述第二执行计划与所述第一执行计划不同。The database system according to claim 16, wherein the second execution plan is different from the first execution plan.
  18. 根据权利要求17所述的数据库系统,其特征在于,所述第二执行计划的性能优于所述第一执行计划的性能。The database system according to claim 17, wherein the performance of the second execution plan is better than the performance of the first execution plan.
  19. 根据权利要求16至18任一所述的数据库系统,其特征在于,所述获取模块,用于:The database system according to any one of claims 16 to 18, wherein the acquisition module is configured to:
    获取所述SQL语句的历史执行计划;Acquiring the historical execution plan of the SQL statement;
    当所述历史执行计划的性能优于所述第一执行计划的性能时,将所述历史执行计划作为所述第二执行计划。When the performance of the historical execution plan is better than the performance of the first execution plan, the historical execution plan is used as the second execution plan.
  20. 根据权利要求16至18任一所述的数据库系统,其特征在于,所述获取模块,用于:The database system according to any one of claims 16 to 18, wherein the acquisition module is configured to:
    生成所述SQL语句的第二执行计划。Generate a second execution plan of the SQL statement.
  21. 根据权利要求20所述的数据库系统,其特征在于,生成所述SQL语句的第二执行计划所占用的计算资源大于生成所述SQL语句的第一执行计划所占用的计算资源,和/或,生成所述SQL语句的第二执行计划的时长大于生成所述SQL语句的第一执行计划的时长。The database system according to claim 20, wherein the computing resources occupied by the second execution plan for generating the SQL statement are greater than the computing resources occupied by the first execution plan for generating the SQL statement, and/or, The duration of generating the second execution plan of the SQL statement is greater than the duration of generating the first execution plan of the SQL statement.
  22. 根据权利要求16至21任一所述的数据库系统,其特征在于,所述数据库系统还包括:The database system according to any one of claims 16 to 21, wherein the database system further comprises:
    告警模块,用于在所述SQL语句的第一执行计划的性能劣化时,发送告警指示信息。The alarm module is used to send alarm indication information when the performance of the first execution plan of the SQL statement deteriorates.
  23. 根据权利要求16至22任一所述的数据库系统,其特征在于,所述获取模块,用于:The database system according to any one of claims 16 to 22, wherein the acquisition module is configured to:
    在接收到执行计划优化指令后,获取所述SQL语句的第二执行计划。After receiving the execution plan optimization instruction, the second execution plan of the SQL statement is acquired.
  24. 根据权利要求16至23任一所述的数据库系统,其特征在于,所述执行模块,还用于:The database system according to any one of claims 16 to 23, wherein the execution module is further configured to:
    在新版本的执行计划的性能优于所述第二执行计划的性能时,执行所述新版本的执行计划来替换对所述第二执行计划的执行。When the performance of the new version of the execution plan is better than the performance of the second execution plan, the new version of the execution plan is executed to replace the execution of the second execution plan.
  25. 根据权利要求16至24任一所述的数据库系统,其特征在于,所述数据库系统还包括:The database system according to any one of claims 16 to 24, wherein the database system further comprises:
    确定模块,用于当所述第一执行计划的运行指标出现异常时,确定所述SQL语句的第一执行计划的性能劣化。The determining module is configured to determine the performance degradation of the first execution plan of the SQL statement when the operation index of the first execution plan is abnormal.
  26. 根据权利要求25所述的数据库系统,其特征在于,所述第一执行计划的运行指标包括以下的一种或多种:The database system according to claim 25, wherein the operation index of the first execution plan includes one or more of the following:
    所述第一执行计划的输入输出IO指标、时延、错误信息、执行次数和处理时长。The input and output IO indicators, time delay, error information, execution times, and processing duration of the first execution plan.
  27. 根据权利要求25或26所述的数据库系统,其特征在于,所述确定模块,用于:The database system according to claim 25 or 26, wherein the determining module is configured to:
    对于所述第一执行计划的运行指标中的每个运行指标,当所述运行指标对应的运行指标 数据组指示的性能低于所述运行指标对应的所述SQL语句的历史运行指标数据组指示的性能,确定所述运行指标出现异常;For each operating indicator in the operating indicators of the first execution plan, when the performance indicated by the operating indicator data set corresponding to the operating indicator is lower than the historical operating indicator data set of the SQL statement corresponding to the operating indicator To determine that the operating index is abnormal;
    和/或,对于所述第一执行计划的运行指标中的每个运行指标,将所述运行指标对应的运行指标数据组输入第一人工智能模型,当所述第一人工智能模型输出指示所述运行指标异常的指示信息,确定所述运行指标出现异常。And/or, for each operation index in the operation index of the first execution plan, the operation index data group corresponding to the operation index is input into the first artificial intelligence model, and when the first artificial intelligence model outputs the instruction According to the indication information of abnormal operation index, it is determined that the operation index is abnormal.
  28. 根据权利要求27所述的数据库系统,其特征在于,所述确定模块,用于:The database system according to claim 27, wherein the determining module is configured to:
    对于所述第一执行计划的运行指标中的每个运行指标,当所述运行指标对应的运行指标数据组的性能曲线与所述运行指标的性能基线不匹配时,确定所述运行指标对应的运行指标数据组指示的性能低于所述历史运行指标数据组指示的性能,所述运行指标的性能基线基于所述历史运行指标数据组确定。For each operating indicator in the operating indicators of the first execution plan, when the performance curve of the operating indicator data group corresponding to the operating indicator does not match the performance baseline of the operating indicator, determine the corresponding operating indicator The performance indicated by the operating index data set is lower than the performance indicated by the historical operating indicator data set, and the performance baseline of the operating indicator is determined based on the historical operating indicator data set.
  29. 根据权利要求28所述的数据库系统,其特征在于,所述数据库系统还包括:The database system according to claim 28, wherein the database system further comprises:
    基线生成模块,用于基于第二人工智能模型以及所述历史运行指标数据组,生成所述运行指标的性能基线。The baseline generation module is configured to generate a performance baseline of the operating indicator based on the second artificial intelligence model and the historical operating indicator data set.
  30. 一种数据库系统,其特征在于,所述数据库系统包括:A database system, characterized in that, the database system includes:
    执行模块,用于执行结构化查询语言SQL语句的第一执行计划;The execution module is used to execute the first execution plan of the structured query language SQL statement;
    获取模块,用于获取所述SQL语句的新版本的第二执行计划;An obtaining module, configured to obtain the second execution plan of the new version of the SQL statement;
    所述执行模块还用于在所述第二执行计划的性能优于所述第一执行计划的性能时,执行所述第二执行计划来替换对所述第一执行计划的执行。The execution module is further configured to execute the second execution plan to replace the execution of the first execution plan when the performance of the second execution plan is better than the performance of the first execution plan.
  31. 一种计算机设备,其特征在于,包括:A computer device, characterized in that it comprises:
    处理器和存储器;Processor and memory;
    所述存储器,用于存储计算机指令;The memory is used to store computer instructions;
    所述处理器,用于执行所述存储器存储的计算机指令,使得所述计算机设备执行权利要求1至14任一所述的执行计划的处理方法,或者,执行权利要求15所述的执行计划的处理方法。The processor is configured to execute computer instructions stored in the memory, so that the computer device executes the execution plan processing method according to any one of claims 1 to 14, or executes the execution plan according to claim 15 Approach.
  32. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括计算机指令,所述计算机指令指示计算机设备执行权利要求1至14任一所述的执行计划的处理方法,或者,执行权利要求15所述的执行计划的处理方法。A computer-readable storage medium, wherein the computer-readable storage medium includes computer instructions that instruct a computer device to execute the execution plan processing method of any one of claims 1 to 14, or execute The processing method of the execution plan of claim 15.
PCT/CN2020/121193 2020-02-27 2020-10-15 Execution plan processing method, device, and system WO2021169322A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202010124587.2 2020-02-27
CN202010124587 2020-02-27
CN202010238039.2 2020-03-30
CN202010238039.2A CN113312371A (en) 2020-02-27 2020-03-30 Processing method, equipment and system for execution plan

Publications (1)

Publication Number Publication Date
WO2021169322A1 true WO2021169322A1 (en) 2021-09-02

Family

ID=77370174

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/121193 WO2021169322A1 (en) 2020-02-27 2020-10-15 Execution plan processing method, device, and system

Country Status (2)

Country Link
CN (1) CN113312371A (en)
WO (1) WO2021169322A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168569A (en) * 2021-12-14 2022-03-11 平安壹钱包电子商务有限公司 Data migration method, data migration device, computer equipment and storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113849520B (en) * 2021-09-30 2024-05-28 平安科技(深圳)有限公司 Intelligent recognition method and device for abnormal SQL, electronic equipment and storage medium
CN114090695A (en) * 2022-01-24 2022-02-25 北京奥星贝斯科技有限公司 Query optimization method and device for distributed database
CN114168620B (en) * 2022-02-11 2022-05-17 北京奥星贝斯科技有限公司 Execution plan processing method and device
CN114996292B (en) * 2022-05-05 2023-07-25 北京联华信科技有限公司 Automatic change method, device and equipment for execution plan and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102436494A (en) * 2011-11-11 2012-05-02 中国工商银行股份有限公司 Device and method for optimizing execution plan and based on practice testing
US20140046928A1 (en) * 2012-08-09 2014-02-13 International Business Machines Corporation Query plans with parameter markers in place of object identifiers
CN106796499A (en) * 2015-03-16 2017-05-31 华为技术有限公司 The method and planning optimization device of Optimizing Queries executive plan
CN108388626A (en) * 2018-02-12 2018-08-10 平安科技(深圳)有限公司 SQL automatic optimization methods, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102436494A (en) * 2011-11-11 2012-05-02 中国工商银行股份有限公司 Device and method for optimizing execution plan and based on practice testing
US20140046928A1 (en) * 2012-08-09 2014-02-13 International Business Machines Corporation Query plans with parameter markers in place of object identifiers
CN106796499A (en) * 2015-03-16 2017-05-31 华为技术有限公司 The method and planning optimization device of Optimizing Queries executive plan
CN108388626A (en) * 2018-02-12 2018-08-10 平安科技(深圳)有限公司 SQL automatic optimization methods, device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168569A (en) * 2021-12-14 2022-03-11 平安壹钱包电子商务有限公司 Data migration method, data migration device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113312371A (en) 2021-08-27

Similar Documents

Publication Publication Date Title
WO2021169322A1 (en) Execution plan processing method, device, and system
Taleb et al. Big data pre-processing: A quality framework
CN111177178B (en) Data processing method and related equipment
CN112035404B (en) Medical data monitoring and early warning method, device, equipment and storage medium
Huang et al. Research on architecture and query performance based on distributed graph database Neo4j
US20190079965A1 (en) Apparatus and method for real time analysis, predicting and reporting of anomalous database transaction log activity
US9063973B2 (en) Method and apparatus for optimizing access path in database
CN105302657B (en) Abnormal condition analysis method and device
US20210240713A1 (en) Servicing concurrent queries via virtual segment recovery
EP3131021A1 (en) Hybrid data storage system and method and program for storing hybrid data
WO2016165378A1 (en) Energy storage power station mass data cleaning method and system
US10922204B2 (en) Efficient behavioral analysis of time series data
CN111459698A (en) Database cluster fault self-healing method and device
JP6996812B2 (en) How to process data blocks in a distributed database, programs, and devices
US20240118939A1 (en) Utilizing key value-based record distribution data to perform parallelized segment generation in a database system
US11853364B2 (en) Level-based queries in a database system and methods for use therewith
WO2018196729A1 (en) Query processing method, data source registration method and query engine
CN111314158B (en) Big data platform monitoring method, device, equipment and medium
Fu et al. Performance issue diagnosis for online service systems
CN111752945A (en) Time sequence database data interaction method and system based on container and hierarchical model
CN114265857A (en) Query statement processing method and device
WO2020057369A1 (en) Query plan acquisition method, and data query method and apparatus
US20220247620A1 (en) Identification of Clusters of Elements Causing Network Performance Degradation or Outage
Cañibano et al. Data Management Optimization in a Real-Time Big Data Analysis System for Intensive Care
Su et al. GBA: a tuning-free approach to switch between synchronous and asynchronous training for recommendation models

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20921066

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20921066

Country of ref document: EP

Kind code of ref document: A1