CN112835921B - Slow query processing method and device, electronic equipment and storage medium - Google Patents

Slow query processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112835921B
CN112835921B CN202110112927.4A CN202110112927A CN112835921B CN 112835921 B CN112835921 B CN 112835921B CN 202110112927 A CN202110112927 A CN 202110112927A CN 112835921 B CN112835921 B CN 112835921B
Authority
CN
China
Prior art keywords
information
slow query
slow
alarm
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110112927.4A
Other languages
Chinese (zh)
Other versions
CN112835921A (en
Inventor
苏璟文
刘凤华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110112927.4A priority Critical patent/CN112835921B/en
Publication of CN112835921A publication Critical patent/CN112835921A/en
Application granted granted Critical
Publication of CN112835921B publication Critical patent/CN112835921B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure relates to a slow query processing method, a slow query processing device, electronic equipment and a storage medium. The slow query processing method comprises the following steps: acquiring execution time information of each query statement in the query statement set; determining baseline time information according to the execution time information of each query statement; screening a slow query statement set from the query statement set according to the baseline time information, wherein the slow query statement set comprises a plurality of slow query statements; determining alarm priorities corresponding to the slow query sentences according to the execution time information corresponding to the slow query sentences; and carrying out alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences. According to the technical scheme provided by the disclosure, the baseline time information for screening the slow query sentences can be dynamically determined, excessive alarm concurrency quantity can be avoided, and the service performance of the database is improved.

Description

Slow query processing method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of data processing, and in particular relates to a slow query processing method, a slow query processing device, electronic equipment and a storage medium.
Background
In the current processing of slow query, a specified time is generally set, for example, 1 second, a database operation sentence with an execution time greater than 1 second is regarded as a slow query sentence, the database operation sentence can be a query sentence, for example, an SQL sentence, and an SQL (Structured Query Language ) sentence with an execution time greater than 1 second is regarded as a slow query sentence. In the related art, slow query sentences to be processed are manually selected from the slow query sentences, so that the slow query is not processed timely enough; in addition, if the number of the slow query sentences of the alarm is large, the concurrent data of the slow query processing is large, so that not only is the data processing pressure caused, but also the slow query sentences cannot be effectively and timely processed, and the service performance of the database is low.
Disclosure of Invention
The disclosure provides a slow query processing method, a slow query processing device, electronic equipment and a storage medium, so as to at least solve the problems of low slow query processing efficiency and poor effectiveness caused by fixed designated time in slow query in the related art. The technical scheme of the present disclosure is as follows:
According to a first aspect of an embodiment of the present disclosure, there is provided a slow query processing method, including:
acquiring execution time information of each query statement in the query statement set;
determining baseline time information according to the execution time information of each query statement;
screening a slow query statement set from the query statement set according to the baseline time information, wherein the slow query statement set comprises a plurality of slow query statements;
determining alarm priorities corresponding to the slow query sentences according to the execution time information corresponding to the slow query sentences;
and carrying out alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences.
In a possible implementation manner, before the step of determining the alarm priorities corresponding to the slow query sentences according to the execution time information corresponding to the slow query sentences, the method further includes:
acquiring execution times information corresponding to the plurality of slow query sentences;
the step of determining the alarm priority corresponding to the slow query sentences according to the execution time information corresponding to the slow query sentences comprises the following steps:
And determining alarm priorities corresponding to the slow query sentences according to the execution time information and the execution times information corresponding to the slow query sentences.
In one possible implementation manner, the step of determining the alarm priority corresponding to the plurality of slow query sentences according to the execution time information and the execution times information corresponding to the plurality of slow query sentences includes:
acquiring preset sequencing reference information, wherein the preset sequencing reference information comprises baseline sequencing information;
determining target baseline time information according to the execution time information corresponding to the slow query sentences;
determining target baseline frequency information according to the execution frequency information corresponding to the slow query sentences;
based on the baseline ranking information and the target baseline time information, mapping the execution time information corresponding to each slow query statement to the corresponding time ranking information in the preset ranking reference information;
mapping the execution times information corresponding to each slow query statement to the times sorting information corresponding to the preset sorting reference information based on the baseline sorting information and the target baseline times information;
determining the sorting results of the plurality of slow query sentences according to the time sorting information and the frequency sorting information;
And determining the alarm priority corresponding to the slow query sentences according to the sorting result.
In one possible implementation manner, the slow query processing method further includes:
receiving a priority configuration request of a terminal, wherein the priority configuration request comprises a preset number of alarm priorities and query statement number proportion information corresponding to each alarm priority;
and taking the preset number of alarm priorities and the query statement number duty ratio information corresponding to each alarm priority as preset priority information.
The step of determining the alarm priority corresponding to the slow query sentences according to the sorting result comprises the following steps:
and determining the alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sequencing result.
In one possible implementation manner, the step of determining the alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sorting result includes:
dividing the plurality of slow query sentences into the preset number of slow query sets according to the sequencing result and the query sentence number proportion information corresponding to each alarm priority;
And taking the alarm priority corresponding to each slow query set as the alarm priority of the slow query statement in each slow query set.
In one possible implementation manner, the step of determining the alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sorting result includes:
dividing the plurality of slow query sentences into two levels according to the sorting result and the baseline sorting information;
determining target duty ratio information of the number of slow query sentences in the two grades and the total number of the plurality of slow query sentences;
if the target duty ratio information is not matched with the query statement quantity duty ratio information, acquiring a target ordering result of the slow query statement in each level;
dividing the slow query sentences in each level into two levels according to the target sorting result of the slow query sentences in each level and the baseline sorting information;
if the target duty ratio information is matched with the query statement quantity duty ratio information, determining the alarm priority corresponding to each level;
and determining the alarm priority corresponding to each level as the alarm priority of the slow query statement in each level.
In one possible implementation manner, the slow query processing method further includes:
acquiring preset alarm priority information;
the step of performing alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences comprises the following steps:
screening query sentences to be alerted, which are matched with the preset alert priority information, from the plurality of slow query sentences according to the alert priorities corresponding to the plurality of slow query sentences;
and carrying out alarm processing on the query statement to be alarmed.
According to a second aspect of embodiments of the present disclosure, there is provided a slow query processing apparatus, comprising:
the execution time information acquisition module is configured to execute and acquire the execution time information of each query statement in the query statement set;
a baseline time information determining module configured to perform determining baseline time information according to the execution time information of each query statement;
a slow query screening module configured to perform screening a set of slow query statements from the set of query statements according to the baseline time information, the set of slow query statements comprising a plurality of slow query statements;
the alarm priority determining module is configured to execute the steps of determining alarm priorities corresponding to the slow query sentences according to the execution time information corresponding to the slow query sentences;
And the slow query processing module is configured to execute the alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences.
In one possible implementation, the slow query processing device further includes:
the execution times information acquisition module is configured to execute and acquire the execution times information corresponding to the slow query sentences;
the alarm priority determining module comprises:
and the alarm priority determining unit is configured to determine alarm priorities corresponding to the plurality of slow query sentences according to the execution time information and the execution times information corresponding to the plurality of slow query sentences.
In one possible implementation, the alarm priority determining unit includes:
a preset ranking reference information acquiring subunit configured to perform acquisition of preset ranking reference information, the preset ranking reference information including baseline ranking information;
a target baseline time information determining subunit configured to perform determining target baseline time information according to the execution time information corresponding to the plurality of slow query sentences;
a target baseline frequency information determining subunit configured to perform determining target baseline frequency information according to the execution frequency information corresponding to the plurality of slow query sentences;
A time ranking information sub-mapping subunit configured to perform mapping, based on the baseline ranking information and the target baseline time information, execution time information corresponding to each slow query statement to corresponding time ranking information in the preset ranking reference information;
a frequency ranking information mapping subunit configured to perform mapping, based on the baseline ranking information and the target baseline ranking information, the execution frequency information corresponding to each slow query statement to corresponding frequency ranking information in the preset ranking reference information;
a ranking result determining subunit configured to perform determining ranking results of the plurality of slow query sentences according to the time ranking information and the number of times ranking information;
and the alarm priority determining subunit is configured to determine the alarm priorities corresponding to the plurality of slow query sentences according to the sorting result.
In one possible implementation, the slow query processing device further includes:
the priority configuration request receiving module is configured to execute a priority configuration request of a receiving terminal, wherein the priority configuration request comprises a preset number of alarm priorities and query statement number proportion information corresponding to each alarm priority;
The preset priority information acquisition module is configured to perform taking the preset number of alarm priorities and the query statement number duty ratio information corresponding to each alarm priority as preset priority information.
The alarm priority determination subunit includes:
and the first alarm priority determining subunit is configured to determine alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sorting result.
In one possible implementation, the first alarm priority determining subunit includes:
a slow query set dividing subunit configured to perform dividing the plurality of slow query sentences into the preset number of slow query sets according to the sorting result and the query sentence number ratio information corresponding to each alarm priority;
and the second alarm priority determining subunit is configured to execute the alarm priority corresponding to each slow query set as the alarm priority of the slow query statement in each slow query set.
In one possible implementation, the first alarm priority determining subunit includes:
a first ranking sub-unit configured to perform ranking of the plurality of slow query sentences into two ranks according to the ranking result and the baseline ranking information;
A target duty ratio information determination subunit configured to perform determining target duty ratio information of the number of slow query sentences in the two ranks and the total number of the plurality of slow query sentences;
a target ranking result determining subunit configured to perform if the target duty ratio information does not match the query statement number duty ratio information, obtain a target ranking result of the slow query statement in each level;
a second ranking sub-unit configured to perform ranking of the slow query statements in each rank into two ranks according to the target ranking result of the slow query statements in each rank and the baseline ranking information;
a priority determining subunit corresponding to the level, configured to perform determining an alarm priority corresponding to each level if the target duty ratio information matches the query statement quantity duty ratio information;
and a third alarm priority determining subunit configured to determine the alarm priority corresponding to each level as the alarm priority of the slow query statement in each level.
In one possible implementation, the slow query processing device further includes:
the system comprises a preset alarm priority information acquisition module, a control module and a control module, wherein the preset alarm priority information acquisition module is configured to perform acquisition of preset alarm priority information;
The slow query processing module comprises:
the to-be-alerted query statement screening unit is configured to execute screening of to-be-alerted query statements matched with the preset alert priority information from the plurality of slow query statements according to the alert priorities corresponding to the plurality of slow query statements;
and the slow query processing unit is configured to execute the alarm processing on the query statement to be alarmed.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method of any of the first aspects above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the method of any one of the first aspects of embodiments of the present disclosure.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer instructions which, when executed by a processor, implement the method of any one of the first aspects of embodiments of the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
determining baseline time information according to the execution time information of each query statement; and according to the base line time information, a slow query set is screened out from the query statement set, according to the execution time information corresponding to a plurality of slow query statements, the alarm priority corresponding to a plurality of slow query statements is determined, and according to the alarm priority corresponding to a plurality of slow query statements, the alarm processing is carried out on a plurality of slow query statements, so that the base line time information for screening the slow query statements is dynamically determined, the requirements of each service line or each scene can be met, and the targeted alarm can be carried out according to the alarm priority, the excessive concurrent quantity of alarms is avoided, the data processing pressure is reduced, and further, the slow query statements with high priority can be effectively processed, so that the slow query processing can be more timely and effective, and the service performance of a database can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
FIG. 1 is a schematic diagram of an application environment, shown in accordance with an exemplary embodiment.
FIG. 2 is a flow chart illustrating a slow query processing method according to an exemplary embodiment.
FIG. 3 is a flow chart illustrating a slow query processing method according to an exemplary embodiment.
FIG. 4 is a flowchart illustrating a slow query processing method according to an exemplary embodiment.
FIG. 5 is a flowchart illustrating a method of determining alert priorities corresponding to a plurality of slow query sentences based on execution time information and execution times information corresponding to the plurality of slow query sentences, according to an exemplary embodiment.
FIG. 6 is a flowchart illustrating a method of determining alert priorities corresponding to a plurality of slow query sentences based on execution time information and execution times information corresponding to the plurality of slow query sentences, according to an exemplary embodiment.
FIG. 7 is a flowchart illustrating a method of determining alert priorities corresponding to a plurality of slow query statements based on preset priority information and ranking results, according to an exemplary embodiment.
FIG. 8 is a flowchart illustrating a method for determining alert priorities corresponding to a plurality of slow query statements based on preset priority information and a ranking result, according to an exemplary embodiment.
FIG. 9 is a block diagram of a slow query processing device, according to an example embodiment.
FIG. 10 is a block diagram of an electronic device for slow query processing, according to an example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an application environment according to an exemplary embodiment, and as shown in fig. 1, the application environment may include a server 01 and a terminal 02.
In an alternative embodiment, server 01 may be used to perform the slow query processing method. Specifically, the server 01 may be an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligence platforms, and the like.
In an alternative embodiment, the terminal 02 may be configured to set preset alert priority information by a user, send a priority configuration request to the server 01, and receive slow query alert information; the user may be referred to as a developer. Specifically, the terminal 02 may include, but is not limited to, a smart phone, a desktop computer, a tablet computer, a notebook computer, a smart speaker, a digital assistant, an augmented reality (augmented reality, AR)/Virtual Reality (VR) device, a smart wearable device, and other types of electronic devices. Alternatively, the operating system running on the electronic device may include, but is not limited to, an android system, an IOS system, linux, windows, and the like.
In addition, it should be noted that fig. 1 is only one application environment of the slow query processing method provided in the present disclosure.
In the embodiment of the present disclosure, the server 01 and the terminal 02 may be directly or indirectly connected through a wired or wireless communication method, which is not limited herein.
FIG. 2 is a flow chart illustrating a slow query processing method according to an exemplary embodiment. As shown in fig. 2, the following steps may be included.
In step S201, execution time information of each query term in the set of query terms is acquired.
In the embodiment of the specification, a full quantity of query sentences can be obtained from the query log as a query sentence set, and the execution times information and the execution time information of each query sentence in the query sentence set can be obtained from the query log. For example, when the number of executions in the execution number information of one query term is greater than 1, where each execution corresponds to one execution time, the execution time corresponding to any one execution may be selected as the execution time information of the one query term, which is not limited in the present disclosure. When the number of executions in the number of executions information of one query statement is 1, the execution time information of the one query statement acquired from the query log is taken as the execution time information of the one query statement. In one example, the query statement may be an SQL statement, which may include an SQL query statement, an SQL store statement, an SQL read statement, etc., which is not limiting to the disclosure. Accordingly, the query log may be an SQL log.
In one example, a full quantity of query terms may be obtained from a query log, and the full quantity of query terms may be preprocessed, such as deduplication, to obtain a preprocessed query term, where the preprocessed query term is used as a set of query terms. The execution time corresponding to each query statement in the query statement set can be obtained; thus, the average value of the execution time corresponding to each query statement can be used as the execution time information of each query statement. By taking the average value of the execution time corresponding to each query statement as the execution time information of each query statement, the execution time information of each query statement is more accurate.
In step S203, baseline time information is determined from the execution time information of each query statement.
In the embodiment of the present specification, the baseline time information may be determined according to the execution time information of each query statement. In one example, statistics of execution time information of each query statement, which may include a mean, a standard deviation, a sum of the mean and the standard deviation, etc., may be taken as baseline time information, which is not limited by the present disclosure.
In step S205, a slow query statement set, which may include a plurality of slow query statements, is selected from the query statement set based on the baseline time information.
In the embodiment of the specification, the determined baseline time information may be used as a slow query time threshold, so that a slow query statement set may be screened from the query statement set according to the baseline time information, for example, a query statement with execution time information greater than the baseline time information may be screened from the query statement set as a slow query statement, and the slow query statement may form the slow query statement set.
In step S207, the alert priorities corresponding to the plurality of slow query sentences are determined according to the execution time information corresponding to the plurality of slow query sentences.
In the embodiment of the present disclosure, the alert priorities corresponding to the multiple slow query sentences may be determined according to the execution time information corresponding to the multiple slow query sentences. The alert priority may characterize the runnability of the slow query statement, e.g., the longer the execution time information, the worse the runnability of the slow query statement, and the higher the corresponding alert priority, which is not limited by the present disclosure. In one example, the plurality of slow query sentences may be divided into a preset number of ranks according to the execution time information, for example, the plurality of slow query sentences may be ranked in an order of the execution time information from long to short, the plurality of slow query sentences may be divided into a preset number of ranks according to the ranked order, for example, the plurality of slow query sentences may be equally divided into the preset number of ranks, and thus the plurality of slow query sentences may be divided into the preset number of ranks. The above is merely an example of determining an alert priority and the present disclosure is not limited in this regard.
In step S209, the alarm processing is performed on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences.
In the embodiment of the present disclosure, the alert processing may be performed on a plurality of slow query sentences according to alert priorities corresponding to the plurality of slow query sentences. In one example, a slow query statement having an alarm priority above a priority threshold may be selected from a plurality of slow query statements, the slow query statement having an alarm priority above the priority threshold may be alarm processed, e.g., slow query alarm information may be sent to a terminal, which may be a terminal of a developer, e.g., a terminal of an SQL developer.
In another example, the multiple slow query sentences may be processed in batches according to the order of the alarm priorities. For example, the slow query statement with higher alarm priority may be subjected to alarm processing, and after the alarm of the slow query statement with higher alarm priority is ended, the slow query statement with lower alarm priority may be subjected to alarm processing, and so on until all the slow query statements are subjected to alarm processing.
Alternatively, for slow query statements that trigger alert processing, the program of the slow query statement may be modified to optimize the runnability of the slow query statement, such as to reduce the execution time of the slow query statement.
Determining baseline time information according to the execution time information of each query statement; and according to the base line time information, a slow query statement set is screened out from the query statement set, according to the execution time information corresponding to a plurality of slow query statements, the alarm priority corresponding to a plurality of slow query statements is determined, and according to the alarm priority corresponding to a plurality of slow query statements, the alarm processing is carried out on a plurality of slow query statements, so that the base line time information for screening the slow query statements is dynamically determined, the requirements of each service line or each scene can be met, and the targeted alarm can be carried out according to the alarm priority, the excessive concurrent quantity of alarms is avoided, the data processing pressure is reduced, and further the slow query statements with high priority can be effectively processed, so that the slow query processing can be more timely and effective, and the service performance of a database can be improved.
FIG. 3 is a flow chart illustrating a slow query processing method according to an exemplary embodiment. In one possible implementation, as shown in fig. 3, the slow query processing method may further include:
in step S301, preset alert priority information is acquired.
Accordingly, step S209 may include:
In step S303, according to the alarm priorities corresponding to the multiple slow query sentences, the query sentences to be alerted, which are matched with the preset alarm priority information, are screened out from the multiple slow query sentences;
in step S305, an alert process is performed on the query statement to be alert.
In the embodiment of the present specification, preset alarm priority information may be acquired, where the preset alarm priority information may be set by a user (developer); the preset alert priority information may refer to an alert priority that needs to trigger alert processing, and may include one or more of a preset number of alert priorities. For example, the alarm priorities may include a first priority, a second priority, and a third priority, and the preset alarm priority information may include the first priority and the second priority. The present disclosure is not limited in this regard. The execution time information corresponding to the first priority may be longer than the execution time information corresponding to the second priority and the third priority; the execution time information corresponding to the third priority is shorter than the execution time information corresponding to the second priority.
In the embodiment of the specification, according to the alarm priorities corresponding to the plurality of slow query sentences, query sentences to be alarmed, which are matched with preset alarm priority information, can be screened out from the plurality of slow query sentences; and can perform alarm processing on the query statement to be alarmed. For example, when the preset alert priority information includes the first priority and the second priority, a slow query statement having the priorities of the first priority and the second priority may be used as the query statement to be alert.
Optionally, the preset alarm priority information may be updated, for example, the setting and updating of the preset alarm priority information by the user may be implemented by receiving an update request from the user.
By acquiring the preset alarm priority information, flexible setting of the preset alarm priority information can be realized; and screening query sentences to be alerted, which are matched with the preset alert priority information, from the plurality of slow query sentences according to the priorities corresponding to the plurality of slow query sentences, wherein the query sentences to be alerted can be screened according to the preset alert priority information, thereby avoiding excessive number of concurrent alerts, reducing data processing pressure and ensuring that the query sentences to be alerted can be effectively processed in time.
FIG. 4 is a flowchart illustrating a slow query processing method according to an exemplary embodiment. In one possible implementation, as shown in fig. 4, before step S207, the slow query processing method may further include:
in step S401, execution times information corresponding to a plurality of slow query sentences is acquired;
accordingly, step S207 may include:
in step S403, the alert priorities corresponding to the plurality of slow query sentences are determined according to the execution time information and the execution times information corresponding to the plurality of slow query sentences.
In the embodiment of the present specification, a target weighted sum of the execution time information and the execution times information of the plurality of slow query sentences may be obtained. Therefore, the slow query sentences can be ranked according to the target weighted sum, and the slow query sentences can be divided into a preset number of alarm priorities according to the ranking. For example, the plurality of slow query sentences may be equally divided into query sentence sets according to the ranking, and the alert priorities corresponding to the query sentence subsets may be determined, so that the alert priorities corresponding to each query sentence subset may be used as the alert priorities corresponding to the slow query sentences in each query sentence set, which is not limited in this disclosure.
By introducing the execution times information into the determination of the alarm priority, the alarm priority corresponding to the slow query statement with higher execution times can be higher, namely the alarm processing with higher priority on the slow query statement with higher execution frequency can be realized, the slow query statement with higher execution frequency can be ensured to be processed in time, and the service performance of the database is improved.
FIG. 5 is a flowchart illustrating a method of determining alert priorities corresponding to a plurality of slow query sentences based on execution time information and execution times information corresponding to the plurality of slow query sentences, according to an exemplary embodiment. In one possible implementation, as shown in fig. 5, the step S403 may include:
In step S501, preset ranking reference information is acquired, which may include baseline ranking information.
In this embodiment of the present disclosure, the preset ranking reference information may refer to a numerical range information capable of characterizing the operation performance of the query statement, for example, a percentile numerical range, a 0-150 numerical range, a 0-1 numerical range, and a 0-infinity numerical range, which is not limited in this disclosure. The baseline ranking information may refer to ranking information that is qualified in the corresponding preset ranking reference information, for example, in the percentile value range, the baseline ranking information may refer to 60 points. It should be noted that, the baseline ranking information may also be preset, for example, the baseline ranking information is set to 60 to be divided into baseline ranking information of preset ranking reference information, and in this case, the baseline ranking information corresponding to each numerical range may be 60. The present disclosure is not limited in this regard.
In step S503, target baseline time information is determined according to the execution time information corresponding to the plurality of slow query sentences.
In the embodiment of the present disclosure, the target baseline time information may be determined according to the execution time information corresponding to the multiple slow query sentences. In one example, the mean of the execution time information corresponding to the plurality of slow query statements may be taken as the target baseline time information. In another example, the mean and standard deviation of the execution time information corresponding to the plurality of slow query sentences may be determined, so that the target baseline time information may be determined according to the mean and standard deviation, e.g., the sum of the mean and standard deviation may be taken as the target baseline time information. The present disclosure is not limited in this regard.
In step S505, target baseline number information is determined from the execution number information corresponding to the plurality of slow query sentences.
In the embodiment of the present disclosure, the target baseline frequency information may be determined according to the execution frequency information corresponding to the plurality of slow query sentences. In one example, the average of the execution times information corresponding to the plurality of slow query sentences may be taken as the target baseline times information. In another example, the mean and standard deviation of the execution times information corresponding to the plurality of slow query sentences may be determined, so that the target baseline times information may be determined according to the mean and standard deviation, for example, the sum of the mean and standard deviation may be taken as the target baseline times information. The present disclosure is not limited in this regard.
In step S507, based on the baseline ranking information and the target baseline time information, the execution time information corresponding to each slow query statement is mapped to the corresponding time ranking information in the preset ranking reference information.
In this embodiment of the present disclosure, the time ranking slope information of the preset ranking reference information may be obtained based on the baseline ranking information and the target baseline time information, for example, a quotient of the baseline ranking information and the target baseline time information may be used as the time ranking slope information, so that the time ranking information corresponding to each slow query statement in the preset ranking reference information may be obtained based on the time ranking slope information and the execution time information corresponding to each slow query statement. The time ordering information may represent duration information of execution time of the slow query statement, and the longer the execution time is, the worse the running performance of the slow query statement is, and the higher the time ordering information is.
In one example, the time ranking information corresponding to each slow query statement in the preset ranking reference information may be obtained according to the following formula (1).
Wherein t can be the execution time information corresponding to each slow query statement; y is Y Base limit Baseline ranking information may be used; p may be target baseline time information;slope information may be time ordered.
Note that, in this example, the preset sort reference information does not set a limit value.
In another example, the target upper limit time information and the target lower limit time information may be determined according to the following formula (2).
For example, Y Base limit Baseline ranking information may be used; p (P) Upper limit of Time information can be the upper limit of the target; p (P) Lower limit of The target lower limit time information can be; y is Y Upper limit of The information may be upper bound ordered; y is Y Lower limit of The information may be ordered for a lower bound. For example, when the preset ranking reference information is 0-100, Y Upper limit of May refer to 100; y is Y Lower limit of May refer to 0; p (P) Upper limit of Can be 100 pairs withThe execution time information; p (P) Lower limit of May refer to execution time information corresponding to 0.
In this example, the preset ranking reference information sets a limit value: y is Y Upper limit of And Y Lower limit of The execution time information corresponding to each slow query statement may be mapped to [ Y ] Lower limit of ,Y Upper limit of ]Within the range. For example, the execution time information (t) corresponding to each slow query statement may be mapped to the corresponding time ranking information F in the preset ranking reference information as in the following formula (3).
In step S509, the execution count information corresponding to each slow query statement is mapped to the count ranking information corresponding to the preset ranking reference information based on the baseline ranking information and the target baseline count information.
In the embodiment of the present disclosure, reference may be made to step S503, which is not described herein. The frequency ordering information may represent the influence degree information of the execution frequency of the slow query statement on the operation performance of the query statement, and the higher the execution frequency is, the higher the influence degree of the slow query statement on the operation performance is, and accordingly, the higher the frequency ordering information is.
In one example, the ranking information of the number of times corresponding to each slow query statement in the preset ranking reference information may be obtained according to the following formula (2).
C can be time information of times corresponding to each slow query statement; y is Y Base limit Baseline ranking information may be used; q may be target baseline number information; Slope information may be ordered for times.
In another example, when the preset ranking reference information sets the limit value, the execution count information corresponding to each slow query statement may be mapped to the count ranking information corresponding to the preset ranking reference information, referring to the above formulas (2) and (3). And will not be described in detail herein.
In step S5011, the ranking results of the plurality of slow query sentences are determined from the time ranking information and the number of times ranking information.
In the embodiment of the specification, the sum of the time ranking information and the frequency ranking information of each slow query statement can be used as the ranking score information of the slow query statement; and the plurality of slow query sentences can be sequenced according to the sequencing score information to obtain the sequencing order information of the slow query sentences. So that the ranking score information and the ranking order information can be used as ranking results.
In step S5013, according to the sorting result, alarm priorities corresponding to the plurality of slow query sentences are determined.
In the embodiment of the present disclosure, the alarm priorities corresponding to the multiple slow query sentences may be determined according to the sorting result. In one example, the plurality of slow query terms may be divided into subsets of query terms based on ranking order information in the ranking results, and alert priorities may be set for each subset of query terms. Alternatively, alert priorities corresponding to the plurality of slow query sentences may be determined based on the ranking score information and the score range threshold information in the ranking results. Wherein the score range threshold information may include at least two score range thresholds, each of which may correspond to an alert priority. The present disclosure is not limited in this regard.
Alternatively, the ranking result may be sent to the terminal to display the ranking result. Further, the user may set the alarm priorities corresponding to the plurality of slow query sentences according to the sorting result, and may send the set alarm priorities corresponding to the plurality of slow query sentences to the server, and the server may trigger alarm processing based on the alarm priorities.
By mapping the execution time information and the execution times information into unified preset sequencing reference information, unified time sequencing information and frequency sequencing information are obtained, so that a sequencing result is determined according to the unified time sequencing information and the frequency sequencing information, an alarm priority is determined, and the rationality and the accuracy of the sequencing result and the alarm priority are improved.
FIG. 6 is a flowchart illustrating a method of determining alert priorities corresponding to a plurality of slow query statements based on execution time information and execution times information corresponding to the plurality of slow query statements, according to an exemplary embodiment. In one possible implementation, as shown in fig. 6, the slow query processing method may further include:
in step S601, a priority configuration request of a terminal is received, where the priority configuration request includes a preset number of alarm priorities and query statement number ratio information corresponding to each alarm priority;
In step S603, the preset number of alarm priorities and the number of query statement duty ratio information corresponding to each alarm priority are used as preset priority information.
In the embodiment of the present specification, a priority configuration request sent by a terminal may be received, where the priority configuration request may be triggered by a user. For example, the user may set alert priority information on the terminal to trigger the terminal to send a priority configuration request. The alarm priorities with preset quantity and the query statement quantity duty ratio information corresponding to each priority can be extracted from the priority configuration request; and the preset number of priorities and the number of query sentences corresponding to each priority can be used as preset priority information for determining the alarm priorities corresponding to a plurality of slow query sentences.
Accordingly, step S5013 may include:
in step S605, according to the preset priority information and the sorting result, the alarm priorities corresponding to the plurality of slow query sentences are determined.
In the embodiment of the specification, the alarm priorities corresponding to the plurality of slow query sentences can be determined according to the preset priority information and the sequencing result, which is not limited in the disclosure, and the plurality of slow query sentences can be divided into the query sentence subsets with the preset number, so long as the proportion of the slow query sentences in the query sentence set to the total number of the plurality of slow query sentences is consistent with the query sentence number proportion information corresponding to the alarm priorities.
By receiving the priority configuration request of the terminal to determine the preset priority information, the user can set the alarm priority, the user participation degree is improved, the user can set the preset priority information according to the actual demand so as to adapt to the dynamic adjustment of the alarm priority, and the effectiveness of the slow query processing is improved.
FIG. 7 is a flowchart illustrating a method of determining alert priorities corresponding to a plurality of slow query statements based on preset priority information and ranking results, according to an exemplary embodiment. As shown in fig. 7, in one possible implementation, when the preset priority information includes a preset number of alarm priorities and the number of query sentences corresponding to each alarm priority is the ratio information, the step S605 may include:
in step S701, according to the sorting result and the number of query sentences corresponding to each alarm priority, the plurality of slow query sentences are divided into a preset number of slow query sets.
In this embodiment of the present disclosure, according to the number of query sentences corresponding to each alarm priority, slow query sentences matching the number of query sentences with the number of query sentences corresponding to each alarm priority may be extracted from a plurality of slow query sentences in sequence according to the ordering order information in the ordering result, so as to divide the plurality of slow query sentences into a preset number of slow query sets. The slow query set corresponds to an alert priority. For example, the preset alarm priorities may include 3 alarm priorities, where the number of query sentences corresponding to each alarm priority is 30%, 40% and 30% respectively. If the number of the slow query sentences is 100, the slow query sentences corresponding to 30%, 40% and 30% of the slow query sentences can be sequentially extracted according to the sorting results of the 100 slow query sentences, so that the 100 slow query sentences are divided into 3 slow query sets, and the 3 slow query sets correspond to the 3 alarm priorities.
In step S703, the alarm priority corresponding to each slow query set is used as the alarm priority of the slow query statement in each slow query set.
In the embodiment of the present disclosure, the alarm priority corresponding to each slow query set may be used as the alarm priority of the slow query statement in each slow query set.
By setting the preset number of alarm priorities and the number of query sentences corresponding to each alarm priority as well as the ratio information of the number of query sentences corresponding to each alarm priority, the priorities of a plurality of slow query sentences can be flexibly divided, and the flexibility of alarm processing can be improved.
FIG. 8 is a flowchart illustrating a method for determining alert priorities corresponding to a plurality of slow query statements based on preset priority information and a ranking result, according to an exemplary embodiment. As shown in fig. 8, in one possible implementation, the step S605 may include:
in step S801, a plurality of slow query sentences are classified into two ranks according to the ranking result and the baseline ranking information.
In the embodiment of the specification, slow query sentences with ranking score information of the ranking results being greater than the baseline ranking information may be divided into a first level; and classifying slow query sentences with the ranking score information of the ranking results smaller than or equal to the baseline ranking information into a second grade. I.e., a two-level classification of the plurality of slow query statements based on the baseline ranking information.
In step S803, target duty ratio information of the number of slow query sentences in the two ranks and the total number of the plurality of slow query sentences is determined.
In the embodiment of the present specification, the target duty ratio information of the number of slow query sentences in the two ranks and the total number of the plurality of slow query sentences may be determined. For example, the number of the slow query sentences is 100, the number of the slow query sentences in the first level is 40, the number of the slow query sentences in the second level is 60, and the target ratio information of the number of the slow query sentences in the first level to the total number of the plurality of the slow query sentences can be determined to be 40%; the target duty cycle information for the number of slow query terms in the second level to the total number of the plurality of slow query terms may be determined to be 60%.
In step S805, if the target duty ratio information does not match the number of query sentences, a target ranking result of the slow query sentences in each rank is obtained.
In the embodiment of the present specification, the fact that the target duty ratio information is not matched with the number of query sentences and the query sentence number duty ratio information may mean that the result of the single and combined target duty ratio information is different from the number of query sentences and the query sentence number duty ratio information. For example, the target duty cycle information includes 40%, 60%; the query statement number ratio information comprises 30%, 30% and 40%, and the individual target ratio information (40%, 60%) is different from 30%, 30% and 40%; the result of the merging of the target duty cycle information is also different from 30%, 30% and 40% in 40% +60% = 100%, the target duty cycle information may be considered to be mismatched with the query statement count duty cycle information. In this case, a target ranking result corresponding to each slow query statement in each rank may be obtained. The specific reference may be made to steps S501 to S507, which are not described herein.
In step S807, the slow query statement in each rank is divided into two ranks according to the target ranking result and the baseline ranking information of the slow query statement in each rank.
In the embodiment of the specification, according to the target ranking result and the baseline ranking information of the slow query statement in each level, the two levels of each level are continuously divided, and the slow query statement in each level is divided into two levels until the target duty ratio information in the divided levels meets the quantity duty ratio information.
In step S809, if the target duty ratio information matches the query statement number duty ratio information, determining an alarm priority corresponding to each level;
in step S8011, the alarm priority corresponding to each level is determined as the alarm priority of the slow query statement in each level.
In the embodiment of the present disclosure, matching the target duty ratio information with the number of query terms may mean that the result of the matching of the target duty ratio information alone or in combination is the same as the number of query terms. For example, the target duty ratio information of each of the two divided ranks includes 30%, 10%, 20%, 40%; the number of query terms includes 30%, 30% and 40%, and the result of merging the target terms is 30%, 10% +20% = 30%, 40% is the same as 30%, 30% and 40%, and the target terms can be considered to match the number of query terms.
When the target duty ratio information is matched with the query statement number duty ratio information, the alarm priority corresponding to each level may be determined, for example, the alarm priority corresponding to each level may be determined according to the result of merging the target duty ratio information. The target duty ratio information of the four levels after the above-mentioned two levels division includes: for example, the first level 30%, the second level 10%, the third level 20%, and the fourth level 40%, the number of query sentences corresponding to each alarm priority may include: the first alarm priority 30%, the second alarm priority 30% and the third alarm priority 40%; the result of the target duty ratio information merging is 30%, 10% +20% =30%, 40%, and the result of the merging matches the query statement number duty ratio information. Thus, it can be determined that the first level corresponds to the first alarm priority, the second level and the third level correspond to the second alarm priority, and the fourth level corresponds to the third alarm priority. So that the alarm priority corresponding to each level can be determined as the alarm priority of the slow query statement in each level.
By performing two levels of branching on the multiple slow query sentences, the accuracy of the alarm priority can be improved.
FIG. 9 is a block diagram of a slow query processing device, according to an example embodiment. Referring to fig. 9, the apparatus may include:
an execution time information acquisition module 901 configured to execute acquisition of execution time information of each query sentence in the set of query sentences;
a baseline time information determining module 903 configured to perform determining baseline time information from the execution time information of each query term;
a slow query screening module 905 configured to perform screening a slow query statement set from the query statement set according to the baseline time information, the slow query statement set including a plurality of slow query statements;
an alarm priority determining module 907 configured to perform determining alarm priorities corresponding to the plurality of slow query sentences according to the execution time information corresponding to the plurality of slow query sentences;
the slow query processing module 909 is configured to perform alarm processing on the plurality of slow query sentences according to alarm priorities corresponding to the plurality of slow query sentences.
Determining baseline time information according to the execution time information of each query statement; and according to the base line time information, a slow query statement set is screened out from the query statement set, according to the execution time information corresponding to a plurality of slow query statements, the alarm priority corresponding to a plurality of slow query statements is determined, and according to the alarm priority corresponding to a plurality of slow query statements, the alarm processing is carried out on a plurality of slow query statements, so that the base line time information for screening the slow query statements is dynamically determined, the requirements of each service line or each scene can be met, and the targeted alarm can be carried out according to the alarm priority, the excessive concurrent quantity of alarms is avoided, the data processing pressure is reduced, and further the slow query statements with high priority can be effectively processed, so that the slow query processing can be more timely and effective, and the service performance of a database can be improved.
In one possible implementation, the slow query processing apparatus may further include:
the execution times information acquisition module is configured to execute and acquire execution times information corresponding to the plurality of slow query sentences;
the alarm priority determination module 907 may include:
and the alarm priority determining unit is configured to determine the alarm priorities corresponding to the slow query sentences according to the execution time information and the execution times information corresponding to the slow query sentences.
In one possible implementation, the alarm priority determining unit may include:
a preset ranking reference information acquiring subunit configured to perform acquisition of preset ranking reference information, the preset ranking reference information including baseline ranking information;
a target baseline time information determining subunit configured to perform determining target baseline time information according to the execution time information corresponding to the plurality of slow query sentences;
a target baseline number information determining subunit configured to perform determining target baseline number information according to the execution number information corresponding to the plurality of slow query sentences;
a time ranking information sub-mapping subunit configured to perform mapping, based on the baseline ranking information and the target baseline time information, the execution time information corresponding to each slow query statement to corresponding time ranking information in the preset ranking reference information;
The frequency ranking information mapping subunit is configured to perform mapping of the execution frequency information corresponding to each slow query statement to the frequency ranking information corresponding to the preset ranking reference information based on the baseline ranking information and the target baseline frequency information;
a ranking result determining subunit configured to perform determining ranking results of the plurality of slow query sentences according to the time ranking information and the number of times ranking information;
and the alarm priority determining subunit is configured to determine the alarm priorities corresponding to the plurality of slow query sentences according to the sorting result.
In one possible implementation, the slow query processing apparatus may further include:
the priority configuration request receiving module is configured to execute a priority configuration request of the receiving terminal, wherein the priority configuration request comprises a preset number of alarm priorities and query statement number proportion information corresponding to each alarm priority;
the preset priority information acquisition module is configured to execute the preset number of alarm priorities and the corresponding query statement number duty ratio information of each alarm priority as preset priority information.
The alarm priority determination subunit may include:
the first alarm priority determining subunit is configured to determine alarm priorities corresponding to the plurality of slow query sentences according to preset priority information and the sequencing result.
In one possible implementation, the first alert priority determining subunit may include:
the slow query set dividing subunit is configured to execute the steps of dividing a plurality of slow query sentences into a preset number of slow query sets according to the sorting result and the number of query sentences corresponding to each alarm priority;
and the second alarm priority determining subunit is configured to execute the alarm priority corresponding to each slow query set as the alarm priority of the slow query statement in each slow query set.
In one possible implementation, the first alert priority determining subunit may include:
a first ranking sub-unit configured to perform ranking of the plurality of slow query sentences into two ranks according to the ranking result and the baseline ranking information;
a target duty ratio information determination subunit configured to perform determining target duty ratio information of the number of slow query sentences in the two ranks and the total number of the plurality of slow query sentences;
a target ranking result determining subunit configured to perform if the target duty ratio information does not match the query statement number duty ratio information, obtain a target ranking result of the slow query statement in each level;
A second ranking sub-unit configured to perform ranking of the slow query sentences in each rank into two ranks according to the target ranking result and the baseline ranking information of the slow query sentences in each rank;
the priority determining subunit corresponding to the level is configured to execute the step of determining the alarm priority corresponding to each level if the target duty ratio information is matched with the query statement quantity duty ratio information;
and a third alarm priority determining subunit configured to determine the alarm priority corresponding to each level as the alarm priority of the slow query statement in each level.
In one possible implementation, the slow query processing apparatus may further include:
the system comprises a preset alarm priority information acquisition module, a control module and a control module, wherein the preset alarm priority information acquisition module is configured to perform acquisition of preset alarm priority information;
the slow query processing module comprises:
the to-be-alerted query statement screening unit is configured to execute screening of to-be-alerted query statements matched with preset alert priority information from the plurality of slow query statements according to alert priorities corresponding to the plurality of slow query statements;
and the slow query processing unit is configured to execute the alarm processing on the query statement to be alarmed.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 10 is a block diagram of an electronic device for slow query processing, which may be a server, whose internal structure may be as shown in fig. 10, according to an exemplary embodiment. The electronic device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic device includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the electronic device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a slow query processing method.
It will be appreciated by those skilled in the art that the structure shown in fig. 10 is merely a block diagram of a portion of the structure associated with the disclosed aspects and is not limiting of the electronic device to which the disclosed aspects apply, and that a particular electronic device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an exemplary embodiment, there is also provided an electronic device including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement a slow query processing method as in an embodiment of the present disclosure.
In an exemplary embodiment, a storage medium is also provided, which when executed by a processor of an electronic device, enables the electronic device to perform the slow query processing method in the embodiments of the present disclosure.
In an exemplary embodiment, a computer program product containing instructions that, when run on a computer, cause the computer to perform the method of slow query processing in embodiments of the present disclosure is also provided.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (12)

