A SQL killing method, a killing device, a control device and a readable storage medium

By obtaining database attributes and invoking detection rules, and setting detection standards for different database types, the problem of untimely processing of abnormal SQL statements was solved, improving system efficiency and user experience.

CN115827673BActive Publication Date: 2026-02-17BEIJING JIEHUI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211648137.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-21
Publication Date
2026-02-17
Estimated Expiration
2042-12-21

AI Technical Summary

Technical Problem

Existing technologies cannot detect and handle abnormal SQL statements in a timely and accurate manner, leading to increased system resource consumption, impacting database performance and reducing user experience.

Method used

By obtaining database attributes, calling the corresponding detection rules, obtaining the execution information of the SQL statements to be detected, and determining whether to perform detection based on the rules, including creating a table of business users that can be detected and a table recording detection information, and setting different detection standards for different types of database attributes.

Benefits of technology

It enables the rapid and accurate detection and timely handling of abnormal SQL statements, improving system efficiency, reducing customer churn, and enhancing user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115827673B_ABST
    Figure CN115827673B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of database, and specifically provides a SQL killing method, a killing device, a control device and a readable storage medium, aiming at solving the problem of how to discover abnormal SQL statements in time and accurately. For this purpose, the SQL killing method comprises: acquiring database attributes; calling corresponding killing rules according to the database attributes; acquiring running information of to-be-killed SQL statements; and killing the to-be-killed SQL statements meeting the killing rules according to the running information. According to different database attributes, different SQL killing rules are called, so that abnormal SQL statements can be found more quickly and accurately, and killing processing can be performed in time. The problem of low system running efficiency caused by untimely discovery of abnormal SQL statements is avoided. The system can maintain a high-efficiency running state, greatly improving the use experience of customers and reducing the loss of customers.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database, and specifically provides a SQL killing method, a killing device, a control device and a readable storage medium. BACKGROUND

[0002] A database is a warehouse for organizing, storing and managing data according to a data structure. It is a long-term storage in a computer, an organized, shareable and unified management of a large amount of data collection. In order to ensure the stability of the database and the running system, it is necessary to find the abnormal SQL statement in time. Abnormal SQL statements will occupy system resources, occupy concurrent resources of the user, affect the performance of the database, and easily cause faults.

[0003] At present, only in the case of self-discovery and feedback of the development business or operation and maintenance personnel, can the database be concerned about the presence of some slow SQL statements, which need to be handled by human intervention. Human intervention is very tedious, for example, finding out which developer executed the source of the slow SQL statement and whether the developer can be contacted to cancel the operation. Or according to the experience of the staff to judge whether the session operation can be killed from the database server. Usually, such human intervention or experience judgment method has low real-time performance, which will greatly affect the business feeling, the user experience is poor, and the user loss is caused.

[0004] The prior art CN114490720A discloses a SQL killing method, but it is mainly for a distributed database system of a data warehouse. For traditional relational business systems, it cannot meet the business needs, for example, there is a missed killing, and it is not flexible enough.

[0005] Correspondingly, there is a need in the field for a new SQL killing scheme to solve the above problems. SUMMARY

[0006] In order to overcome the above defects, the present application is proposed to provide a SQL killing method, killing device, control device and readable storage medium to solve or at least partially solve the technical problem of how to find abnormal SQL statements in time and accurately.

[0007] In a first aspect, the present application provides a SQL killing method, comprising the following steps:

[0008] Obtaining database properties;

[0009] According to the database properties, the corresponding killing rules are called;

[0010] Obtaining the running information of the SQL statement to be killed;

[0011] According to the running information, the SQL statement to be killed that meets the killing rule is killed.

[0012] In one embodiment, before the corresponding killing rule is invoked according to the database attribute, the method further comprises:

[0013] creating a killable business user table;

[0014] locking the SQL statement to be killed by reading the killable business user table.

[0015] In one embodiment, the method further comprises creating an information table recording the SQL statement to be killed, wherein the information table records the information of the SQL statement to be killed.

[0016] In one embodiment, the running information of the SQL statement to be killed comprises:

[0017] reading the killable business user table to obtain the SQL identifier to be killed;

[0018] obtaining the running information of the corresponding SQL statement according to the SQL identifier to be killed, wherein the running information comprises the execution time and the text type of the SQL statement to be killed.

