Database performance monitoring method and device, equipment and storage medium
By synchronizing and analyzing the SQL system tables and slow logs of the business system database within a predetermined time period, and generating and analyzing the SQL execution plan, the problem of the existing technology being unable to effectively monitor the performance potential of databases is solved, and efficient performance monitoring and optimization is achieved.
Patent Information
- Application Number
- CN202411741033.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-07
AI Technical Summary
The prior art cannot effectively monitor the performance risks of the database and is inefficient in the way of statistics and analysis of slow log information.
Synchronize SQL system tables and/or database slow logs in the business system database within a predetermined time period, extract SQL text, generate SQL execution plans, analyze whether there are performance problems based on pre-built analysis rules, and push the problems to the front-end page and/or background mail system to optimize database performance.
By extracting and analyzing the execution plan generated by SQL text, the performance risks of the database can be effectively and quickly monitored, improving monitoring quality and efficiency.
Smart Images

Figure CN119576700A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of database technology, and specifically to a database performance monitoring method, device, equipment and storage medium. Background Art
[0002] Since performance problems with the database may lead to slow system response, data loss, and waste of resources, it is necessary to monitor the performance of the database. In the related technology, performance monitoring tools can be used to monitor data, such as Anemometer and MySQLTuner-perlDENG. Taking Anemometer as an example, the basic implementation principles are as follows: 1. Collect slow logs, 2. Use the pt-query-digest tool to analyze slow logs. pt-query-digest can obtain information from slow logs, and perform statistics and analysis on the information to generate easy-to-understand reports. However, the method of statistics and analysis of slow log information cannot effectively monitor the performance risks of the database, and the efficiency is low. Summary of the invention
[0003] In view of the above problems, embodiments of the present invention provide a database performance monitoring method, apparatus, device and storage medium to solve the above problems.
[0004] According to one aspect of an embodiment of the present invention, a method for monitoring database performance is provided, the method comprising:
[0005] Synchronize the SQL system table and / or database slow log in the business system database within a predetermined time period, and extract the SQL text in the SQL system table and / or database slow log;
[0006] Generate an SQL execution plan corresponding to the business system database based on the SQL text;
[0007] Analyze whether the SQL execution plan has performance problems according to pre-built analysis rules;
[0008] If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
[0009] In an optional manner, the business system includes a plurality of different business systems, and the business system includes a plurality of different types of databases. After synchronizing the SQL system tables and / or database slow logs in the business system databases within a predetermined time period and extracting the SQL texts in the SQL system tables and / or database slow logs, the method further includes:
[0010] The SQL text is stored in a general data table, and an SQL identifier of the general data table is generated, wherein the general data table is constructed according to the type of database in the business system;
[0011] After the SQL execution plan corresponding to the business system database is generated based on the SQL text, the method further includes:
[0012] The SQL execution plan is stored in a pre-constructed plan table, a plan identifier of the plan table is generated, and the SQL identifier is associated with a corresponding plan identifier.
[0013] In an optional manner, the analysis rule includes analyzing whether there are multiple problem SQL statements with the same structure and different parameters in the business system database. If so, the multiple problem SQL statements are identified as the same problem SQL statement, and a problem identifier is assigned to the same problem SQL statement.
[0014] In an optional manner, after pushing the performance problem to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem, the method further includes:
[0015] Reading the processing result after processing the performance problem in the front-end page and / or the back-end mail system, marking the performance problem based on the processing result, and reviewing the marked performance problem;
[0016] If the performance problem still exists after the review, the reviewed performance problem will be pushed to the front-end page and / or back-end mail system.
[0017] In an optional manner, generating a SQL execution plan corresponding to the business system database based on the SQL text includes:
[0018] Acquire incremental SQL text, merge the incremental SQL text with the historical SQL text of the business system database, and obtain the full SQL text of the business system database;
[0019] Generate a SQL execution plan corresponding to the business system database based on the full SQL text.
[0020] In an optional manner, the generating of the SQL execution plan corresponding to the business system database based on the full SQL text includes: standardizing the full SQL text to obtain a standard SQL text, and generating the SQL execution plan according to the standard SQL text.
[0021] In an optional manner, before synchronizing the SQL system table and / or the database slow log in the business system database within a predetermined time period and extracting the SQL text in the SQL system table and / or the database slow log, the method further includes:
[0022] The step of obtaining an authentication message sent by the business system within a predetermined time period, and authenticating the business system according to the authentication message;
[0023] When the authentication is passed, the step of synchronizing the SQL system table and / or database slow log in the business system database is performed.
[0024] According to another aspect of an embodiment of the present invention, there is provided a database performance monitoring device, comprising:
[0025] An extraction module is used to synchronize the SQL system table and / or the database slow log in the business system database within a predetermined time period, and extract the SQL text in the SQL system table and / or the database slow log;
[0026] A generation module, used to generate an SQL execution plan corresponding to the business system database based on the SQL text;
[0027] An analysis module, used to analyze whether the SQL execution plan has performance problems according to pre-built analysis rules;
[0028] The push module is used to push the performance problem to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
[0029] According to another aspect of an embodiment of the present invention, a computer device is provided, characterized in that it includes: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method as described above.
[0030] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and when the executable instruction is executed on a computer device, the computer device executes the method described above.
[0031] The embodiment of the present invention synchronizes the SQL system table and / or the database slow log in the business system database within a predetermined time period, extracts the SQL text in the SQL system table and / or the database slow log, generates the SQL execution plan corresponding to the business system database based on the SQL text, and analyzes whether there is a performance problem in the SQL execution plan according to the pre-built analysis rules. If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem. This embodiment generates an execution plan based on the SQL text extracted from the SQL system table and / or the database slow log, and analyzes the database through the execution plan, so as to effectively and quickly monitor the performance risks of the database and improve the monitoring quality and efficiency.
[0032] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0034] Figure 1 A schematic diagram of the use environment of the database performance monitoring method provided by an embodiment of the present invention is shown;
[0035] Figure 2 A schematic diagram of a process flow of a database performance monitoring method provided by an embodiment of the present invention is shown;
[0036] Figure 3 A schematic diagram showing the structure of a database performance monitoring device provided by an embodiment of the present invention is shown;
[0037] Figure 4 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0038] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0039] Figure 1 The following is a schematic diagram showing the use environment of the database performance monitoring method provided by the embodiment of the present invention. Figure 1As shown, the device where the monitoring platform is located can be a computer or other device. The monitoring platform performs performance monitoring on multiple different types of databases. The monitoring platform synchronizes the SQL system tables and / or database slow logs in the database during the database non-working time period, and extracts the SQL text, and generates the SQL execution plan corresponding to the database based on the SQL text, so as to determine whether there is a performance problem with the database by analyzing the SQL execution plan.
[0040] Figure 2 The flowchart of the database performance monitoring method according to the embodiment of the present invention is shown, which is applied to the monitoring platform, such as Figure 2 As shown, the method comprises the following steps:
[0041] Step 101: synchronize the SQL system tables and / or database slow logs in the business system database within a predetermined time period, and extract SQL texts in the SQL system tables and / or database slow logs.
[0042] In this embodiment, the monitoring platform can be connected to multiple different business systems. Each business system can include one or more databases. The types of databases in multiple databases can be the same or different, and no further restrictions are made here. The SQL system table mainly stores the metadata of the database, including information about database objects, permission settings, dependencies between objects, etc. This information can be used to manage and maintain the database. The system table structure and content in different database management systems may be different, but the basic functions and uses are similar. The database slow log is a log used to record SQL query statements whose execution time exceeds a preset threshold. SQL text is text containing structured query language SQL code. Relevant SQL text can be extracted from the SQL system table and / or the database slow log.
[0043] In the related art, the performance monitoring of the business system database is generally real-time intrusive, that is, the performance monitoring is performed during the working hours of the business system database, which is easy to increase the load of the database and may have a certain impact on the database performance. The magnitude of the impact depends on many factors, such as the monitoring frequency, the monitoring depth, the size and current load of the database, the efficiency of the monitoring tool, etc. In this embodiment, the predetermined time period is the non-working time period of the business system database, and the SQL system table and / or the database slow log in the business system database is queried, and synchronized to the monitoring platform at one time, and the database and table are built for analysis and processing. In this way, the calling frequency and duration of the business system database are the least, which reduces the intrusion into the database during the performance monitoring process and reduces the impact on the performance of the database.
[0044] In an optional embodiment, in order to improve security, the SQL system tables and / or database slow logs in the business system database are synchronized within a predetermined time period, and before the SQL text in the SQL system tables and / or database slow logs is extracted, it also includes: obtaining the authentication message sent by the business system within the predetermined time period, authenticating the business system according to the authentication message; when the authentication is passed, executing the step of synchronizing the SQL system tables and / or database slow logs in the business system database.
[0045] Among them, during non-working hours, the business system sends an authentication message to the monitoring platform. Optionally, a token can be used for authentication. The business system sends a token to the monitoring platform, and the monitoring platform verifies the validity of the token, the associated user information, and whether it is expired. When the verification is successful, a response of authentication success is fed back to the business system, and the steps of synchronizing the SQL system table and / or database slow log are executed.
[0046] Step 102: Generate an SQL execution plan corresponding to the business system database based on the SQL text.
[0047] The SQL execution plan is the specific steps for the database to execute an SQL statement, which describes in detail how the database executes an SQL statement, including how to access data, which indexes to use, how to implement connection queries, and the order of connections, etc. This embodiment can generate a corresponding SQL execution plan through the SQL text of the database.
[0048] Optionally, a SQL execution plan corresponding to the business system database is generated based on the SQL text, including: obtaining incremental SQL text, merging the incremental SQL text with historical SQL text of the business system database to obtain the full SQL text of the business system database; and generating a SQL execution plan corresponding to the business system database based on the full SQL text.
[0049] In this embodiment, SQL statements in each business system database are continuously generated, and the SQL system tables and / or database slow logs are synchronized during non-working hours. A part of the SQL statements is synchronized during non-working hours every day, and a part of the SQL text can be extracted from the SQL system tables and / or database slow logs synchronized every day. Therefore, the newly extracted SQL text every day is the incremental SQL text. The incremental SQL text is merged with the historical SQL text to obtain the full SQL text, and the full SQL text is parsed. A complete SQL execution plan can be generated based on the parsed full SQL text.
[0050] Among them, in order to reduce the workload, the SQL execution plan corresponding to the business system database is generated based on the full SQL text, including: standardizing the full SQL text, including deduplication, removing unnecessary characters, such as spaces, special characters, etc., treating SQL statements with the same statement structure but different variables in the SQL text as the same SQL statement, obtaining a standard SQL text, and generating the SQL execution plan according to the standard SQL text.
[0051] In an optional embodiment, after synchronizing the SQL system tables and / or database slow logs in the business system database within a predetermined time period and extracting the SQL text in the SQL system tables and / or database slow logs, it also includes: storing the SQL text in a general data table, generating an SQL identifier for the general data table, and the general data table is constructed according to the type of database in the business system; after generating the SQL execution plan corresponding to the business system database based on the SQL text, it also includes: storing the SQL execution plan in a pre-constructed plan table, generating a plan identifier for the plan table, and associating the SQL identifier with the corresponding plan identifier.
[0052] The monitoring platform of this embodiment can be connected to multiple different business systems and can perform performance monitoring on multiple types of databases. Specifically, an interface can be created in the monitoring platform, and the monitoring platform can be connected to the business system through the interface, and a general data table corresponding to each type of database in the business system is created in the background of the monitoring platform. The general data table is used to store SQL texts and has corresponding SQL identifiers.
[0053] Since the underlying implementation logic of different types of databases is different, the parsing of the execution plan is also different. This embodiment will establish a plan table for different types of databases in different business systems, each plan table has a corresponding plan identifier, and finally associate the general data table of the same type of database with the plan table, that is, the two tables are associated with the plan identifier through the SQL identifier, so as to realize the association between the general data table and the plan table of the same type of database. In the related art, the performance monitoring of the database is generally strongly related to a single database. For example, Anemometer and Dolphie are used for performance monitoring of MySQL databases, and the DBA Dash monitoring tool is used for performance monitoring of SQLServer databases. This embodiment can connect to multiple different types of databases. By establishing a general data table and a plan table for each type of database, and associating it with the plan identifier through the SQL identifier, the monitoring platform can support multiple types of databases and has strong versatility.
[0054] Step 103: Analyze whether the SQL execution plan has any performance problems according to pre-built analysis rules.
[0055] In this embodiment, analysis rules are constructed on the monitoring platform to analyze whether there are performance risks in the business system database. The analysis rules may include full table scans, limits on the number of connected tables, limits on the total number of scanned rows, etc. For example, key information in the execution plan is checked, such as whether indexes are used, whether full table scans, sorting and join operations are performed, whether there are suboptimal query conditions, the order of JOIN operations, whether optimization or addition of indexes is required, etc. The SQL execution plan can also be analyzed in combination with existing analysis tools, which are not limited too much here.
[0056] Optionally, the analysis rules also include analyzing whether there are multiple problematic SQL statements with the same structure and different parameters in the business system database. If so, the multiple problematic SQL statements are identified as the same problematic SQL statement, and a problem identifier is assigned to the same problematic SQL statement. In the related art, the performance monitoring results of the database are based on SQL_ID. For performance problems with the same SQL statement structure, different parameters will result in multiple SQL_IDs and multiple performance problems, which will undoubtedly increase the amount of data and workload. In this embodiment, multiple problematic SQL statements with the same structure and different parameters are identified as the same problematic SQL statement, and only a problem identifier is generated, thereby reducing the number of problematic SQL statements with the same structure and reducing the workload.
[0057] Step 104: If yes, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
[0058] In this embodiment, when monitoring finds performance problems in the database, the performance problems are written into a processing table, and the processing table is pushed to the front-end page and / or the back-end mail system. The SQL text and SQL execution plan related to the performance problems can also be pushed together. On the front-end page, developers can view the performance problems in the displayed processing table, and process or optimize the database manually or through a script based on the performance problems and / or SQL execution plan; or developers view the processing table in the mail system, and process or optimize the database manually or through a script based on the performance problems and / or SQL execution plan.
[0059] In an optional embodiment, after the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem, it also includes: reading the processing results of the performance problem in the front-end page and / or the back-end mail system, marking the performance problem based on the processing results, and reviewing the marked performance problem; if the performance problem still exists after the review, the reviewed performance problem is pushed to the front-end page and / or the back-end mail system.
[0060] Among them, after optimization, developers can mark performance issues in the processing table according to the processing results, or developers can reply to the email system after marking the performance issues in the processing table. The monitoring platform automatically marks the performance issues according to the processing results in the marked processing table by obtaining the marked processing table in the front-end page or by reading the marked processing table in the email system, for example, marking a performance issue as processed or not requiring processing.
[0061] For the performance issues that have been marked, the monitoring platform will review them. For example, for performance issues that are marked as not to be processed, the monitoring platform does not need to process the corresponding tables or SQL in subsequent monitoring scans. For performance issues that are marked as processed, the monitoring platform will review whether the performance issues still exist in subsequent monitoring scans. If they do exist, they will continue to be pushed to the front-end page and / or the back-end mail system so that developers can optimize them again. In related technologies, monitoring tools generally focus on monitoring performance indicators and operating conditions. This embodiment actively marks performance issues based on processing results and reviews the marked performance issues, which can form a closed loop for processing problematic SQL and improve processing efficiency.
[0062] The embodiment of the present invention synchronizes the SQL system table and / or the database slow log in the business system database within a predetermined time period, extracts the SQL text in the SQL system table and / or the database slow log, generates the SQL execution plan corresponding to the business system database based on the SQL text, and analyzes whether there is a performance problem in the SQL execution plan according to the pre-built analysis rules. If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem. This embodiment generates an execution plan based on the SQL text extracted from the SQL system table and / or the database slow log, and analyzes the database through the execution plan, so as to effectively and quickly monitor the performance risks of the database and improve the monitoring quality and efficiency.
[0063] Figure 3 FIG. 2 shows a schematic diagram of the structure of a database performance monitoring device according to an embodiment of the present invention. Figure 3 As shown, the database performance monitoring device 300 includes:
[0064] An extraction module 301 is used to synchronize the SQL system table and / or the database slow log in the business system database within a predetermined time period, and extract the SQL text in the SQL system table and / or the database slow log;
[0065] A generating module 302 is used to generate a SQL execution plan corresponding to the business system database based on the SQL text;
[0066] An analysis module 303 is used to analyze whether the SQL execution plan has performance problems according to pre-built analysis rules;
[0067] The push module 304 is used to push the performance problem to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
[0068] The embodiment of the present invention synchronizes the SQL system table and / or the database slow log in the business system database within a predetermined time period, extracts the SQL text in the SQL system table and / or the database slow log, generates the SQL execution plan corresponding to the business system database based on the SQL text, and analyzes whether there is a performance problem in the SQL execution plan according to the pre-built analysis rules. If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem. This embodiment generates an execution plan based on the SQL text extracted from the SQL system table and / or the database slow log, and analyzes the database through the execution plan, so as to effectively and quickly monitor the performance risks of the database and improve the monitoring quality and efficiency.
[0069] Figure 4 The schematic diagram of the structure of the computer device embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0070] like Figure 4 As shown, the computer device may include: a processor (processor) 402 , a communication interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .
[0071] The processor 402, the communication interface 404, and the memory 406 communicate with each other via the communication bus 408. The communication interface 404 is used to communicate with other computer devices such as client or other server network elements. The processor 402 is used to execute the program 410, which can specifically execute the relevant steps in the above-mentioned computer device embodiment.
[0072] Specifically, the program 410 may include program code including computer executable instructions.
[0073] The processor 402 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0074] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0075] The program 410 may be specifically called by the processor 402 to enable the computer device to perform the following operations:
[0076] Synchronize the SQL system table and / or database slow log in the business system database within a predetermined time period, and extract the SQL text in the SQL system table and / or database slow log;
[0077] Generate an SQL execution plan corresponding to the business system database based on the SQL text;
[0078] Analyze whether the SQL execution plan has performance problems according to pre-built analysis rules;
[0079] If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
[0080] In an optional manner, the business system includes a plurality of different business systems, and the business system includes a plurality of different types of databases. After synchronizing the SQL system tables and / or database slow logs in the business system databases within a predetermined time period and extracting the SQL texts in the SQL system tables and / or database slow logs, the method further includes:
[0081] The SQL text is stored in a general data table, and an SQL identifier of the general data table is generated, wherein the general data table is constructed according to the type of database in the business system;
[0082] After the SQL execution plan corresponding to the business system database is generated based on the SQL text, the method further includes:
[0083] The SQL execution plan is stored in a pre-constructed plan table, a plan identifier of the plan table is generated, and the SQL identifier is associated with a corresponding plan identifier.
[0084] In an optional manner, the analysis rule includes analyzing whether there are multiple problem SQL statements with the same structure and different parameters in the business system database. If so, the multiple problem SQL statements are identified as the same problem SQL statement, and a problem identifier is assigned to the same problem SQL statement.
[0085] In an optional manner, after pushing the performance problem to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem, the method further includes:
[0086] Reading the processing result after processing the performance problem in the front-end page and / or the back-end mail system, marking the performance problem based on the processing result, and reviewing the marked performance problem;
[0087] If the performance problem still exists after the review, the reviewed performance problem will be pushed to the front-end page and / or back-end mail system.
[0088] In an optional manner, generating a SQL execution plan corresponding to the business system database based on the SQL text includes:
[0089] Acquire incremental SQL text, merge the incremental SQL text with the historical SQL text of the business system database, and obtain the full SQL text of the business system database;
[0090] Generate a SQL execution plan corresponding to the business system database based on the full SQL text.
[0091] In an optional manner, the generating of the SQL execution plan corresponding to the business system database based on the full SQL text includes: standardizing the full SQL text to obtain a standard SQL text, and generating the SQL execution plan according to the standard SQL text.
[0092] In an optional manner, before synchronizing the SQL system table and / or the database slow log in the business system database within a predetermined time period and extracting the SQL text in the SQL system table and / or the database slow log, the method further includes:
[0093] The step of obtaining an authentication message sent by the business system within a predetermined time period, and authenticating the business system according to the authentication message;
[0094] When the authentication is passed, the step of synchronizing the SQL system table and / or database slow log in the business system database is performed.
[0095] The embodiment of the present invention synchronizes the SQL system table and / or the database slow log in the business system database within a predetermined time period, extracts the SQL text in the SQL system table and / or the database slow log, generates the SQL execution plan corresponding to the business system database based on the SQL text, and analyzes whether there is a performance problem in the SQL execution plan according to the pre-built analysis rules. If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem. This embodiment generates an execution plan based on the SQL text extracted from the SQL system table and / or the database slow log, and analyzes the database through the execution plan, so as to effectively and quickly monitor the performance risks of the database and improve the monitoring quality and efficiency.
[0096] An embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores at least one executable instruction. When the executable instruction is executed on a computer device, the computer device executes any of the above method embodiments.
[0097] An embodiment of the present invention provides a computer program, which can be called by a processor to enable a computer device to execute any of the above method embodiments.
[0098] An embodiment of the present invention provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed on a computer, the computer is enabled to execute any of the above method embodiments.
[0099] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other equipment. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description made to specific languages above is for disclosing the best mode of the present invention.
[0100] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0101] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than those expressly recited in each claim.
[0102] Those skilled in the art will appreciate that the modules in the computer device in the embodiment can be adaptively changed and set in one or more computer devices different from the embodiment. The modules or units or components in the embodiment can be combined into one module or unit or component, and they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or computer device disclosed in this manner can be combined in any combination. Unless otherwise explicitly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0103] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A database performance monitoring method, characterized in that: The method comprises: Synchronize the SQL system table and / or database slow log in the business system database within a predetermined time period, and extract the SQL text in the SQL system table and / or database slow log; Generate an SQL execution plan corresponding to the business system database based on the SQL text; Analyze whether the SQL execution plan has performance problems according to pre-built analysis rules; If so, the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
2. The method according to claim 1, characterized in that: The business system includes a plurality of different business systems, and the business system includes a plurality of different types of databases. After synchronizing the SQL system tables and / or database slow logs in the business system databases within a predetermined time period and extracting the SQL texts in the SQL system tables and / or database slow logs, the method further includes: The SQL text is stored in a general data table, and an SQL identifier of the general data table is generated, wherein the general data table is constructed according to the type of database in the business system; After the SQL execution plan corresponding to the business system database is generated based on the SQL text, the method further includes: The SQL execution plan is stored in a pre-constructed plan table, a plan identifier of the plan table is generated, and the SQL identifier is associated with a corresponding plan identifier.
3. The method according to claim 1, characterized in that The analysis rule includes analyzing whether there are multiple problematic SQL statements with the same structure and different parameters in the business system database. If so, the multiple problematic SQL statements are identified as the same problematic SQL statement, and a problem identifier is assigned to the same problematic SQL statement.
4. The method according to claim 1, characterized in that After the performance problem is pushed to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem, the method further includes: Reading the processing result after processing the performance problem in the front-end page and / or the back-end mail system, marking the performance problem based on the processing result, and reviewing the marked performance problem; If the performance problem still exists after the review, the reviewed performance problem will be pushed to the front-end page and / or back-end mail system.
5. The method according to claim 1, characterized in that The generating the SQL execution plan corresponding to the business system database based on the SQL text includes: Acquire incremental SQL text, merge the incremental SQL text with the historical SQL text of the business system database, and obtain the full SQL text of the business system database; Generate a SQL execution plan corresponding to the business system database based on the full SQL text.
6. The method according to claim 5, characterized in that The generating the SQL execution plan corresponding to the business system database based on the full SQL text includes: standardizing the full SQL text to obtain a standard SQL text, and generating the SQL execution plan according to the standard SQL text.
7. The method according to claim 1, characterized in that Before synchronizing the SQL system table and / or the database slow log in the business system database within the predetermined time period and extracting the SQL text in the SQL system table and / or the database slow log, the method further includes: The step of obtaining an authentication message sent by the business system within a predetermined time period, and authenticating the business system according to the authentication message; When the authentication is passed, the step of synchronizing the SQL system table and / or the database slow log in the business system database is performed.
8. A database performance monitoring device, characterized in that: include: An extraction module is used to synchronize the SQL system table and / or the database slow log in the business system database within a predetermined time period, and extract the SQL text in the SQL system table and / or the database slow log; A generation module, used to generate an SQL execution plan corresponding to the business system database based on the SQL text; An analysis module, used to analyze whether the SQL execution plan has performance problems according to pre-built analysis rules; The push module is used to push the performance problem to the front-end page and / or the back-end mail system to optimize the performance of the database based on the performance problem.
9. A computer device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one executable instruction, and when the executable instruction is executed on a computer device, the computer device executes the method according to any one of claims 1 to 7.