1. A slow query processing method, comprising:
acquiring execution time information of each query statement in the query statement set;
determining baseline time information according to the execution time information of each query statement;
screening a slow query statement set from the query statement set according to the baseline time information, wherein the slow query statement set comprises a plurality of slow query statements;
Acquiring execution times information corresponding to the plurality of slow query sentences;
acquiring preset sequencing reference information, wherein the preset sequencing reference information comprises baseline sequencing information;
determining target baseline time information according to the execution time information corresponding to the slow query sentences;
determining target baseline frequency information according to the execution frequency information corresponding to the slow query sentences;
based on the baseline ranking information and the target baseline time information, mapping the execution time information corresponding to each slow query statement to the corresponding time ranking information in the preset ranking reference information;
mapping the execution times information corresponding to each slow query statement to the times sorting information corresponding to the preset sorting reference information based on the baseline sorting information and the target baseline times information;
determining the sorting results of the plurality of slow query sentences according to the time sorting information and the frequency sorting information;
determining alarm priorities corresponding to the plurality of slow query sentences according to the sorting result;
and carrying out alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences.
2. The slow query processing method of claim 1, wherein the slow query processing method further comprises:
receiving a priority configuration request of a terminal, wherein the priority configuration request comprises a preset number of alarm priorities and query statement number proportion information corresponding to each alarm priority;
taking the preset number of alarm priorities and the query statement number duty ratio information corresponding to each alarm priority as preset priority information;
the step of determining the alarm priority corresponding to the slow query sentences according to the sorting result comprises the following steps:
and determining the alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sequencing result.
3. The method according to claim 2, wherein the step of determining the alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sorting result comprises:
dividing the plurality of slow query sentences into the preset number of slow query sets according to the sequencing result and the query sentence number proportion information corresponding to each alarm priority;
and taking the alarm priority corresponding to each slow query set as the alarm priority of the slow query statement in each slow query set.
4. The method according to claim 2, wherein the step of determining the alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sorting result comprises:
dividing the plurality of slow query sentences into two levels according to the sorting result and the baseline sorting information;
determining target duty ratio information of the number of slow query sentences in the two grades and the total number of the plurality of slow query sentences;
if the target duty ratio information is not matched with the query statement quantity duty ratio information, acquiring a target ordering result of the slow query statement in each level;
dividing the slow query sentences in each level into two levels according to the target sorting result of the slow query sentences in each level and the baseline sorting information;
if the target duty ratio information is matched with the query statement quantity duty ratio information, determining the alarm priority corresponding to each level;
and determining the alarm priority corresponding to each level as the alarm priority of the slow query statement in each level.
5. The slow query processing method of claim 1, wherein the slow query processing method further comprises:
Acquiring preset alarm priority information;
the step of performing alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences comprises the following steps:
screening query sentences to be alerted, which are matched with the preset alert priority information, from the plurality of slow query sentences according to the alert priorities corresponding to the plurality of slow query sentences;
and carrying out alarm processing on the query statement to be alarmed.
6. A slow query processing device, comprising:
the execution time information acquisition module is configured to execute and acquire the execution time information of each query statement in the query statement set;
a baseline time information determining module configured to perform determining baseline time information according to the execution time information of each query statement;
a slow query screening module configured to perform screening a set of slow query statements from the set of query statements according to the baseline time information, the set of slow query statements comprising a plurality of slow query statements;
the alarm priority determining module is configured to execute the steps of determining alarm priorities corresponding to the slow query sentences according to the execution time information corresponding to the slow query sentences;
The slow query processing module is configured to execute alarm processing on the plurality of slow query sentences according to the alarm priorities corresponding to the plurality of slow query sentences;
wherein the slow query processing device further comprises: the execution times information acquisition module is configured to execute and acquire the execution times information corresponding to the slow query sentences;
accordingly, the alarm priority determining module includes: an alarm priority determining unit configured to determine alarm priorities corresponding to the plurality of slow query sentences according to the execution time information and the execution times information corresponding to the plurality of slow query sentences;
wherein the alarm priority determining unit includes:
a preset ranking reference information acquiring subunit configured to perform acquisition of preset ranking reference information, the preset ranking reference information including baseline ranking information;
a target baseline time information determining subunit configured to perform determining target baseline time information according to the execution time information corresponding to the plurality of slow query sentences;
a target baseline frequency information determining subunit configured to perform determining target baseline frequency information according to the execution frequency information corresponding to the plurality of slow query sentences;
A time ranking information sub-mapping subunit configured to perform mapping, based on the baseline ranking information and the target baseline time information, execution time information corresponding to each slow query statement to corresponding time ranking information in the preset ranking reference information;
a frequency ranking information mapping subunit configured to perform mapping, based on the baseline ranking information and the target baseline ranking information, the execution frequency information corresponding to each slow query statement to corresponding frequency ranking information in the preset ranking reference information;
a ranking result determining subunit configured to perform determining ranking results of the plurality of slow query sentences according to the time ranking information and the number of times ranking information;
and the alarm priority determining subunit is configured to determine the alarm priorities corresponding to the plurality of slow query sentences according to the sorting result.
7. The slow query processing device of claim 6, wherein the slow query processing device further comprises:
the priority configuration request receiving module is configured to execute a priority configuration request of a receiving terminal, wherein the priority configuration request comprises a preset number of alarm priorities and query statement number proportion information corresponding to each alarm priority;
The preset priority information acquisition module is configured to execute the preset number of alarm priorities and the query statement number duty ratio information corresponding to each alarm priority as preset priority information;
the alarm priority determination subunit includes:
and the first alarm priority determining subunit is configured to determine alarm priorities corresponding to the plurality of slow query sentences according to the preset priority information and the sorting result.
8. The slow query processing apparatus of claim 7, wherein the first alert priority determination subunit comprises:
a slow query set dividing subunit configured to perform dividing the plurality of slow query sentences into the preset number of slow query sets according to the sorting result and the query sentence number ratio information corresponding to each alarm priority;
and the second alarm priority determining subunit is configured to execute the alarm priority corresponding to each slow query set as the alarm priority of the slow query statement in each slow query set.
9. The slow query processing apparatus of claim 7, wherein the first alert priority determination subunit comprises:
A first ranking sub-unit configured to perform ranking of the plurality of slow query sentences into two ranks according to the ranking result and the baseline ranking information;
a target duty ratio information determination subunit configured to perform determining target duty ratio information of the number of slow query sentences in the two ranks and the total number of the plurality of slow query sentences;
a target ranking result determining subunit configured to perform if the target duty ratio information does not match the query statement number duty ratio information, obtain a target ranking result of the slow query statement in each level;
a second ranking sub-unit configured to perform ranking of the slow query statements in each rank into two ranks according to the target ranking result of the slow query statements in each rank and the baseline ranking information;
a priority determining subunit corresponding to the level, configured to perform determining an alarm priority corresponding to each level if the target duty ratio information matches the query statement quantity duty ratio information;
and a third alarm priority determining subunit configured to determine the alarm priority corresponding to each level as the alarm priority of the slow query statement in each level.
10. The slow query processing device of claim 6, wherein the slow query processing device further comprises: the system comprises a preset alarm priority information acquisition module, a control module and a control module, wherein the preset alarm priority information acquisition module is configured to perform acquisition of preset alarm priority information;
the slow query processing module comprises:
the to-be-alerted query statement screening unit is configured to execute screening of to-be-alerted query statements matched with the preset alert priority information from the plurality of slow query statements according to the alert priorities corresponding to the plurality of slow query statements;
and the slow query processing unit is configured to execute the alarm processing on the query statement to be alarmed.
11. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the slow query processing method of any one of claims 1 to 5.
12. A storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the slow query processing method of any one of claims 1 to 5.
CN202110112927.4A 2021-01-27 2021-01-27 Slow query processing method and device, electronic equipment and storage medium Active CN112835921B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110112927.4A CN112835921B (en) 2021-01-27 2021-01-27 Slow query processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110112927.4A CN112835921B (en) 2021-01-27 2021-01-27 Slow query processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112835921A CN112835921A (en) 2021-05-25
CN112835921B true CN112835921B (en) 2024-03-19