[0019] In one embodiment, the database attribute is an online analytical processing type database.

[0020] According to the running information, the SQL statement to be killed satisfying the killing rule is killed, comprising:

[0021] judging whether the execution time of the SQL statement to be killed is greater than a first preset time and the text type is marked as select;

[0022] if the execution time of the SQL statement to be killed is greater than the first preset time and the text type is marked as select, killing the SQL statement;

[0023] if the execution time of the SQL statement to be killed is not greater than the first preset time or the text type is not marked as select, not killing the SQL statement.

[0024] In one embodiment, the database attribute is an online transaction processing type database.

[0025] According to the running information, the SQL statement to be killed satisfying the killing rule is killed, comprising:

[0026] judging whether the execution time of the SQL statement to be killed is greater than a second preset time and the text type is marked as select, insert, delete or update;

[0027] If the execution time of the SQL statement to be killed is greater than the second preset time and the text type is marked as any one of select, insert, delete or update, the SQL statement is killed.

[0028] If the execution time of the SQL statement to be killed is not greater than the second preset time or the text type is not marked as any one of select, insert, delete or update, the SQL statement is not killed.

[0029] In one embodiment, the database attribute is obtained by reading a list file under a tmp path from a server where the database is located, so as to obtain the database attribute, wherein the database attribute includes online transaction processing and online analytical processing.

[0030] In a second aspect, the application provides a SQL killing device, comprising:

[0031] An obtaining module is configured to obtain a database attribute;

[0032] A calling module is configured to call a corresponding killing rule according to the database attribute;

[0033] A finding module is configured to obtain running information of a SQL statement to be killed;

[0034] A killing module is configured to kill the SQL statement to be killed according to the running information.

[0035] In a third aspect, a control device is provided, comprising a processor and a storage device, the storage device is adapted to store a plurality of program codes, characterized in that the program codes are adapted to be loaded and run by the processor to execute the SQL killing method in any of the above technical solutions.

[0036] In a fourth aspect, a computer readable storage medium is provided, wherein a plurality of program codes are stored, characterized in that the program codes are adapted to be loaded and run by a processor to execute the SQL killing method in any of the above technical solutions.

[0037] The above one or more technical solutions of the application have at least one or more of the following beneficial effects:

[0038] In the technical scheme of the present application, different SQL killing rules are called according to different database attributes, so that the abnormal SQL statements can be found more quickly and accurately, and the killing processing can be performed in time. The problem of low system running efficiency caused by the untimely discovery of abnormal SQL statements is avoided. The system can maintain a high-efficiency running state, greatly improving the use experience of customers and reducing the loss of customers. BRIEF DESCRIPTION OF DRAWINGS

[0039] The disclosed content of the present application will become more apparent with reference to the drawings. It is easy for those skilled in the art to understand that the drawings are only for the purpose of illustration, and are not intended to limit the protection scope of the present application. In addition, similar numbers in the drawings are used to represent similar components, wherein:

[0040] Figure 1 is a main step flow diagram of a SQL killing method according to an embodiment of the present application;

[0041] Figure 2 is a schematic diagram of a killable business user table according to an embodiment of the present application;

[0042] Figure 3 is a main step flow diagram of killing a to-be-killed SQL statement by an online analytical processing type database according to an embodiment of the present application;

[0043] Figure 4 is a main step flow diagram of killing a to-be-killed SQL statement by an online transaction processing type database according to an embodiment of the present application;

[0044] Figure 5 is a schematic diagram of an information table for recording a killed SQL statement according to an embodiment of the present application;

[0045] Figure 6 is a main structure block diagram of a SQL killing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0046] Some embodiments of the present application will be described below with reference to the drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present application, and are not intended to limit the protection scope of the present application.

[0047] In the description of the present application, "module" and "processor" can include hardware, software or a combination of both. A module can include hardware circuitry, various suitable sensors, communication ports, memory, and can also include a software portion such as program code, and can be a combination of software and hardware. The processor can be a central processor, microprocessor, image processor, digital signal processor or any other suitable processor. The processor has data and / or signal processing functions. The processor can be implemented in software, hardware or a combination of both. The non-transitory computer readable storage medium includes any suitable medium that can store program code, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B or both A and B. The term "at least one of A or B" or "at least one of A and B" has a similar meaning as "A and / or B" and can include only A, only B or both A and B. The singular form of the term "one", "this" can also include the plural form.

[0048] Referring to the drawings Figure 1 , Figure 1 is a schematic diagram of the main steps of the SQL killing method according to an embodiment of the present application. As shown in Figure 1 , the following steps S10-S40 are included.

[0049] S10, obtaining database properties;

[0050] In this embodiment, the database is the most important basic software, which is the cornerstone to ensure the stable operation of the computer system. The database is a warehouse for storing data, and its storage space is very large, which can store millions of data, tens of millions of data, and hundreds of millions of data. However, the database does not store data randomly, but has certain rules, otherwise the query efficiency will be very low. Among them, the relational database has become the most important member in the current database products. Most relational databases follow the SQL (Structured Query Language) standard. Common operations include query, add, update, delete, sum, sort, etc.

[0051] In one embodiment, a list file under a tmp path is read from a server where the database is located, so as to obtain the database attribute, wherein the database attribute comprises an online transaction processing (OLTP) attribute (i.e., an OLTP type database) and an online analytical processing (OLAP) attribute (i.e., an OLAP type database). Further, in different attribute databases, the definition of the SQL to be killed is also different. In a traditional relational online transaction processing business system, 7*24h business is borne, and the killing of the SQL statement is more demanding, and the quality of the SQL statement has a higher requirement.

[0052] S20, calling a corresponding killing rule according to the database attribute;

[0053] In the embodiment, the database attribute comprises the online transaction processing and the online analytical processing. The online transaction processing system is a computer application system taking a transaction element as a unit of data processing and realizing human-computer interaction. The system can update or operate data in real time, and the data in the system is always kept in the latest state. An important index for measuring the online transaction processing result is the system performance, which is specifically embodied as a real-time request-response time (Response Time), i.e., the time required for the computer to give a reply to the request after the user inputs data on the terminal. The processing speed and degree depend on the database engine, the server and the application engine. That is, the online transaction processing pays more attention to the continuity and timeliness of the business, and saves the database CPU, network and resources in a high concurrency scenario.

[0054] The online analytical processing enables an analyst to quickly, consistently and interactively observe information from various aspects to achieve the purpose of in-depth understanding of data. It has the characteristics of sharing multi-dimensional information and quick analysis. That is, the online analytical processing is mainly based on report analysis, and the difference from the online transaction processing is that the online analytical processing pays attention to data and has no concern for timeliness. The processing time of the online transaction processing and the online analytical processing is different. The online transaction processing is generally a 7*24h business, and mainly focuses on the addition, deletion, modification and query of the user, while the online analytical processing is generally analysis-oriented, and is relatively busy in the daytime or night fixed time period, and has half of the idle time. Moreover, the hardware cost of the two is different. The online transaction processing is a high-performance server and storage, while the online analytical processing is generally a server and storage with ordinary or medium configuration. In terms of continuous resource occupation, the shorter the time is, the better, so as to achieve efficient use of resources. Therefore, corresponding killing rules are called according to different database attributes, different database work requirements are met, the occupation of system resources by the slow SQL is reduced, and the purpose of efficient operation of the system is achieved.

[0055] In one embodiment, before step S10 according to the database attribute and step S20 calling the corresponding killing rule, it further comprises steps S01-S02:

[0056] S01, creating a killable business user table;

[0057] S02, locking the SQL statement to be killed by reading the killable business user table.

[0058] In the embodiment, the terminal user makes a request for adding, deleting, searching and modifying the relational database through the client server, that is, generating a SQL statement to add, delete, search and modify the database (for adding, deleting, searching and modifying, corresponding to a unique SQL identifier). The client server includes various categories, belonging to different businesses, such as transaction server, query server, channel server, routing server, etc. Therefore, the business user is not limited to one category of user, and can include different categories of users, such as transaction corresponding to transaction user, query corresponding to query user, channel corresponding to channel user, routing corresponding to routing user, etc. The purpose of creating the killable business user table is to traverse the killable business user information, more orderly screen the information, and reduce the occurrence of missed search.

[0059] In one specific embodiment, as shown in Figure 2 The information recorded in the killable business user table can be flexibly adjusted according to specific needs. The setting of the killable business user table is to write the killable business user into the table, which is convenient for subsequent finding of slow SQL, that is, the SQL statement that needs to be killed. The information recorded in the killable business user table includes but is not limited to the business user name (USERNAME) that can be killed, the SQL identifier (SQL ID) and the machine name (MACHINE). For any generated SQL statement, there is a corresponding SQL identifier, and also a user name and a machine name, that is, through the business user name, machine name and SQL identifier in the killable business user table, the corresponding SQL statement to be killed can be locked. Among them, the machine name records the client server category. It should be noted that for the same business user name, it may correspond to multiple servers (i.e. multiple machine names). That is, the same business user name may appear in multiple systems, such as transaction user, which will appear in the transaction database and the historical database. That is, it is not possible to determine whether the SQL statement corresponding to the business user name can be killed slow SQL only by the business user name. Therefore, different servers, that is, machine names can be distinguished to achieve accurate killing of slow SQL.

[0060] Further, the created killable business user table is stored in the database server, for example, in the transaction database and the historical database.

[0061] S30, obtaining running information of the SQL statement to be killed;

[0062] In one embodiment, the obtaining of the running information of the SQL statement to be killed comprises steps S301-S302:

[0063] S301, reading the killable business user table to obtain a SQL identification to be killed;

[0064] In the embodiment, the killable business user table records information of the SQL statement to be killed, and the SQL identification, i.e. SQL-ID, is obtained by reading the killable business user table, so as to lock the SQL statement to be killed.

[0065] S302, obtaining running information of the corresponding SQL statement according to the SQL identification to be killed, wherein the running information comprises execution time and text type of the SQL statement to be killed.

[0066] S40, killing the SQL statement to be killed satisfying the killing rule according to the running information.

[0067] In one embodiment, referring to Figure 3 , Figure 3 the main step flowchart of killing the SQL statement to be killed for the online analytical processing type database. The database attribute is the online analytical processing type database, the killing of the SQL statement to be killed satisfying the killing rule according to the running information comprises steps S401-S403:

[0068] S401, judging whether the execution time of the SQL statement to be killed is greater than a first preset time and whether the text type is marked as select.

[0069] S402, if the execution time of the SQL statement to be killed is greater than the first preset time and the text type is marked as select, killing the SQL statement.

[0070] S403, if the execution time of the SQL statement to be killed is not greater than the first preset time or the text type is not marked as select, not killing the SQL statement.

[0071] In the embodiment, the first preset time can be flexibly set according to the requirement of the business, for example, 15 seconds. In a specific example, a table in the database, i.e., a database view v$sessions, is queried, and the time in the S.LAST-CALL-ET field of the s table is the first preset time. The text type is marked in the SQL-TEXT field. In a specific example, the database view v$sql is queried, and the SQL statement with the select keyword is killed. Specifically, the select * from in the SQL-TEXT field indicates that the SQL statement does not conform to the development specification, for example, the development specification stipulates that SQL* is prohibited in the SQL statement, and if the wildcard is used, the operation on the data will be burdened, and therefore the SQL statement needs to be deleted.

[0072] Further, the business user not in the business user name field is not killed.

[0073] In an embodiment, referring to Figure 4 , Figure 4 is a main step flow diagram of the online transaction processing type database for killing the SQL statement to be killed. The database attribute is an online transaction processing type database, and according to the running information, the SQL statement to be killed that meets the killing rule is killed, including steps S404-S406:

[0074] S404, judging whether the execution time of the SQL statement to be killed is greater than the second preset time and the mark of the text type is any one of select, insert, delete, or update.

[0075] S405, if the execution time of the SQL statement to be killed is greater than the second preset time and the mark of the text type is any one of select, insert, delete, or update, the SQL statement to be killed is killed;

[0076] S406, if the execution time of the SQL statement to be killed is not greater than the second preset time or the mark of the text type is not any one of select, insert, delete, or update, the SQL statement to be killed is not killed.

[0077] In the embodiment, the second preset time is set according to the business requirement, for example, 5 seconds. In a specific example, the database view v$sessions is queried in association, and the time in the S.LAST-CALL-ET field of the s table is the second preset time. The text type is marked in the SQL-TEXT field. In a specific example, the database view v$sql is queried in association, and the SQL statement with any one of the keywords of select, insert, delete, and update is killed.

