A database operation and maintenance method based on query statement analysis

By evaluating the number and types of database query statements and combining the ADPSO-LSTM algorithm, core and problematic statements are selected, and the database operation and maintenance analysis process is optimized. This solves the problem of insufficient analysis in existing technologies and improves the efficiency and accuracy of database operation and maintenance.

CN116627949BActive Publication Date: 2025-12-23HANGYIN CONSUMER FINANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310704937.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-14
Publication Date
2025-12-23
Estimated Expiration
2043-06-14

AI Technical Summary

Technical Problem

Existing technologies fail to effectively analyze the complexity of database query statements, resulting in inaccurate and incomplete database operation and maintenance analysis results when there are few or few types of query statements.

Method used

By evaluating the number and types of database query statements, the complexity of the analysis is determined, and a decision is made on whether to conduct a comprehensive analysis based on the complexity. Core statements and problematic statements are filtered in combination with business type, execution time and number of times. The ADPSO-LSTM algorithm is used to assess the operational risks and optimize the analysis process.

Benefits of technology

It enables more comprehensive analysis under low complexity, improves the efficiency and accuracy of database operation and maintenance, reduces security risks, and ensures the stability and comprehensiveness of database operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116627949B_ABST
    Figure CN116627949B_ABST
Patent Text Reader

Abstract

The application provides a database operation and maintenance method based on query statement analysis, and belongs to the technical field of data processing, and specifically comprises the following steps: when it is determined that comprehensive analysis is not needed based on the complexity of database query statement analysis, obtaining basic operation risks of the database based on analysis results of core statements and problem statements; when it is determined that further screening is needed based on the complexity of the analysis of the core statements and the problem statements and the basic operation risks, obtaining important statements based on business types, execution times and execution frequencies corresponding to the database query statements, determining operation risks of the database based on analysis results of the problem statements, the core statements and the important statements, and determining that comprehensive analysis is needed based on the operation risks; and performing analysis based on all database query statements to obtain analysis results of all statements, and outputting the analysis results of all statements, so that the efficiency and comprehensiveness of database operation and maintenance are further improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of data processing, and particularly relates to a database operation and maintenance method based on query statement analysis. BACKGROUND

[0002] In order to realize the operation and maintenance of the database, in the invention patent publication number CN111913937A "database operation and maintenance method and device", a plurality of database query statements are obtained, and the database query statements that meet the parameter threshold, are not queried in the blacklist, and are not queried in the historical information library are analyzed, thereby improving the efficiency of database operation and maintenance. However, the prior art does not consider analyzing the complexity of the database query statement first. When the database query statement is less, or although the database query statement is more, but the type of the database query statement is less, and the analysis complexity is less, if all the database query statements cannot be analyzed, it may lead to that the database operation and maintenance analysis result is not accurate and comprehensive enough.

[0003] In view of the above technical problems, the present application provides a database operation and maintenance method based on query statement analysis. SUMMARY

[0004] In order to achieve the purpose of the present application, the present application adopts the following technical solutions:

[0005] According to one aspect of the present application, a database operation and maintenance method based on query statement analysis is provided.

[0006] A database operation and maintenance method based on query statement analysis, characterized in that, specifically comprising:

[0007] S11 at least based on the number and type of the database query statement, the complexity of the analysis of the database query statement is evaluated, and whether comprehensive analysis is needed is determined based on the complexity, if yes, step S15 is entered, if not, step S12 is entered;

[0008] S12 based on the business type corresponding to the database query statement, the core statement is obtained, and based on the execution time of the database query statement, the problem statement is determined, and based on the analysis result of the problem statement and the core statement, the basic operation risk of the database is obtained, based on the complexity of the analysis of the core statement and the problem statement, and the basic operation risk, whether re-screening is needed is determined, if yes, step S13 is entered, if not, the analysis result of the problem statement and the core statement and the basic operation risk are outputted;

[0009] S13 obtains important statements based on the business type, execution time and execution times corresponding to the database query statement, and determines the operation risk of the database based on the analysis results of the problem statement, the core statement and the important statement, and determines whether comprehensive analysis is needed based on the operation risk, if yes, goes to step S14, if no, outputs the analysis results of the problem statement, the core statement and the important statement and the operation risk;

[0010] S14 performs analysis based on all the database query statements to obtain analysis results of all the statements, and outputs the analysis results of all the statements.

[0011] By first evaluating the complexity of the analysis of the database query statement based on at least the number and type of the database query statement, and determining whether comprehensive analysis is needed based on the complexity, it is realized that the database with lower complexity of statement analysis can be analyzed more comprehensively, and the analysis efficiency is ensured for the database with higher complexity, thereby ensuring the stability and comprehensiveness of the database operation analysis.

[0012] By obtaining the basic operation risk of the database based on the analysis results of the problem statement and the core statement, and determining whether further screening is needed based on the complexity of the analysis of the core statement and the problem statement and the basic operation risk, it is realized that whether further analysis is needed is determined based on the analysis results of the problem statement and the core statement and the complexity of the analysis, which ensures the analysis efficiency and avoids the security risks caused by insufficient analysis due to high operation risk of the database.

[0013] By determining the operation risk of the database based on the analysis results of the problem statement, the core statement and the important statement, and determining whether comprehensive analysis is needed based on the operation risk, the comprehensiveness of the analysis is further improved, and the operation risk of the database can be determined more comprehensively and intuitively, thereby reducing the operation risks of the database on the basis of ensuring the analysis efficiency.

[0014] On the other hand, the embodiment of the application provides a computer system, comprising a memory and a processor connected in communication, and a computer program stored on the memory and capable of running on the processor, characterized in that the processor executes the computer program to perform the database operation and maintenance method based on query statement analysis.

[0015] On the other hand, the application provides a computer storage medium having a computer program stored thereon, which causes a computer to execute the database operation and maintenance method based on query statement analysis when the computer program is executed in the computer.

[0016] Other features and advantages will be set forth in the description that follows, and in part will be apparent from the description, or can be learned by practice of the application. The purposes and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

[0017] To make the above objectives, features and advantages of the present application more clear and comprehensible, the following preferred embodiments are specifically described with reference to the attached drawings.

[0018] Other features and advantages will be set forth in the description that follows, and in part will be apparent from the description, or can be learned by practice of the application. The purposes and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

[0019] To make the above objectives, features and advantages of the present application more clear and comprehensible, the following preferred embodiments are specifically described with reference to the attached drawings. BRIEF DESCRIPTION OF DRAWINGS

[0020] The above and other features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings:

[0021] Figure 1 is a flow chart of a database operation and maintenance method based on query statement analysis according to embodiment 1;

[0022] Figure 2 is a flow chart of specific steps of basic operation risk assessment according to embodiment 1;

[0023] Figure 3 is a flow chart of specific steps of important statement assessment according to embodiment 1;

[0024] Figure 4 is a flow chart of specific steps of operation risk assessment according to embodiment 1;

[0025] Figure 5 is a structure diagram of a computer system according to embodiment 2.

[0026] Figure 6 is a structure diagram of a computer storage medium according to embodiment 3. DETAILED DESCRIPTION

[0027] Example embodiments now will be described more fully hereinafter with reference to the accompanying drawings; however, the example embodiments can be implemented in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the example embodiments to those skilled in the art. Like reference numerals refer to like elements throughout the figures, and descriptions of the same or similar elements can be simplified or omitted.

[0028] The terms "one", "a", "the", "said", "s" are used to indicate the presence of one or more elements / components / etc.; the terms "include" and "have" are used to indicate an open-ended inclusion and refer to additional elements / components / etc. in addition to the listed elements / components / etc. Embodiment 1

[0029] To solve the above problems, according to one aspect of the present application, as shown in the figure, a database operation and maintenance method based on query statement analysis is provided according to the present application, characterized in that, specifically comprising: Figure 1

[0030] S11 at least based on the number of database query statements, kind of the complexity of the analysis of the database query statement evaluation, and based on the complexity to determine whether the need for comprehensive analysis, if yes, then enter step S15, if not, then enter step S12;

[0031] It should be noted that the complexity of the value range is between 0 and 1, and specifically when the complexity is not greater than the complexity constant, it is determined that the database query statement needs to be analyzed comprehensively, wherein the complexity constant is a constant.

[0032] Specifically, when the complexity constant is 0.7, if the complexity is 0.8, at this time according to the complexity, because the efficiency of comprehensive analysis is too low, therefore no need to carry on comprehensive analysis.

[0033] Specifically, the complexity of the analysis of the database query statement is specifically determined according to the table lookup, expert scoring, mathematical model, empirical formula and other ways. Generally speaking, the more the number of database query statements, the more the complexity of the analysis of the database query statement.

[0034] In this embodiment, by first at least based on the number of database query statements, kind of the complexity of the analysis of the database query statement evaluation, and based on the complexity to determine whether the need for comprehensive analysis, thereby realizing the complexity of the statement analysis of the database with lower can carry on more comprehensive analysis, and for the complexity of the high also guarantees the efficiency of analysis, thereby guaranteeing the stability and comprehensiveness of the operation analysis of the database.

[0035] ​S12, based on the business type corresponding to the database query statement, obtaining a core statement, based on the execution time of the database query statement, determining a problem statement, and based on the analysis results of the problem statement and the core statement, obtaining a basic operation risk of the database, based on the complexity of the analysis of the core statement and the problem statement, the basic operation risk, determining whether to need re-screening, if yes, entering step S13, if not, outputting the analysis results of the problem statement and the core statement and the basic operation risk;

[0036] Specifically, when the business type corresponding to the database query statement belongs to a specific business type, it is determined that the database query statement is a core statement. Specifically, the specific business type includes user login, transfer, and account balance query.

[0037] Specifically, when the execution time of the database query statement is greater than 2s each time, it is determined that the execution time of the database query statement at this time is too slow, and it needs to be taken as a problem statement.

[0038] Specifically, as shown in Figure 2 The specific steps of the basic operation risk assessment are:

[0039] S21, based on the analysis results of the problem statement, determining the database query statement with problems in the problem statement, and based on at least the number of the database query statement with problems, the proportion of the database query statement with problems in the problem statement, and the proportion of the execution time of the database query statement with problems in the execution time of all database query statements, determining the risk assessment result of the problem statement;

[0040] Specifically, the risk assessment result of the problem statement is related to the number of the database query statement with problems, the proportion of the database query statement with problems in the problem statement, and the execution time of the database query statement with problems. It can be understood that the more the number of the database query statement with problems, the higher the proportion of the database query statement with problems in the problem statement, and the longer the execution time of the database query statement with problems, the greater the risk assessment result of the problem statement.

[0041] Specifically, for example, a mathematical model-based method can be used to determine the risk assessment result. When the number of problematic database query statements is 200, the proportion of the problematic database query statements in the problem statements is 1 / 1000, and the execution time of the problematic database query statements is 3s, the risk assessment result is K1(1-1 / 200)+K2(1 / 1000)+K3(1-1 / (3+1)), where K1, K2, and K3 are weights, generally ranging from 0 to 1, and the risk assessment result also ranges from 0 to 1.

[0042] Specifically, when the risk assessment result of the problem statement is greater than a certain value, the analysis of the core statement is not necessary, and the current need for re-screening is directly determined without the basic operation risk assessment.

[0043] S22 determines the problematic database query statements in the core statement based on the analysis result of the core statement, and determines the risk assessment result of the core statement based on at least the number of problematic database query statements in the core statement, the proportion in the core statement, and the proportion of the execution time in the execution time of all database query statements.

[0044] Specifically, the risk assessment result of the core statement is related to the number of problematic database query statements in the core statement, the proportion in the core statement, and the proportion of the execution time in the execution time of all database query statements. It can be understood that the more the number of problematic database query statements in the core statement, the higher the proportion in the core statement, and the higher the proportion of the execution time in the execution time of all database query statements, the greater the risk assessment result of the problem statement.

[0045] Specifically, for example, a mathematical model-based method can be used to determine the risk assessment result. When the number of problematic core statements is 200, the number of core statements is 1000, the number of problematic database query statements in the core statement is 200, the proportion in the core statement is 1 / 5, the single execution time of the problematic core statement is 2s, and the sum of the single execution time of the database query statement is 2000s, the risk assessment result is K1(1-1 / 200)+K2(1 / 5)+K3(1 / 1000), where K1, K2, and K3 are weights, generally ranging from 0 to 1, and the risk assessment result also ranges from 0 to 1.

[0046] Specifically, when the risk assessment result of the core sentence is greater than a certain value, it is directly determined that the current needs to be screened again, and there is no need to perform the basic operation risk assessment. In the actual operation process, the risk assessment result of the core sentence and the risk assessment result of the problem sentence can be combined to determine that the current needs to be screened again when both are large, and there is no need to perform the basic operation risk assessment.

[0047] S23 determines the weight value of the core sentence based on the number of the core sentence and the business type corresponding to the core sentence, and determines the weight value of the problem sentence based on the number of the problem sentence and the business type corresponding to the problem sentence;

[0048] It should be noted that the size of the weight value is positively correlated with the number of the core sentence and the business type corresponding to the core sentence. The more the number of the core sentence is, and the more important the business type corresponding to the core sentence is, the greater the weight value is. Generally, the value is between 0 and 1, and the weight value of the core sentence is greater than the weight value of the problem sentence.

[0049] It should be noted that the size of the weight value is positively correlated with the number of the problem sentence and the business type corresponding to the problem sentence. The more the number of the problem sentence is, and the more important the business type corresponding to the problem sentence is, the greater the weight value is. Generally, the value is between 0 and 1.

[0050] S24 determines the basic operation risk of the database based on the risk assessment result and the weight value of the problem sentence, and the risk assessment result and the weight value of the core sentence.

[0051] Specifically, the evaluation model of the basic operation risk of the database adopts an ADPSO-LSTM algorithm, and the specific steps are as follows:

[0052] Step 1: Preprocess the obtained sample value row data;

[0053] Step 2: Randomly assign values to the population size, iteration number, position range and other parameters of PSO;

[0054] Step 3: Construct the LSTM network, initialize the network parameters of the LSTM, including the number of hidden layer unit nodes, batch size and learning rate;

[0055] Step 4: Solve the particle fitness value according to the target function MSE, which is defined as: In the formula, N is the number of samples, And y(t) are the predicted value and the true value at time t, respectively;

[0056] Step 5: Update the position and velocity of the particle according to the formula: ;

[0057] Step 6: if the iteration termination condition is met, the optimal solution of the parameters of the LSTM is output, the obtained optimal parameters are used to reconstruct the LSTM structure, and if not, t=t+l, steps 4-6 are repeated.

[0058] The output of the LSTM algorithm is:

[0059] Specifically, in the iteration process of solving the optimal value of the LSTM hyperparameter, the PSO algorithm is used for optimization, and the limitation that particles are easily trapped in local minimum value traps. At present, most scholars prefer to improve the inertia weight strategy of the PSO algorithm, which weakens the imbalance of local and global search to a certain extent, but still does not solve the historical problem of PSO.

[0060] Based on this analysis, the PSO algorithm is improved, and an adaptive dynamic particle swarm optimization algorithm (ADPSO) is proposed. The key idea is not to consider the inertia term, to realize global minimum value search, to introduce an adaptive strategy, to integrate dynamic factors to adjust the speed of each iteration, and to let the speed update only depend on the particles whose positions change in the search space. Therefore, the logarithmic function is introduced to the learning parameters c1(t) and c2(t), the jumping property of the particles is increased, the local minimum value trap is avoided, and the specific improvement is as follows:

[0061] The logarithmic function log(t) is introduced to c1(t), and the contraction factor is introduced to c2(t), and is redefined as:

[0062] In the formula, is a very small positive value, g(t) is a dynamic parameter, x min , x max is the search range of the particle swarm, and the search range is between 0 and 1, is a dynamic index, and are the individual extreme value and position of the i-th particle at the t-th iteration, and the dynamic index is defined as:

[0063] The improved learning parameter utilizes the oscillation of the introduced log function and the contraction factor to improve the ability of the particle to jump out of the local minimum value trap. The idea of linearly decreasing inertia weight is adopted to first enhance the search of the particle in the entire solution space in the early iteration, and then enhance the optimization of a specific search domain, so as to realize the balance of the global and local search domains of the particle and ensure fast convergence.

[0064] Specifically, when the risk assessment result of the problem statement and the risk assessment result of the core statement are both greater than the risk fixed value, the basic operation risk of the database does not need to be assessed, and the operation risk of the database is directly assessed.

[0065] Specifically, a comprehensive evaluation value is constructed based on the complexity of the analysis of the core statement and the problem statement and the basic operation risk, and it is determined whether further screening is needed based on the comprehensive evaluation value.

[0066] In the embodiment, the basic operation risk of the database is obtained by combining the analysis results of the problem statement and the core statement, and it is determined whether further screening is needed based on the complexity of the analysis of the core statement and the problem statement and the basic operation risk, so that it is determined whether further analysis is needed based on the analysis results of the problem statement and the core statement and the complexity of the analysis, which not only ensures the analysis efficiency, but also avoids the security risks caused by insufficient analysis due to high operation risk of the database.

[0067] S13 obtains important statements based on the business type, execution time and execution frequency corresponding to the database query statement, determines the operation risk of the database based on the analysis results of the problem statement, the core statement and the important statement, and determines whether comprehensive analysis is needed based on the operation risk. If yes, go to step S14, and if no, output the analysis results of the problem statement, the core statement and the important statement and the operation risk;

[0068] Specifically, as shown in Figure 3 The specific steps of the important statement evaluation are:

[0069] S31 screens the database query statement based on the execution frequency of the database query statement to obtain candidate statements, and determines whether further screening is needed based on the number of the candidate statements. If yes, go to step S32, and if no, the candidate statements are taken as important statements.

[0070] Specifically, when the number of the candidate statements is small, the time required for analysis is not too much, and therefore the candidate statements are directly taken as important statements.

[0071] S32 screens the alternative sentences based on execution time of the alternative sentences to obtain screened sentences, and determines whether to continue screening based on the number of the screened sentences, if yes, goes to step S33, and if no, takes the screened sentences as important sentences;

[0072] Specifically, for example, when the number of screened sentences is small, the time required for analysis is not too much at this time, and therefore the screened sentences are directly taken as important sentences, and the alternative sentences with generally long execution time or greater than a certain value can be taken as screened sentences.

[0073] S33 screens the screened sentences based on the business type corresponding to the screened sentences to obtain twice-screened sentences, and determines whether to continue screening based on the number of the twice-screened sentences, if yes, goes to step S34, and if no, takes the twice-screened sentences as important sentences;

[0074] Specifically, for example, when the number of screened sentences is small, the time required for analysis is not too much at this time, and therefore the screened sentences are directly taken as important sentences, and the alternative sentences with generally long execution time or greater than a certain value can be taken as screened sentences.

[0075] S34 obtains an importance evaluation value of the twice-screened sentences based on the business type corresponding to the twice-screened sentences, execution time and execution frequency, and obtains important sentences based on the importance evaluation value.

[0076] Specifically, as shown in Figure 4 the specific steps of the running risk assessment are as follows:

[0077] S41 determines the database query sentences with problems in the core sentences based on the analysis result of the important sentences, and determines the risk assessment result of the important sentences based on at least the number of the database query sentences with problems in the important sentences, the proportion in the important sentences, and the proportion of execution time of the important sentences in execution time of all database query sentences, and determines whether to need comprehensive analysis based on the risk assessment result of the important sentences, if yes, analyzes all database query sentences, and if no, goes to step S42;

[0078] S42 determines the weight of the important sentences based on the number of the important sentences, the business type corresponding to the important sentences, and the proportion of the important sentences in all database query sentences, and obtains the corrected risk assessment result of the important sentences based on the weight of the important sentences and the risk assessment result of the important sentences;

[0079] Specifically, for example, generally, the modified risk assessment result is greater than the risk assessment result, when the risk assessment result is greater or the modified risk assessment result is greater, a comprehensive analysis is needed at this time.

[0080] Specifically, the modified risk assessment result can be modified according to any one of multiplication or addition.

[0081] S43 determines whether a comprehensive analysis is needed based on the modified risk assessment result, if yes, goes to step S44, and if no, goes to step S45;

[0082] S44 determines whether a comprehensive analysis is needed based on the basic operation risk, if yes, analyzes all database query statements, and if no, goes to step S45;

[0083] S45 determines the operation risk of the database based on the basic operation risk and the modified risk assessment result.

[0084] Specifically, the operation risk of the database adopts an evaluation model based on an ADPSO-LSTM algorithm, which will not be described here.

[0085] In this embodiment, the operation risk of the database is determined based on the analysis results of the problem statements, the core statements and the important statements, and whether a comprehensive analysis is needed is determined based on the operation risk, so as to further improve the comprehensiveness of the analysis, and the operation risk of the database can be determined more comprehensively and intuitively, the operation risk of the database is reduced on the basis of ensuring the analysis efficiency.

[0086] S14 analyzes all database query statements to obtain analysis results of all statements, and outputs the analysis results of all statements.

[0087] In another possible embodiment, when there are many problems in the analysis results of all statements, the operation risk of the database is also evaluated based on the analysis results of all statements, so that the operation and maintenance personnel can quickly and accurately perform targeted operation and maintenance of the database.

[0088] In this embodiment, through the analysis of all database query statements, comprehensive analysis of the database with high risk or hidden dangers is realized, the safety and stability of the database operation are ensured, and the influence of the database downtime on the normal operation of the business is reduced.

[0089] In order to facilitate understanding of the technical solutions, a preferred embodiment is given in the present application:

[0090] When the complexity is set to 0.7, if the complexity is 0.8, then according to the complexity, since the efficiency of a full analysis is too low, a full analysis is unnecessary. Specifically, the complexity of the database query statement analysis is determined by methods such as table lookup, expert scoring, mathematical models, and empirical formulas. Generally speaking, the more database query statements there are and the more types there are, the greater the complexity of the database query statement analysis.

[0091] When the business type corresponding to the database query statement belongs to a specific business type, the database query statement is determined to be a core statement. Specifically, the specific business types include user login, transfer, and account balance query. When the execution time of each database query statement exceeds 2 seconds, the execution time of the database query statement is determined to be too slow and it needs to be identified as a problem statement. Figure 2 The evaluation method shown obtains the basic operational risk of the database by analyzing the problem statement and the core statement. Based on the complexity of the analysis of the core statement and the problem statement and the basic operational risk, a comprehensive evaluation value is constructed. Based on the comprehensive evaluation value, it is determined whether further screening is needed. If so, proceed to step S13.

[0092] According to such Figure 3 The important statements are evaluated and the operational risks are assessed in the manner shown. Based on the operational risks, it is determined whether a comprehensive analysis is required. If so, proceed to step S14.

[0093] The analysis results are obtained by analyzing all database query statements. When there are many problems in the analysis results, it is also necessary to assess the operational risks of the database based on the analysis results. This will enable the operation and maintenance personnel to quickly and accurately carry out targeted database operation and maintenance. Example 2

[0094] like Figure 5 As shown, this application provides a computer system comprising: a memory and a processor connected in communication, and a computer program stored in the memory and capable of running on the processor, characterized in that: when the processor runs the computer program, it executes the above-described database operation and maintenance method based on query statement analysis.

[0095] It should be noted that a database operation and maintenance method based on query statement analysis is as follows:

[0096] When the complexity is set to 0.7, if the complexity is 0.8, then according to the complexity, since the efficiency of a full analysis is too low, a full analysis is unnecessary. Specifically, the complexity of the database query statement analysis is determined by methods such as table lookup, expert scoring, mathematical models, and empirical formulas. Generally speaking, the more database query statements there are and the more types there are, the greater the complexity of the database query statement analysis.

[0097] When the business type corresponding to the database query statement belongs to a specific business type, the database query statement is determined to be a core statement. Specifically, the specific business types include user login, transfer, and account balance query. When the execution time of each database query statement exceeds 2 seconds, the execution time of the database query statement is determined to be too slow and it needs to be identified as a problem statement. Figure 2 The evaluation method shown obtains the basic operational risk of the database by analyzing the problem statement and the core statement. Based on the complexity of the analysis of the core statement and the problem statement and the basic operational risk, a comprehensive evaluation value is constructed. Based on the comprehensive evaluation value, it is determined whether further screening is needed. If so, proceed to step S13.

[0098] According to such Figure 3 The important statements are evaluated and the operational risks are assessed in the manner shown. Based on the operational risks, it is determined whether a comprehensive analysis is required. If so, proceed to step S14.

[0099] The analysis results are obtained by analyzing all database query statements. When there are many problems in the analysis results, it is also necessary to assess the operational risks of the database based on the analysis results. This will enable the operation and maintenance personnel to quickly and accurately carry out targeted database operation and maintenance.

[0100] In one specific embodiment, the specific steps of the basic operational risk assessment are as follows:

[0101] Specifically, the assessment of the basic operational risks of the database adopts an assessment model based on the ADPSO-LSTM algorithm, and the specific steps are as follows:

[0102] Step 1: Preprocess the obtained sample value rows;

[0103] Step 2: Randomly assign values ​​to parameters such as population size, number of iterations, and location range of the PSO;

[0104] Step 3: Construct the LSTM network and initialize the LSTM network parameters, including the number of hidden layer unit nodes, batch size, and learning rate;

[0105] Step 4: Solve the particle fitness value according to the objective function MSE, defined as:

[0106] Wherein, N is the sample number, And y(t) are the predicted value and the true value at t time respectively;

[0107] Step 5: Update the position and velocity of the particle according to the formula: ;

[0108] Step 6: If the iteration termination condition is met, the optimal solution of the LSTM parameter is output, and the obtained optimal parameter is used to reconstruct the LSTM structure, if not, let t=t+l, repeat steps 4-6.

[0109] Wherein, the output of the LSTM algorithm is:

[0110] Specifically, in the iteration process of solving the optimal value of the LSTM hyperparameter, the PSO algorithm is used for optimization, and the particles are prone to fall into the local minimum value trap. At present, most scholars prefer to improve the inertia weight strategy of the PSO algorithm, which weakens the imbalance of local and global search to a certain extent, but still cannot solve the historical problem of PSO.

[0111] Based on the analysis, the PSO algorithm is improved, and an adaptive dynamic particle swarm optimization algorithm (ADPSO) is proposed, the key idea of which is not to consider the inertia term, realize global minimum search, introduce adaptive strategy, integrate dynamic factors to adjust the speed of each iteration, and let the speed update only depend on the particles whose positions change in the search space. Therefore, the logarithmic function is introduced to the learning parameters c1(t) and c2(t), the jumping property of the particles is increased, the local minimum value trap is avoided, and the specific improvement is as follows:

[0112] The logarithmic function log(t) is introduced to c1(t), and the contraction factor Is introduced to c2(t), and is redefined as:

[0113] Wherein, Is a very small positive value, g(t) is a dynamic parameter, x min , x max Is the search range of the particle swarm, and the search range is between 0 and 1, Is a dynamic index, and are the individual extreme value and position of the i-th particle at the t-th iteration, respectively, and the dynamic index is defined as:

[0114] The improved learning parameter utilizes the oscillation of the introduced log function and the contraction factor, and improves the ability of the particle to jump out of the local minimum value trap. The inertia weight is linearly reduced, at the initial iteration, the particle is first enhanced to search in the whole solution space, and then the specific search domain is enhanced to optimize, so that the balance of the global and local search domains of the particle is realized, and the rapid convergence is ensured.

[0115] Specifically, the embodiment further provides a computer system, which comprises a processor, a memory, a network interface and a database connected through a system bus; wherein the processor of the computer system is used to provide computing and control capabilities; the memory of the computer system comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The computer device network interface is used for communication connection with the external terminal through the network. The computer program is executed by the processor to implement the above-mentioned database operation and maintenance method based on query statement analysis. Embodiment 3

[0116] As Figure 6 shown, the application provides a computer storage medium, which stores a computer program, when the computer program is executed in a computer, the computer program makes the computer execute the above-mentioned database operation and maintenance method based on query statement analysis.

[0117] It should be noted that the database operation and maintenance method based on query statement analysis is specifically:

[0118] When the complexity is 0.7, if the complexity is 0.8, at this time, according to the complexity, the overall analysis is too low in efficiency, so it is not necessary to perform overall analysis, specifically, the complexity of the analysis of the database query statement is specifically determined according to table lookup, expert scoring, mathematical model, empirical formula and the like. Generally, the more the number of database query statements is, the more the types are, and the greater the complexity of the analysis of the database query statement is.

[0119] When the business type corresponding to the database query statement belongs to a specific business type, it is determined that the database query statement is a core statement, specifically, the specific business type includes user login, transfer, account balance query, when the execution time of the database query statement is greater than 2s each time, it is determined that the execution time of the database query statement at this time is too slow, and it needs to be taken as a problem statement; according to Figure 2The evaluation method shown analyzes the problem sentence and the core sentence to obtain the basic operation risk of the database, constructs a comprehensive evaluation value based on the complexity of the analysis of the core sentence and the problem sentence and the basic operation risk, and determines whether re-screening is needed based on the comprehensive evaluation value. If yes, go to step S13;

[0120] The important sentence evaluation and operation risk evaluation are performed in the manner shown as Figure 3 The operation risk evaluation is performed based on the operation risk, and it is determined whether comprehensive analysis is needed. If yes, go to step S14;

[0121] Based on the analysis of all database query statements, the analysis results of all statements are obtained. When there are many problems in the analysis results of all statements, the operation risk of the database is evaluated based on the analysis results of all statements, so that the operation and maintenance personnel can quickly and accurately perform database operation and maintenance.

[0122] Specifically, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile 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. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0123] In several embodiments provided in the present application, it should be understood that the disclosed system and method can also be implemented in other manners. The above described system embodiments are merely exemplary. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architectures, functions and operation of the system, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment or a portion of code which comprises one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementations, the functions shown in the blocks can occur in different orders than those shown in the figures. For example, two blocks shown in succession can in fact be executed substantially concurrently or in reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by dedicated hardware-based systems which perform the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0124] In addition, the various functional modules in the embodiments of the present application can be integrated together or exist separately, or two or more modules can be integrated to form an independent part.

[0125] If the functions are implemented in the form of software function modules and sold or used as an independent product, they can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application essentially or partially, or a part of the technical solutions can be embodied in a software product, and the computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods according to the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various media which can store program codes.

[0126] Based on the above ideal embodiments according to the present application, through the above description, relevant personnel can make various changes and modifications without deviating from the scope of the technical idea of the present application. The technical scope of the present application is not limited to the content in the specification, and must be determined according to the scope of the claims.

Claims

1. A database operation and maintenance method based on query statement analysis, characterized in that, Specifically comprising: S11 at least based on the number of database query statements, the complexity of the analysis of the type of database query statement evaluation, and based on the complexity to determine whether the need for comprehensive analysis, if yes, then enter step S15, if not, then enter step S12; S12 based on the business type corresponding to the database query statement to get the core statement, and based on the execution time of the database query statement to determine the problem statement, and based on the analysis result of the problem statement, the core statement to get the basic operation risk of the database, based on the complexity of the analysis of the core statement and the problem statement, the basic operation risk to determine whether to need to be screened again, if yes, then enter step S13, if not, then the analysis result of the problem statement, the core statement and the basic operation risk are output; S13 based on the business type corresponding to the database query statement, execution time, execution times to get important statements, and based on the analysis result of the problem statement, the core statement, the important statement to determine the operation risk of the database, and based on the operation risk to determine whether to need to be analyzed comprehensively, if yes, then enter step S14, if not, then the analysis result of the problem statement, the core statement, the important statement and the operation risk are output; S14 based on all database query statements to analyze to get the analysis result of all statements, and the analysis result of all statements is output; The specific steps for determining the operation risk are: S41 based on the analysis result of the important statement, determine the database query statement with problems in the core statement, and at least based on the number of database query statements with problems in the important statement, the proportion in the important statement, the proportion of execution time in the execution time of all database query statements, determine the risk assessment result of the important statement, and based on the risk assessment result of the important statement to determine whether to need comprehensive analysis, if yes, then analyze all database query statements, if not, then enter step S42; S42 based on the number of important statements, the business type corresponding to the important statement, the proportion of the important statement in all database query statements to determine the weight of the important statement, and based on the weight of the important statement and the risk assessment result of the important statement to get the modified risk assessment result of the important statement; S43 based on the modified risk assessment result to determine whether to need comprehensive analysis, if yes, then enter step S44, if not, then enter step S45; S44 based on the basic operation risk to determine whether to need comprehensive analysis, if yes, then analyze all database query statements, if not, then enter step S45; S45 based on the basic operation risk, the modified risk assessment result to determine the operation risk of the database. 2.The database operation and maintenance method of claim 1, wherein, The complexity value range is between 0 and 1, specifically when the complexity is not greater than the complexity constant value, then it is determined that the database query statement needs to be analyzed comprehensively, wherein the complexity constant value is a constant. 3.The database operation and maintenance method of claim 1, wherein, When the business type corresponding to the database query statement belongs to a specific business type, the database query statement is determined as a core statement, and the specific business type includes user login, transfer, and account balance query. 4.The database operation and maintenance method of claim 1, wherein, The specific steps for determining the basic operation risk are: Based on the analysis result of the problem statement, a database query statement with a problem in the problem statement is determined, and at least based on the number of the database query statement with the problem, the proportion of the database query statement with the problem in the problem statement, and the proportion of the execution time of the database query statement with the problem in the execution time of all database query statements, a risk assessment result of the problem statement is determined; Based on the analysis result of the core statement, a database query statement with a problem in the core statement is determined, and at least based on the number of the database query statement with the problem in the core statement, the proportion in the core statement, and the proportion of the execution time in the execution time of all database query statements, a risk assessment result of the core statement is determined; Based on the number of the core statement and the business type corresponding to the core statement, a weight of the core statement is determined, and based on the number of the problem statement and the business type corresponding to the problem statement, a weight of the problem statement is determined; Based on the risk assessment result and the weight of the problem statement and the risk assessment result and the weight of the core statement, a basic operation risk of the database is determined. 5.The database operation and maintenance method of claim 4, wherein, When the risk assessment result of the problem statement and the risk assessment result of the core statement are both greater than a risk fixed value, the basic operation risk of the database does not need to be evaluated, and the operation risk of the database is directly evaluated. 6.The database operation and maintenance method of claim 1, wherein, Based on the complexity of the analysis of the core statement and the problem statement and the basic operation risk, a comprehensive evaluation value is constructed, and based on the comprehensive evaluation value, it is determined whether further screening is needed.

7. The database operation and maintenance method of claim 1, wherein, The specific steps for determining the important statement are: Based on the execution frequency of the database query statement, the database query statement is screened to obtain a candidate statement, and based on the number of the candidate statement, it is determined whether further screening is needed, if yes, the next step is entered, and if not, the candidate statement is taken as an important statement; Based on the execution time of the candidate statement, the candidate statement is screened to obtain a screened statement, and based on the number of the screened statement, it is determined whether further screening is needed, if yes, the next step is entered, and if not, the screened statement is taken as an important statement; Based on the business type corresponding to the screened statement, the screened statement is screened to obtain a secondary screened statement, and based on the number of the secondary screened statement, it is determined whether further screening is needed, if yes, the next step is entered, and if not, the secondary screened statement is taken as an important statement; Based on the business type, the execution time, and the execution frequency of the secondary screened statement, an importance evaluation value of the secondary screened statement is obtained, and based on the importance evaluation value, an important statement is obtained.

8. A computer system comprising: The memory and the processor connected by communication, and the computer program stored in the memory and capable of running on the processor, characterized in that the processor executes the computer program to perform the database operation and maintenance method based on query statement analysis according to any one of claims 1-7. 9.A computer storage medium having a computer program stored thereon, and when the computer program is executed in a computer, the computer program causes the computer to perform the database operation and maintenance method based on query statement analysis according to any one of claims 1-7.

Citation Information

Patent Citations

  • Database operation and maintenance method and device

    CN111913937A

  • Transaction query method and device, electronic equipment and readable storage medium thereof

    CN111897838A

  • Data processing method, target database system and data processing system

    CN113946559A