Family

ID=75932009

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110112927.4A Active CN112835921B (en) 2021-01-27 2021-01-27 Slow query processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112835921B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360357B (en) * 2021-06-01 2023-05-09 深圳前海微众银行股份有限公司 Data monitoring method, system and equipment
CN114327268A (en) * 2021-12-27 2022-04-12 北京云思智学科技有限公司 Self-adaptive protection method and device applied to KV storage and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105281981A (en) * 2015-11-04 2016-01-27 北京百度网讯科技有限公司 Data traffic monitoring method and device for network service
CN109871392A (en) * 2019-02-18 2019-06-11 浪潮软件集团有限公司 A kind of slow sql real-time data acquisition method under distribution application system
CN111352818A (en) * 2020-02-28 2020-06-30 北京思特奇信息技术股份有限公司 Application program performance analysis method and device, storage medium and electronic equipment
CN111352921A (en) * 2020-02-19 2020-06-30 中国平安人寿保险股份有限公司 ELK-based slow query monitoring method and device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11182434B2 (en) * 2017-11-15 2021-11-23 Sumo Logic, Inc. Cardinality of time series

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105281981A (en) * 2015-11-04 2016-01-27 北京百度网讯科技有限公司 Data traffic monitoring method and device for network service
CN109871392A (en) * 2019-02-18 2019-06-11 浪潮软件集团有限公司 A kind of slow sql real-time data acquisition method under distribution application system
CN111352921A (en) * 2020-02-19 2020-06-30 中国平安人寿保险股份有限公司 ELK-based slow query monitoring method and device, computer equipment and storage medium
CN111352818A (en) * 2020-02-28 2020-06-30 北京思特奇信息技术股份有限公司 Application program performance analysis method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN112835921A (en) 2021-05-25