[0078] Similarly, the business user not in the business user name field is not killed.

[0079] In an embodiment, the method further comprises: creating an information table recording the information of the killed SQL statement. Although the SQL statement is known to be killed by the unique identification of the SQL identification, i.e., SQL-ID, the information of the SQL-ID is not complete enough for the developer. Therefore, more complete information can be further recorded. Preferably, as shown in the table, the recorded information includes but is not limited to SID, OSID, username, SQL_ID, SQL_TEXT, program, EXEC_TIME, rusult, and machine. The SID represents the thread number of the database corresponding to the killed SQL; the OSID represents the process number of the operating system corresponding to the killed SQL; by recording the program, it can be known that the business comes from the JDBC or the internal bastion host; the EXEC_TIME represents the execution time of the SQL session. Figure 5

[0080] In the technical solution of the present application, by calling different SQL killing rules according to different database attributes, the abnormal SQL statement can be found more quickly and accurately, and the killing processing can be performed in time. The problem of low system running efficiency caused by the untimely discovery of the abnormal SQL statement is avoided. The system can maintain the high-efficiency running state, greatly improves the use experience of the customer, and reduces the loss of the customer.

[0081] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art can understand that, in order to achieve the effect of the present application, the different steps do not necessarily have to be executed in such an order, and they can be executed simultaneously (in parallel) or in other orders, and these changes are within the protection scope of the present application.

[0082] Further, the present application also provides a SQL killing device 50. Referring to FIG. 2, the SQL killing device 50 comprises a processor 51, a memory 52, and a communication interface 53. The processor 51 is connected to the memory 52 and the communication interface 53.​Figure 6 , Figure 6 This is a main structural block diagram of an SQL removal device according to an embodiment of the present invention. The SQL removal device 50 in this embodiment mainly includes an acquisition module 501, a calling module 502, a searching module 503, and a removal module 504. The acquisition module 501 acquires database attributes; the calling module 502 calls corresponding removal rules according to the database attributes; the searching module 503 acquires the execution information of the SQL statements to be removed; and the removal module 504 removes the SQL statements that meet the removal rules according to the execution information. In some embodiments, one or more of the acquisition module 501, calling module 502, searching module 503, and removal module 504 can be combined into a single module.

[0083] The aforementioned SQL removal tool is used to execute Figure 1 The SQL detection and removal method embodiments shown are similar in technical principle, the technical problems they solve, and the technical effects they produce. Those skilled in the art can clearly understand this. For the sake of convenience and brevity, the specific working process and related descriptions of the SQL detection and removal device can be found in the embodiments of the SQL detection and removal method, and will not be repeated here.

[0084] Furthermore, it should be understood that since the various modules are only provided to illustrate the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the processor's software, hardware, or a combination of software and hardware. Therefore, the number of modules shown in the figures is merely illustrative.

[0085] Those skilled in the art will understand that the various modules in the device can be adaptively split or combined. Such splitting or combining of specific modules will not cause the technical solution to deviate from the principles of the present invention; therefore, the technical solutions after splitting or combining will fall within the protection scope of the present invention.

[0086] Those skilled in the art can understand that all or part of the processes in the method of the above-mentioned embodiment of the present application can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiments when executed by a processor. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms, etc. The computer readable storage medium can include any entity or device, medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code. It should be noted that the contents included in the computer readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable storage medium does not include electrical carrier signals and telecommunication signals.

[0087] Further, the present application also provides a control device. In an embodiment of the control device according to the present application, the control device comprises a processor and a storage device, the storage device can be configured to store a program for executing the SQL killing method of the above-mentioned method embodiments, and the processor can be configured to execute the program in the storage device, which includes but is not limited to the program for executing the SQL killing method of the above-mentioned method embodiments. For the convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technical details not disclosed are referred to the method part of the embodiments of the present application. The control device can be a control device device formed by various electronic devices.

[0088] Further, the present application also provides a computer readable storage medium. In an embodiment of the computer readable storage medium according to the present application, the computer readable storage medium can be configured to store a program for executing the SQL killing method of the above-mentioned method embodiments, which can be loaded and run by a processor to implement the above-mentioned SQL killing method. For the convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technical details not disclosed are referred to the method part of the embodiments of the present application. The computer readable storage medium can be a storage device device formed by various electronic devices, and optionally, the computer readable storage medium in the embodiments of the present application is a non-transitory computer readable storage medium.

[0089] The technical scheme of the present application has been described in combination with the preferred embodiments shown in the drawings, but it is easily understood by those skilled in the art that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the related technical features without departing from the principles of the present application, and the technical schemes after the changes or replacements will all fall within the protection scope of the present application.

Claims

1. A SQL killing method, characterized in that, The method comprises: acquiring database attributes; calling corresponding killing rules according to the database attributes; acquiring running information of a to-be-killed SQL statement; killing the to-be-killed SQL statement meeting the killing rules according to the running information; wherein, before the calling of the corresponding killing rules according to the database attributes, the method further comprises: creating a killable business user table; locking the to-be-killed SQL statement by reading the killable business user table; wherein, the acquiring of the running information of the to-be-killed SQL statement comprises: reading the killable business user table to acquire a to-be-killed SQL identifier; acquiring running information of a corresponding SQL statement according to the to-be-killed SQL identifier, wherein the running information comprises execution time and a text type of the to-be-killed SQL statement; wherein, the database attributes are online analytical processing type databases; the killing of the to-be-killed SQL statement meeting the killing rules according to the running information comprises: judging whether the execution time of the to-be-killed SQL statement is greater than a first preset time and whether a mark of the text type is select; if the execution time of the to-be-killed SQL statement is greater than the first preset time and the mark of the text type is select, killing the to-be-killed SQL statement; if the execution time of the to-be-killed SQL statement is not greater than the first preset time or the mark of the text type is not select, not killing the to-be-killed SQL statement.

2. The method of claim 1, wherein, The method further comprises creating an information table recording the to-be-killed SQL statement, wherein the information table records information of the to-be-killed SQL statement.

3. The method according to claim 1, wherein, the database attributes are online transaction processing type databases; the killing of the to-be-killed SQL statement meeting the killing rules according to the running information comprises: judging whether the execution time of the to-be-killed SQL statement is greater than a second preset time and whether a mark of the text type is any one of select, insert, delete or update; if the execution time of the to-be-killed SQL statement is greater than the second preset time and the mark of the text type is any one of select, insert, delete or update, killing the to-be-killed SQL statement; if the execution time of the to-be-killed SQL statement is not greater than the second preset time or the mark of the text type is not any one of select, insert, delete or update, not killing the to-be-killed SQL statement.

4. The method of claim 1, wherein, The acquiring of the database attributes comprises reading a list file under a tmp path from a server where the database is located, so as to acquire the database attributes, wherein the database attributes comprise online transaction processing and online analytical processing.

5. A SQL killing apparatus, characterized by, comprises an acquiring module for acquiring database attributes; a calling module for calling corresponding killing rules according to the database attributes; a finding module for acquiring running information of a to-be-killed SQL statement; a killing module for killing the to-be-killed SQL statement meeting the killing rules according to the running information; Before the corresponding killing rule is called according to the database attribute, the device further comprises: creating a killable business user table; locking the to-be-killed SQL statement by reading the killable business user table; The operation information of the to-be-killed SQL statement comprises: reading the killable business user table to obtain a to-be-killed SQL identifier; obtaining the operation information of the corresponding SQL statement according to the to-be-killed SQL identifier, wherein the operation information comprises the execution time and the text type of the to-be-killed SQL statement; The database attribute is an online analytical processing type database; According to the operation information, the to-be-killed SQL statement satisfying the killing rule is killed, comprising: determining whether the execution time of the to-be-killed SQL statement is greater than a first preset time and whether the mark of the text type is select; If the execution time of the to-be-killed SQL statement is greater than the first preset time and the mark of the text type is select, it is killed; If the execution time of the to-be-killed SQL statement is not greater than the first preset time or the text type is not marked as select, it is not killed.

6. A control device comprising a processor and a storage device, the storage device being adapted to store a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by the processor to execute the killing method in any one of claims 1 to 4.

7. A computer readable storage medium having stored therein a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by the processor to execute the killing method in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Database operation statement processing method and device, electronic equipment and medium

    CN112181948A

  • Method and device for identifying and analyzing slow query statements, and method and device for counting query statements

    CN113297249A