Sql statement processing method, apparatus, device, and storage medium
By marking and performing time-consuming associations on target fields of database tables, the problem of being unable to analyze SQL performance in batches in existing technologies is solved, achieving efficient SQL statement optimization and problem screening, and improving user experience.
Patent Information
- Application Number
- CN202210746263.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-06-29
AI Technical Summary
Existing SQL statement analysis methods cannot perform batch analysis of the SQL performance of different components, resulting in low efficiency and an inability to optimize the SQL execution strategies of different components.
By marking target fields in the database table, marked data is obtained. When receiving SQL statements, parameter matching and time consumption correlation are performed. Results with time consumption exceeding the threshold are marked to optimize the execution strategy of SQL statements.
It enables batch analysis of SQL statements from different service components, improving the execution and analysis efficiency of SQL statements, quickly screening problematic SQL statements, and enhancing the user experience.
Smart Images

Figure CN115033593B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet technology, and in particular to a method, apparatus, device and storage medium for processing SQL statements. Background Technology
[0002] Existing effective methods for SQL statement analysis involve analyzing the execution plan of individual SQL statements to assess their performance. However, with increasing business volume, the adoption of microservices, and the proliferation of business components, the performance of data tables and related SQL statements varies across different components. Current SQL performance analysis solutions rely on analyzing logs generated during the execution of each SQL statement individually, which is inefficient and fails to perform batch SQL performance analysis on data from a single SQL statement execution, thus hindering the optimization of execution strategies for batches of SQL statements across different components. Summary of the Invention
[0003] This invention provides an SQL statement processing method, apparatus, device, and storage medium, which can analyze SQL statements from different components in batches and optimize execution strategies based on the analysis results, thereby improving the execution and analysis efficiency of SQL statements, facilitating the rapid screening of problematic SQL statements, and enhancing the user experience.
[0004] To solve the above-mentioned technical problems, one technical solution adopted by the present invention is to provide an SQL statement processing method, comprising:
[0005] Data information is obtained from a database table; target fields for creating a data model are extracted from the data information and the target fields are labeled to obtain labeled data.
[0006] Receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and associate the matching field with the execution time;
[0007] Within a first preset time period, statistically analyze the associated processing results where the execution time exceeds a preset time threshold, and mark the corresponding associated processing results to obtain the marked association relationship;
[0008] When a second SQL statement is received, the second parameter information of the second SQL statement is obtained, and the execution strategy of the second SQL statement is optimized based on the second parameter information and the tag association relationship.
[0009] According to an embodiment of the present invention, the steps of receiving a first SQL statement, obtaining first parameter information and execution time of the first SQL statement, matching the first parameter information with the marker data to obtain a matching field, and associating the matching field with the execution time include:
[0010] When the first SQL statement is received, the first SQL statement is intercepted and its parameters are parsed to obtain the first parameter information;
[0011] The first parameter information is matched with the tag data, and the matching field is extracted from the tag data based on the matching result;
[0012] Execute the first SQL statement and record the execution time of the first SQL statement, and associate the matching field with the execution time.
[0013] According to one embodiment of the present invention, when receiving a second SQL statement, obtaining second parameter information of the second SQL statement and optimizing the execution strategy of the second SQL statement based on the second parameter information and the tag association relationship includes:
[0014] When the second SQL statement is received, the second SQL statement is intercepted and its parameters are parsed to obtain the second parameter information;
[0015] Determine whether the second parameter information and the tag association have the same matching field;
[0016] If so, then when executing the second SQL statement, the execution strategy of returning an empty result will be adopted.
[0017] According to one embodiment of the present invention, in addition to adopting the execution strategy of returning an empty result when executing the second SQL statement, the method further includes:
[0018] The second SQL statement is executed asynchronously, the asynchronous execution result is obtained, and the asynchronous execution result is stored in Redis.
[0019] According to an embodiment of the present invention, after asynchronously executing the second SQL statement, obtaining the asynchronous execution result, and storing the asynchronous execution result in Redis, the method further includes:
[0020] When a third SQL statement is received within a second preset time period, the third SQL statement is intercepted and its parameters are parsed to obtain the third parameter information.
[0021] The third parameter information is compared with the second parameter information to determine whether the third parameter information and the second parameter information are the same;
[0022] If so, the asynchronous execution result is read from Redis.
[0023] According to an embodiment of the present invention, after obtaining data information from a database table, extracting target fields for creating a data model from the data information, and marking the target fields to obtain marked data, the method further includes:
[0024] A data model is created based on the target field, and the marker of the target field in the marked data is used as the attribute value of the corresponding field in the data model.
[0025] According to an embodiment of the present invention, after receiving a first SQL statement, obtaining first parameter information and execution time of the first SQL statement, matching the first parameter information with the marker data to obtain a matching field, and associating the matching field with the execution time, the method further includes:
[0026] Based on the matching field, obtain the target attribute value of the corresponding field from the data model;
[0027] The first SQL statement, the first parameter information, the matching field, the target attribute value, and the execution time are encapsulated.
[0028] The encapsulation result is asynchronously pushed to a message queue for message storage.
[0029] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is: to provide an SQL statement processing device, comprising:
[0030] The tagging module is used to obtain data information from the database table, extract the target field for creating the data model from the data information, and perform tagging processing on the target field to obtain tagged data;
[0031] The association module is used to receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and perform association processing on the matching field and the execution time;
[0032] The statistics module is used to count the associated processing results whose execution time exceeds a preset time threshold within a first preset time period and to mark the corresponding associated processing results to obtain the marked association relationship;
[0033] The optimization module is used to obtain the second parameter information of the second SQL statement when receiving the second SQL statement, and optimize the execution strategy of the second SQL statement based on the second parameter information and the tag association relationship.
[0034] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is: to provide a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the SQL statement processing method, the SQL statement processing method including:
[0035] Data information is obtained from a database table; target fields for creating a data model are extracted from the data information and the target fields are labeled to obtain labeled data.
[0036] Receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and associate the matching field with the execution time;
[0037] Within a first preset time period, statistically analyze the associated processing results where the execution time exceeds a preset time threshold, and mark the corresponding associated processing results to obtain the marked association relationship;
[0038] When a second SQL statement is received, the second parameter information of the second SQL statement is obtained, and the execution strategy of the second SQL statement is optimized based on the second parameter information and the tag association relationship.
[0039] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is: providing a computer storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, implements the above-mentioned SQL statement processing method, the SQL statement processing method comprising:
[0040] Data information is obtained from a database table; target fields for creating a data model are extracted from the data information and the target fields are labeled to obtain labeled data.
[0041] Receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and associate the matching field with the execution time;
[0042] Within a first preset time period, statistically analyze the associated processing results where the execution time exceeds a preset time threshold, and mark the corresponding associated processing results to obtain the marked association relationship;
[0043] When a second SQL statement is received, the second parameter information of the second SQL statement is obtained, and the execution strategy of the second SQL statement is optimized based on the second parameter information and the tag association relationship.
[0044] The beneficial effects of this invention are as follows: By marking the target fields, key information (i.e., matching fields) can be quickly located based on the marking results when analyzing the first SQL statement. The performance of the first SQL statement can be analyzed by statistically analyzing the execution time, and the associated processing results where the execution time exceeds a preset time threshold are marked. When receiving other SQL statements, the SQL statements can be quickly analyzed based on the marked association relationships, thereby realizing batch analysis of SQL statements of different service components, and optimizing the execution strategy based on the analysis results. This improves the execution efficiency and analysis efficiency of SQL statements, facilitates the rapid screening of problematic SQL statements, and enhances the user experience. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating an embodiment of the SQL statement processing method of the present invention;
[0046] Figure 2 This is a schematic diagram of the structure of the SQL statement processing device according to an embodiment of the present invention;
[0047] Figure 3 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention;
[0048] Figure 4 This is a schematic diagram of the structure of a computer storage medium according to an embodiment of the present invention. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0050] The terms "first," "second," and "third" used in this invention are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified. All directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of this invention are only used to explain the relative positional relationships and movements between components in a specific orientation (as shown in the figures). If the specific orientation changes, the directional indications also change accordingly. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0051] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0052] Figure 1 This is a flowchart illustrating an embodiment of the SQL statement processing method of the present invention. It should be noted that if substantially the same result is obtained, the method of the present invention does not necessarily require further clarification. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, the method includes the following steps:
[0053] Step S101: Obtain data information from the database table, extract the target field for creating the data model from the data information, and mark the target field to obtain marked data.
[0054] In step S101, the database table is preset by the user and consists of multiple data entries. These data entries can be used to create data models, with one data model corresponding to one data entry. The attributes of the data model correspond one-to-one with the fields of the data entry. A data model is created when new data is added to the database table, and the corresponding data model is deleted when data is deleted. In this embodiment, the fields in the data entry that correspond one-to-one with the data model are used as target fields. There can be one or more target fields. Custom annotations are added to the target fields, such as darkening the color of the target field, modifying the color of the target field, or adding markers. After obtaining the marked data, this embodiment creates a data model based on the target fields and uses the markers of the target fields in the marked data as the attribute values of the corresponding fields in the data model.
[0055] For example, if the target fields include recipient, sending time, and message module, and the custom annotation added to each target field is @indexTag, then the attributes of the data model include recipient, sending time, and message module, and the attribute value of each attribute must include at least @indexTag.
[0056] Step S102: Receive the first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marked data, obtain the matching field, and associate the matching field with the execution time.
[0057] In step S102, when the first SQL statement is received, the Mybatis interceptor intercepts the first SQL statement and parses its parameters to obtain the first parameter information; the first parameter information is matched with the tag data, and the matching field is extracted from the tag data based on the matching result; the first SQL statement is executed and its execution time is recorded, and the matching field is associated with the execution time. In this embodiment, the first parameter information may contain one or more fields, for example, the first parameter information may include one or more of the following: recipient, sending time, message module, and message type. The tag data may contain one or more fields, for example, the tag data may include one or more of the following: recipient, sending time, message module, and message type. If the tag data includes recipient, sending time, message module, and message type, and the first parameter information includes recipient and sending time, then each field of the first parameter information is compared with the target field of the tag data. Fields with the same name are considered to be matched. In this application scenario, the matching fields are recipient and sending time. At this time, the fields "recipient" and "sending time" marked with @indexTag are extracted. The extracted fields are then associated with the execution time of the first SQL statement, that is, a one-to-one mapping relationship is formed between the extracted fields and the execution time of the first SQL statement, such as (@indexTag receiver, @indexTag postTime -> execution time).
[0058] Based on the above embodiments, in another feasible implementation, after step S102, the method further includes obtaining the target attribute value of the corresponding field from the data model according to the matching field; encapsulating the first SQL statement, the first parameter information, the matching field, the target attribute value, and the execution time; and asynchronously pushing the encapsulation result to the message queue for message storage.
[0059] Step S103: Within a first preset time period, count the associated processing results whose execution time exceeds a preset time threshold and mark the corresponding associated processing results to obtain the marked association relationship.
[0060] In step S103, the execution time of the associated processing results can be periodically obtained through a JOB scheduled task. The obtained execution time is compared with a preset time threshold, and associated processing results that exceed the preset time threshold are marked to obtain the marked association relationship and store the marked association relationship in the database. For example, the JOB scheduled task searches for associated processing results with an execution time exceeding 2 seconds within one minute and marks the associated processing results exceeding 2 seconds as slow SQL. When receiving SQL statements in batches or SQL statements from different components, slow SQL can be identified based on the marked association relationship. This realizes the performance analysis of a single SQL statement to perform batch SQL performance analysis of different components, improving the processing and analysis efficiency of SQL statements.
[0061] Step S104: When receiving the second SQL statement, obtain the second parameter information of the second SQL statement, and optimize the execution strategy of the second SQL statement based on the second parameter information and the tag association relationship.
[0062] In step S104, when the second SQL statement is received, the Mybatis interceptor intercepts the second SQL statement and parses its parameters to obtain the second parameter information. It then determines whether the second parameter information and the tag association have the same matching field. If so, an execution strategy that returns an empty result is adopted when executing the second SQL statement. In this embodiment, the second parameter information is similar to the first parameter information. By determining whether the second parameter information and the tag association have the same matching field, it identifies whether the second SQL statement is a slow SQL statement. If the second parameter information and the tag association have the same matching field, the second SQL statement is considered a slow SQL statement, and an execution strategy that returns an empty result is directly adopted. This reduces resource consumption and improves processing efficiency, thereby improving the user experience.
[0063] In one feasible implementation, the second SQL statement returns an empty result while the second SQL statement is executed asynchronously. The asynchronous execution result is obtained and stored in Redis. This makes it convenient to directly retrieve the return result from Redis when receiving the same SQL statement in the future, which helps to reduce the access pressure on the database and improve processing efficiency and user experience.
[0064] Building upon the above embodiments, further, when the third SQL statement is received within a second preset time, a Mybatis interceptor is used to intercept the third SQL statement and parse its parameters to obtain third parameter information. The third parameter information is then compared with the second parameter information to determine if they are identical. If they are identical, the asynchronous execution result is read from Redis. This embodiment can periodically obtain the third SQL statement through a JOB scheduled task, parse its parameters to obtain third parameter information, and compare it with the second parameter information. If the third parameter information is identical to the second parameter information, it is considered that the third SQL statement and the second SQL statement are the same request, and the asynchronous execution result is directly read from Redis, reducing the number of slow SQL executions and further improving processing efficiency and user experience.
[0065] In another feasible implementation, after the second SQL statement returns an empty result, the execution strategy, asynchronous execution result, second parameter information, and tag association relationship of the returned empty result are encapsulated; the encapsulated result is asynchronously pushed to a message queue for message storage, which facilitates quick querying of the type of SQL statement when receiving subsequent SQL statements, and if it is determined to be the same SQL statement, the returned result can be directly obtained from the database, which helps to reduce the access pressure on the database and improve processing efficiency and user experience.
[0066] The SQL statement processing method of the first embodiment of the present invention marks the target field, and when analyzing the first SQL statement, it can quickly locate key information (i.e., matching fields) based on the marking results. It analyzes the performance of the first SQL statement by statistically analyzing the execution time, and marks the related processing results where the execution time exceeds a preset time threshold. When receiving other SQL statements, it can quickly analyze the SQL statements based on the marked relationships, thereby realizing batch analysis of SQL statements of different service components, and optimizing the execution strategy based on the analysis results. This improves the execution efficiency and analysis efficiency of SQL statements, facilitates the rapid screening of problematic SQL statements, and enhances the user experience.
[0067] Figure 2 This is a schematic diagram of the structure of the SQL statement processing device according to an embodiment of the present invention. Figure 2 As shown, the device 20 includes a labeling module 21, an association module 22, a statistics module 23, and an optimization module 24.
[0068] The tagging module 21 is used to obtain data information from the database table, extract the target field for creating the data model from the data information, and perform tagging processing on the target field to obtain tagged data;
[0069] The association module 22 is used to receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and perform association processing between the matching field and the execution time;
[0070] The statistics module 23 is used to count the associated processing results whose execution time exceeds a preset time threshold within a first preset time period and to mark the corresponding associated processing results to obtain the marked association relationship;
[0071] The optimization module 24 is used to obtain the second parameter information of the second SQL statement when receiving the second SQL statement, and optimize the execution strategy of the second SQL statement according to the second parameter information and the tag association relationship.
[0072] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Figure 3 As shown, the computer device 30 includes a processor 31 and a memory 32 coupled to the processor 31.
[0073] The memory 32 stores program instructions for implementing the SQL statement processing method described in any of the above embodiments.
[0074] The SQL statement processing method includes:
[0075] Data information is obtained from a database table; target fields for creating a data model are extracted from the data information and the target fields are labeled to obtain labeled data.
[0076] Receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and associate the matching field with the execution time;
[0077] Within a first preset time period, statistically analyze the associated processing results where the execution time exceeds a preset time threshold, and mark the corresponding associated processing results to obtain the marked association relationship;
[0078] When a second SQL statement is received, the second parameter information of the second SQL statement is obtained, and the execution strategy of the second SQL statement is optimized based on the second parameter information and the tag association relationship.
[0079] The processor 31 is used to execute program instructions stored in the memory 32 to process SQL statements.
[0080] The processor 31 can also be referred to as a CPU (Central Processing Unit). The processor 31 may be an integrated circuit chip with signal processing capabilities. The processor 61 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor.
[0081] See Figure 4 , Figure 4 This is a schematic diagram of the structure of a computer storage medium according to an embodiment of the present invention. The computer storage medium of the present invention stores a program file 41 capable of implementing all the above methods. The program file 41 can be stored in the computer storage medium in the form of a software product, and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0082] SQL statement processing methods include:
[0083] Data information is obtained from a database table; target fields for creating a data model are extracted from the data information and the target fields are labeled to obtain labeled data.
[0084] Receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and associate the matching field with the execution time;
[0085] Within a first preset time period, statistically analyze the associated processing results where the execution time exceeds a preset time threshold, and mark the corresponding associated processing results to obtain the marked association relationship;
[0086] When a second SQL statement is received, the second parameter information of the second SQL statement is obtained, and the execution strategy of the second SQL statement is optimized based on the second parameter information and the tag association relationship.
[0087] The aforementioned computer storage media include: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks or optical disks, and other media that can store program code, or terminal devices such as computers, servers, mobile phones, and tablets.
[0088] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0089] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0090] The above are merely embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for processing SQL statements, characterized in that, include: Data information is obtained from a database table; target fields for creating a data model are extracted from the data information and the target fields are labeled to obtain labeled data. Receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and associate the matching field with the execution time; Within a first preset time period, statistically analyze the associated processing results where the execution time exceeds a preset time threshold, and mark the corresponding associated processing results to obtain the marked association relationship; Upon receiving a second SQL statement, the system obtains the second parameter information of the second SQL statement and optimizes the execution strategy of the second SQL statement based on the second parameter information and the tag association relationship; including: When the second SQL statement is received, the second SQL statement is intercepted and its parameters are parsed to obtain the second parameter information; Determine whether the second parameter information and the tag association have the same matching field; If so, then when executing the second SQL statement, the execution strategy of returning an empty result will be adopted.
2. The SQL statement processing method according to claim 1, characterized in that, The step of receiving a first SQL statement, obtaining the first parameter information and execution time of the first SQL statement, matching the first parameter information with the marker data to obtain a matching field, and associating the matching field with the execution time includes: When the first SQL statement is received, the first SQL statement is intercepted and its parameters are parsed to obtain the first parameter information; The first parameter information is matched with the tag data, and the matching field is extracted from the tag data based on the matching result; Execute the first SQL statement and record the execution time of the first SQL statement, and associate the matching field with the execution time.
3. The SQL statement processing method according to claim 1, characterized in that, The execution strategy of returning an empty result when executing the second SQL statement also includes: The second SQL statement is executed asynchronously, the asynchronous execution result is obtained, and the asynchronous execution result is stored in Redis.
4. The SQL statement processing method according to claim 3, characterized in that, After asynchronously executing the second SQL statement, obtaining the asynchronous execution result, and storing the asynchronous execution result in Redis, the process further includes: When a third SQL statement is received within a second preset time period, the third SQL statement is intercepted and its parameters are parsed to obtain the third parameter information. The third parameter information is compared with the second parameter information to determine whether the third parameter information and the second parameter information are the same; If so, the asynchronous execution result is read from Redis.
5. The SQL statement processing method according to claim 1, characterized in that, After obtaining data information from the database table, extracting the target field for creating the data model from the data information, and marking the target field to obtain the marked data, the process further includes: A data model is created based on the target field, and the marker of the target field in the marked data is used as the attribute value of the corresponding field in the data model.
6. The SQL statement processing method according to claim 5, characterized in that, After receiving the first SQL statement, obtaining the first parameter information and execution time of the first SQL statement, matching the first parameter information with the marker data to obtain the matching field, and associating the matching field with the execution time, the process further includes: Based on the matching field, obtain the target attribute value of the corresponding field from the data model; The first SQL statement, the first parameter information, the matching field, the target attribute value, and the execution time are encapsulated. The encapsulation result is asynchronously pushed to a message queue for message storage.
7. An SQL statement processing apparatus for implementing the SQL statement processing method as described in any one of claims 1-6, characterized in that, include: The tagging module is used to obtain data information from the database table, extract the target field for creating the data model from the data information, and perform tagging processing on the target field to obtain tagged data; The association module is used to receive a first SQL statement, obtain the first parameter information and execution time of the first SQL statement, match the first parameter information with the marker data, obtain the matching field, and perform association processing on the matching field and the execution time; The statistics module is used to count the associated processing results whose execution time exceeds a preset time threshold within a first preset time period and to mark the corresponding associated processing results to obtain the marked association relationship; The optimization module is used to obtain the second parameter information of the second SQL statement when receiving the second SQL statement, and optimize the execution strategy of the second SQL statement based on the second parameter information and the tag association relationship.
8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the SQL statement processing method as described in any one of claims 1-6.
9. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the SQL statement processing method as described in any one of claims 1-6.
Citation Information
Patent Citations
Performance monitoring method and device for database operation, equipment and storage medium
CN110297814A
SQL (Structured Query Language) query method and device, equipment, storage medium and program product
CN114372076A