Similar Documents

Publication Publication Date Title
CN112800095B (en) Data processing method, device, equipment and storage medium
CN112835921B (en) Slow query processing method and device, electronic equipment and storage medium
TWI677828B (en) Business customization device, method, and computer readable storage media based on data source
CN109063108B (en) Search ranking method and device, computer equipment and storage medium
JP2013504118A (en) Information retrieval based on query semantic patterns
CN107798135B (en) Paging query method and device and electronic equipment
CN110555164B (en) Method, device, computer equipment and storage medium for generating group interest labels
CN113220657B (en) Data processing method and device and computer equipment
CN109684093B (en) Data processing method and system
CN112104505A (en) Application recommendation method and device, server and computer-readable storage medium
CN114995791A (en) API (application program interface) polymerization method and device, electronic equipment and storage medium
CN112364251B (en) Data recommendation method and device, electronic equipment and storage medium
CN111339210A (en) Data clustering method and device
CN114036048A (en) Case activity detection method, device, equipment and storage medium
CN114461822A (en) Resource processing method, device, equipment and storage medium
CN114648010A (en) Data table standardization method, device, equipment and computer storage medium
CN110874370B (en) Data query method and device, computer equipment and readable storage medium
CN113343024A (en) Object recommendation method and device, electronic equipment and storage medium
CN113778996A (en) Large data stream data processing method and device, electronic equipment and storage medium
CN115794806A (en) Gridding processing system, method and device for financial data and computing equipment
CN113886419A (en) SQL statement processing method and device, computer equipment and storage medium
CN111339133B (en) Data segmentation method and device, computer equipment and storage medium
CN112039992B (en) Model management method and system based on cloud computing architecture
CN111079435B (en) Named entity disambiguation method, device, equipment and storage medium
CN111259209B (en) User intention prediction method based on artificial intelligence, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant