Data query monitoring method, device, electronic device and storage medium

By detecting the execution plan of SQL query statements in real time during the testing process of application services, identifying implicit conversions and generating alarm information, the database performance problem caused by inconsistent data types in SQL query statements is solved, and the database query speed is improved and service is achieved stability.

CN113032277BActive Publication Date: 2024-11-05CTRIP TRAVEL NETWORK TECH SHANGHAI0
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110414424.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-16
Publication Date
2024-11-05
Estimated Expiration
2041-04-16

AI Technical Summary

Technical Problem

Implicit conversions caused by inconsistent data types in SQL query statements occupy database CPU and IO resources, affecting database performance, especially in high concurrency big data table query scenarios, resulting in database stability problems.

Method used

During the testing process of application services, the execution plan of the query statement is obtained in real time, the existence of implicit conversions is parsed, the performance consumption data is monitored, the alarm information is generated, the query statement is intercepted and optimized, and the performance abnormalities caused by implicit conversions are avoided.

Benefits of technology

Automatically detect and identify implicit conversion risks in advance, avoid posting query statements to the production environment, ensure faster database query speed, more stable service performance, and prevent abnormal database performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113032277B_ABST
    Figure CN113032277B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing technology, and provides a data query monitoring method, device, electronic device and storage medium. The data query monitoring method comprises: in the test process of an application service, obtaining the execution plan of the query statement of the application service in real time; parsing the execution plan to determine whether the query statement requires implicit conversion; if so, obtaining implicit conversion information containing the query statement; and monitoring the performance consumption data of the query statement executed by the database, and generating an alarm message based on the implicit conversion information and the performance consumption data and pushing it to the test end of the application service. The present invention can ensure the stability of the database by automatically detecting whether there is an implicit conversion in the query statement during the test process of the application service, efficiently identifying risks in advance, and avoiding the impact of the query statement with implicit conversion on the online database after being released to the production environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data query monitoring method, device, electronic equipment and storage medium. Background Art

[0002] SQL (Structured Query Language) query statements can be used to query data in relational databases (such as SQL Server).

[0003] When the data type in the SQL query statement is inconsistent with the actual data type in the database, usually when two different data types are compared in the WHERE clause or JOIN clause, implicit conversion is involved, which occupies a large amount of CPU (Central Processing Unit) resources, IO (Input / Output) resources and memory of the database.

[0004] For example, if the data type of a field in the database table structure is varchar(20), and the data type of the field in the WHERE condition of the SQL query statement is nvarchar(20), the two data types are inconsistent, which will trigger implicit conversion during data query. Implicit conversion has a great impact on database performance, especially in the scenario of high-concurrency large data table query, which will have a great impact on database performance and affect database stability.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] In view of this, the present invention provides a data query monitoring method, device, electronic device and storage medium, which can automatically detect whether there is implicit conversion in the query statement during the testing process of the application service, effectively identify risks in advance, and ensure the stability of the database.

[0007] One aspect of the present invention provides a data query monitoring method, comprising: during the testing process of an application service, obtaining the execution plan of the query statement of the application service in real time; parsing the execution plan to determine whether the query statement requires implicit conversion; if so, obtaining implicit conversion information containing the query statement; and monitoring the performance consumption data of the database executing the query statement, and generating alarm information based on the implicit conversion information and the performance consumption data and pushing it to the test end of the application service.

[0008] In some embodiments, the implicit conversion information also includes: the request server and account information of the query statement; the target field in the query statement that needs to be implicitly converted; and the target data type of the target field in the database.

[0009] In some embodiments, the performance consumption data includes IO consumption data, CPU consumption data and execution time of the database executing the query statement.

[0010] In some embodiments, before monitoring the performance consumption data of the database executing the query statement, it also includes: obtaining the estimated consumption data of each performance of the database executing the query statement; determining whether the estimated consumption data of at least one performance exceeds the corresponding risk threshold; if so, intercepting the execution of the query statement, and generating the alarm information based on the implicit conversion information and the estimated consumption data.

[0011] In some embodiments, estimated consumption data of various performances of the database executing the query statement is obtained, including: according to the storage position of the target field in the database, obtaining the data volume of the corresponding column of the data table where the target field is located, as the data volume to be converted; and obtaining the estimated consumption data corresponding to the data volume to be converted from the mapping relationship between the self-converted data volume and the consumption data.

[0012] In some embodiments, the query statement is a SQL query statement, and when parsing the execution plan, if a CONVERT_IMPLICIT statement exists in the execution plan, it is determined that the query statement requires implicit conversion.

[0013] In some embodiments, when it is determined that the query statement requires implicit conversion, it further includes: intercepting the release of the application service.

[0014] Another aspect of the present invention provides a data query monitoring device, including: an execution plan acquisition module, used to obtain the execution plan of the query statement of an application service in real time during the testing process of the application service; an implicit conversion detection module, used to parse the execution plan and determine whether the query statement requires implicit conversion; a conversion information acquisition module, used to obtain implicit conversion information containing the query statement when it is determined that the query statement requires implicit conversion; and an alarm information push module, used to monitor the performance consumption data of the database executing the query statement, and generate alarm information based on the implicit conversion information and the performance consumption data and push it to the test end of the application service.

[0015] Another aspect of the present invention provides an electronic device, comprising: a processor; a memory, wherein the memory stores executable instructions; wherein when the executable instructions are executed by the processor, the data query monitoring method described in any of the above embodiments is implemented.

[0016] Another aspect of the present invention provides a computer-readable storage medium for storing a program, wherein the program, when executed, implements the data query monitoring method described in any of the above embodiments.

[0017] The beneficial effects of the present invention compared with the prior art include at least:

[0018] During the testing process of application services, the present invention automatically detects whether there is implicit conversion in query statements, effectively identifies risks in advance, and can avoid abnormal database performance due to implicit conversion overhead after the query statements are released to the production environment, thereby making the database query speed faster and the service performance more stable.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0021] Figure 1 A schematic diagram showing the steps of a data query monitoring method according to an embodiment of the present invention is shown;

[0022] Figure 2 A schematic diagram showing the steps of detecting a query statement in an embodiment of the present invention is shown;

[0023] Figure 3 A schematic diagram showing the steps of a data query monitoring method in another embodiment of the present invention is shown;

[0024] Figure 4 A schematic diagram of a module of a data query monitoring device according to an embodiment of the present invention is shown;

[0025] Figure 5 A schematic diagram showing the structure of an electronic device in an embodiment of the present invention is shown;

[0026] Figure 6 A schematic diagram showing the structure of a computer-readable storage medium in an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0027] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to make the present invention comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art.

[0028] The accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0029] In addition, the processes shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps can be decomposed, some steps can be combined or partially combined, and the actual execution order may change according to the actual situation. It should be noted that the embodiments of the present invention and the features in different embodiments can be combined with each other without conflict.

[0030] Figure 1 The main steps of the data query monitoring method in the embodiment are shown, referring to Figure 1 As shown, the data query monitoring method in this embodiment includes: step S110, in the test process of an application service, obtaining the execution plan of the query statement of the application service in real time; step S120, parsing the execution plan to determine whether the query statement needs implicit conversion; if so, executing step S130 to obtain implicit conversion information containing the query statement; if not, returning to continue to obtain the updated execution plan in the database, and continuously monitoring the data query of the database; step S140, monitoring the performance consumption data of the query statement executed by the database, generating an alarm information and pushing it to the test end of the application service according to the implicit conversion information and the performance consumption data; thereafter, returning to continue to obtain the updated execution plan in the database, and continuously monitoring the data query of the database.

[0031] The above-mentioned data query monitoring method can automatically detect whether there are implicit conversions in query statements during the testing process of application services, without the need for manual type consistency checks, and can efficiently identify risks early. By performing detection in the test environment, query statements with implicit conversions are intercepted and alarmed, which can avoid abnormal database performance due to implicit conversion overhead after the query statements are released to the production environment, avoid impact on the online database, and ensure that the stability of the online database is not affected. The above-mentioned data query monitoring method can make database queries faster and service performance more stable.

[0032] The data query monitoring method is described in detail below with reference to specific examples.

[0033] In one embodiment, the detection program corresponding to the data query monitoring method can be deployed on an ordinary dual-core server in a test environment to perform implicit conversion detection of query statements on the database server accessed by the application service being tested in real time. When implicitly converted query statements are detected, the database administrator and the corresponding application service developers are promptly notified to optimize these query statements before failures occur, so as to avoid database failures caused by implicit conversion of query statements.

[0034] The query statement specifically refers to the SQL query statement. Before the SQL query statement is passed to the database for formal execution, an execution plan will be generated. The execution plan is cached in the memory space of the database until it is overwritten by a new execution plan. By intercepting all cached execution plans in the database in real time, the execution plan in XML format is parsed to determine whether the query statement requires implicit conversion. Specifically, it can be determined whether there is a CONVERT_IMPLICIT statement in the execution plan. If so, it is determined that the query statement requires implicit conversion.

[0035] When it is determined that a query statement needs implicit conversion, implicit conversion information is obtained, including: the query statement that needs implicit conversion; the request server and account information of the query statement, and the relevant information of the request server and account source that issued the query statement will be carried in the query statement; the development team of the query statement; the target field that needs implicit conversion in the query statement; and querying the database to obtain the correct target data type of the target field in the database. This implicit conversion information can be used for subsequent generation of alarm information, so that relevant personnel can quickly locate the specific query statement that needs to be improved after receiving the alarm information.

[0036] Furthermore, the resource consumption of the query statement that requires implicit conversion is monitored to obtain the performance consumption data of the query statement executed by the database, including: IO consumption data, CPU consumption data and execution time of the query statement executed by the database. In addition, the total performance consumption data of the query statement executed by the database during the application service test can be collected, and the Query_Hash corresponding to the query statement that requires implicit conversion is compared with the Query_Hash corresponding to each query statement to obtain the consumption ratio of the query statement that requires implicit conversion to the various performance of the database, so as to evaluate the impact of the query statement that requires implicit conversion on its various performance when the database executes the query statement that requires implicit conversion.

[0037] After obtaining implicit conversion information and performance consumption data, an alarm message is generated to promptly notify relevant developers, prompting them to adjust the parameter type passed in the query statement.

[0038] exist Figure 1 Based on the data query monitoring method shown, Figure 2 The main steps of detecting a query statement in the embodiment are shown, referring to Figure 2 As shown, it includes: step S210, obtaining the execution plan of the SQL query statement in the database; step S220, judging whether the SQL query statement needs implicit conversion; if not, the detection of the query statement can be ended, and if so, the execution continues: step S230-a, extracting the target field of implicit conversion and the wrong data type; step S230-b, querying the correct data type of the target field in the database and obtaining implicit conversion information; step S240-a, monitoring the performance consumption data of the database executing the SQL query statement, and obtaining the consumption ratio of the SQL query statement to the various performances of the database; step S240-b, combining the implicit conversion information and the consumption ratio information, generating an alarm message for push. The alarm message can be pushed by email.

[0039] A specific alarm case is as follows:

[0040] /

[0041] *IO_Percent: 21%

[0042] *CPU_Percent: 28%

[0043] *Exec_Time_Percent: 27%

[0044] *Query_Hash:0xf04b1564c1c8cf07

[0045] *Login_Name:app_123456

[0046] *Data:(2020 / 12 / 1900:00:00~2020 / 12 / 1912:00:00)

[0047] #The following parameter transfer has implicit type conversion#

[0048] *Column_Type:

[0049] DemoDB..DemoTable.Column1:varchar(40)

[0050] DemoDB..DemoTable.Column2:varchar(20)

[0051] *Parameters:

[0052] @Column1Val:N'100001234'Input type Nvarchar(40)

[0053] @Column2Val:N'50_ACB_800'Input type Nvarchar(20)

[0054] /

[0055] Among them, the SQL query statement for USE DemoDB is, for example: SELECT * FROM DemoTable (nolock) WHERE Column1 = @Column1Val AND Column2 = @Column2Val.

[0056] exist Figure 1 Based on the data query monitoring method shown, Figure 3 The main steps of the data query monitoring method in another embodiment are shown, referring to Figure 3 As shown, in this embodiment, before monitoring the performance consumption data of the database executing the query statement in step S140, it also includes: step S310, obtaining the estimated consumption data of each performance of the database executing the query statement; step S320, judging whether the estimated consumption data of at least one performance exceeds the corresponding risk threshold; if so, executing step S330, intercepting the execution of the query statement, and generating an alarm message based on the implicit conversion information and the estimated consumption data; otherwise, executing step S140.

[0057] The process of obtaining the estimated consumption data of the database execution query statement specifically includes: first, according to the storage position of the target field in the database, obtain the data volume of the corresponding column of the data table where the target field is located as the data volume to be converted; for example, if the storage position of the target field in the database is the column name of a data table, the implicit conversion operation needs to convert the data type of all fields in the column corresponding to the target field, so the data volume to be converted is the data volume of the corresponding column of the target field in the data table. Then, from the mapping relationship between the conversion data volume and the consumption data, obtain the estimated consumption data corresponding to the data volume to be converted; based on the historical collection data, obtain the corresponding relationship between the conversion data volume and the consumption data of various performances of the database, and form a mapping relationship table to estimate the estimated consumption data corresponding to the current data volume to be converted, and specifically obtain the estimated IO consumption data, estimated CPU consumption data and estimated execution time.

[0058] Next, determine whether the estimated consumption data of each performance exceeds the corresponding risk threshold. If the estimated consumption data of any one or more performances exceeds the corresponding risk threshold, intercept the execution of the query statement to avoid database crash and ensure that other database services can run normally. Generate alarm information based on implicit conversion information and estimated consumption data to remind relevant developers to improve query statements in time, and then continue the test process of application services.

[0059] Furthermore, in each of the above embodiments, when it is determined that a query statement requires implicit conversion, the data query monitoring method further includes: intercepting the release of an application service. In a test environment, when an implicitly converted query statement is found, the corresponding application service is associated, and in a release system, the application service is prohibited from being released to a production environment to avoid affecting an online database.

[0060] In summary, the above-mentioned data query monitoring method can automatically detect whether there is implicit conversion in the query statement during the testing process of the application service, without the need for manual type consistency check, and can efficiently identify risks in advance; by performing detection in the test environment, query statements with implicit conversions are intercepted and alarmed, which can avoid abnormal database performance due to implicit conversion overhead after the query statement is released to the production environment, avoid impact on the online database, and ensure that the stability of the online database is not affected; the use of the above-mentioned data query monitoring method can make database queries faster and service performance more stable.

[0061] The embodiment of the present invention also provides a data query monitoring device, which can be used to implement the data query monitoring method described in any of the above embodiments. The features and principles of the data query monitoring method described in any of the above embodiments can be applied to the following data query monitoring device embodiments. In the following data query monitoring device embodiments, the features and principles of data query monitoring that have been explained will not be repeated.

[0062] Figure 4 The main modules of the data query monitoring device in the embodiment are shown, referring to Figure 4 As shown, the data query monitoring device 400 in this embodiment includes: an execution plan acquisition module 410, which is used to obtain the execution plan of the query statement of the application service in real time during the testing process of an application service; an implicit conversion detection module 420, which is used to parse the execution plan and determine whether the query statement requires implicit conversion; a conversion information acquisition module 430, which is used to obtain implicit conversion information containing the query statement when it is determined that the query statement requires implicit conversion; and an alarm information push module 440, which is used to monitor the performance consumption data of the database executing the query statement, and generate alarm information based on the implicit conversion information and performance consumption data and push it to the test end of the application service.

[0063] Furthermore, the data query monitoring device 400 may also include modules for implementing other process steps of the above-mentioned data query monitoring method embodiments. The specific principles of each module can refer to the description of the above-mentioned data query monitoring method embodiments, and will not be repeated here.

[0064] The above-mentioned data query monitoring device can be deployed on an ordinary dual-core server in a test environment to perform implicit conversion detection of query statements on the database server accessed by the application service being tested in real time. When implicitly converted query statements are detected, the database administrator and the corresponding application service developers are promptly notified to optimize these query statements before failures occur, so as to avoid database failures caused by implicit conversion of query statements.

[0065] The above-mentioned data query monitoring device can automatically detect whether there is implicit conversion in the query statement during the testing process of the application service, without the need for manual type consistency check, and can efficiently identify risks early; it can detect in the test environment, intercept and alarm the query statement with implicit conversion, and avoid abnormal database performance due to implicit conversion overhead after the query statement is released to the production environment, avoid impact on the online database, and ensure that the stability of the online database is not affected; the use of the above-mentioned data query monitoring method can make the database query speed faster and the service performance more stable.

[0066] An embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein executable instructions are stored in the memory, and when the executable instructions are executed by the processor, the data query monitoring method described in any of the above embodiments is implemented.

[0067] As described above, the electronic device of the present invention can automatically detect whether there is implicit conversion in the query statement during the testing process of the application service, without the need for manual type consistency check, and can efficiently identify risks early; by performing detection in the test environment, query statements with implicit conversions are intercepted and alarmed, which can avoid abnormal database performance due to implicit conversion overhead after the query statement is released to the production environment, avoid impact on the online database, and ensure that the stability of the online database is not affected; the use of the above-mentioned data query monitoring method can make the database query speed faster and the service performance more stable.

[0068] Figure 5 is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. It should be understood that: Figure 5 The modules are only schematically shown, and these modules may be virtual software modules or actual hardware modules. The combination and splitting of these modules and the addition of other modules are all within the protection scope of the present invention.

[0069] like Figure 5 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0070] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of the data query monitoring method described in any of the above embodiments. For example, the processing unit 610 can execute the following steps: Figures 1 to 3 Steps shown.

[0071] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0072] The storage unit 620 may also include a program / utility 6204 having one or more program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0073] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0074] The electronic device 600 can also communicate with one or more external devices 700, which can be one or more of a keyboard, a pointing device, a Bluetooth device, etc. These external devices 700 enable the user to communicate interactively with the electronic device 600. The electronic device 600 can also communicate with one or more other computing devices, and the computer device shown includes a router and a modem. This communication can be performed through an input / output (I / O) interface 650. In addition, the electronic device 600 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 660. The network adapter 660 can communicate with other modules of the electronic device 600 through a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.

[0075] The embodiment of the present invention further provides a computer-readable storage medium for storing a program, which implements the data query monitoring method described in any of the above embodiments when the program is executed. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the data query monitoring method described in any of the above embodiments.

[0076] As described above, the computer-readable storage medium of the present invention can automatically detect whether there is implicit conversion in the query statement during the testing process of the application service, without the need for manual type consistency check, and can efficiently identify risks early; detection is performed in the test environment, and query statements with implicit conversions are intercepted and alarmed, which can avoid abnormal database performance due to implicit conversion overhead after the query statement is released to the production environment, avoid impact on the online database, and ensure that the stability of the online database is not affected; the use of the above-mentioned data query monitoring method can make the database query speed faster and the service performance more stable.

[0077] Figure 6 Schematic diagram of the structure of the computer-readable storage medium of the present invention. Figure 6 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0078] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media include, but are not limited to: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0079] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0080] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device, such as through the Internet using an Internet service provider.

[0081] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A data query monitoring method, characterized in that: include: During the testing of an application service, obtaining in real time an execution plan of a query statement of the application service; Parsing the execution plan to determine whether the query statement requires implicit conversion; If yes, obtain implicit conversion information containing the query statement, the implicit conversion information further comprising: the request server and account information of the query statement, the target field in the query statement that needs implicit conversion, and the target data type of the target field in the database; and Monitoring the performance consumption data of the query statement executed by the database, and generating an alarm message according to the implicit conversion information and the performance consumption data and pushing it to the test end of the application service; The performance consumption data includes IO consumption data, CPU consumption data and execution time of the database executing the query statement. Before monitoring the performance consumption data of the database executing the query statement, the following is also included: Obtaining estimated consumption data of various performances of the database executing the query statement, including: obtaining the data volume of the corresponding column of the data table where the target field is located according to the storage position of the target field in the database as the data volume to be converted; obtaining the estimated consumption data corresponding to the data volume to be converted from the mapping relationship between the conversion data volume and the consumption data; Determine whether the estimated consumption data of at least one performance exceeds the corresponding risk threshold; If so, the execution of the query statement is intercepted, and the alarm information is generated according to the implicit conversion information and the estimated consumption data.

2. The data query monitoring method according to claim 1, characterized in that: The query statement is an SQL query statement. When parsing the execution plan, if a CONVERT_IMPLICIT statement exists in the execution plan, it is determined that the query statement requires implicit conversion.

3. The data query monitoring method according to claim 1, characterized in that: When it is determined that the query statement requires implicit conversion, it also includes: Intercept the release of the application service.

4. A data query monitoring device, characterized in that: include: An execution plan acquisition module is used to acquire the execution plan of the query statement of an application service in real time during the testing process of the application service; An implicit conversion detection module, used to parse the execution plan and determine whether the query statement requires implicit conversion; a conversion information acquisition module, configured to obtain implicit conversion information containing the query statement when determining that the query statement requires implicit conversion, wherein the implicit conversion information further includes: request server and account information of the query statement, target field in the query statement that requires implicit conversion, and target data type of the target field in the database; and An alarm information push module is used to monitor the performance consumption data of the database executing the query statement, and generate alarm information according to the implicit conversion information and the performance consumption data and push it to the test end of the application service; The performance consumption data includes IO consumption data, CPU consumption data and execution time of the database executing the query statement. Before the alarm information push module monitors the performance consumption data of the database executing the query statement, it also executes: Obtaining estimated consumption data of various performances of the database executing the query statement, including: obtaining the data volume of the corresponding column of the data table where the target field is located according to the storage position of the target field in the database as the data volume to be converted; obtaining the estimated consumption data corresponding to the data volume to be converted from the mapping relationship between the conversion data volume and the consumption data; Determine whether the estimated consumption data of at least one performance exceeds the corresponding risk threshold; If so, the execution of the query statement is intercepted, and the alarm information is generated according to the implicit conversion information and the estimated consumption data.

5. An electronic device, characterized in that: include: A processor; a memory storing executable instructions; Wherein, when the executable instruction is executed by the processor, the data query monitoring method as described in any one of claims 1-3 is implemented.

6. A computer-readable storage medium for storing a program, characterized in that: When the program is executed, the data query monitoring method according to any one of claims 1 to 3 is implemented.