Database parameter adjustment method and device based on local large language model and medium

By using a local large language model to adjust database parameters, the risk of data leakage caused by cloud-based optimization is resolved. This enables highly accurate database parameter tuning to be performed locally, ensuring data security and optimization effectiveness.

CN122285633BActive Publication Date: 2026-07-31HIGHGO SOFTWARE
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HIGHGO SOFTWARE
Filing Date
2026-05-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

The working mode of cloud-based intelligent tuning services requires uploading performance indicators containing sensitive business data to the cloud for analysis, which can easily lead to data leakage and privacy compliance risks. In particular, it is difficult to meet the needs of information technology innovation environments and private deployments that have strict requirements for data sovereignty.

Method used

A database parameter tuning method based on a local large language model is adopted. By obtaining performance indicators and converting them into feature vectors, and using a local vector knowledge base for case retrieval and conflict analysis, the large language model is driven to perform counterfactual inference and generate parameter tuning suggestions, ensuring that the tuning process is completed locally.

Benefits of technology

It enables database parameter tuning to be completed in a local environment, ensuring the security of sensitive data, reducing the risk of data leakage, improving tuning accuracy and scenario adaptability, and enhancing decision-making quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122285633B_ABST
    Figure CN122285633B_ABST
Patent Text Reader

Abstract

This application discloses a database parameter tuning method, device, and medium based on a local large language model, belonging to the field of database parameter tuning technology. It addresses the risks of data leakage and privacy compliance that can easily occur during database tuning. The method includes: converting the performance indicators of the target database into feature vectors reflecting the current database bottlenecks; executing an appropriate retrieval strategy based on the bottleneck scenario complexity corresponding to the feature vectors and / or the case distribution density of the local vector knowledge base to retrieve historical tuning cases from the local vector knowledge base; performing conflict analysis on the retrieved historical tuning cases, constructing a candidate strategy set based on the original strategy and counterfactual strategy, and driving the locally deployed large language model to perform counterfactual inference to generate reference cases; and inputting the historical tuning cases and / or reference cases, along with the feature vectors, into the locally deployed large language model to obtain parameter tuning suggestions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database parameter adjustment technology, and in particular to a database parameter adjustment method, device and medium based on a local large language model. Background Technology

[0002] As a core component of modern enterprise information systems, database performance directly impacts business continuity, user experience, and operating costs. Database performance is closely related to configuration parameters, and with the growth of business scale and the diversification of data loads within enterprises, the optimization of database parameters has become increasingly complex and crucial.

[0003] Traditional manual tuning methods often rely heavily on the personal experience of database administrators. While automatic tuning tools based on predefined rules provide automation capabilities, their rule sets are limited, making it difficult to cover complex mixed load scenarios. Furthermore, the rules are prone to becoming invalid after database version upgrades, resulting in poor scenario adaptability.

[0004] In recent years, cloud service providers have launched cloud-based intelligent tuning services. Although these services integrate advanced optimization algorithms, their working mode requires uploading performance indicators containing sensitive business data to the cloud for analysis. This can easily lead to data leakage and privacy compliance risks, and is particularly difficult to meet the needs of domestic IT innovation environments and private deployments that have strict requirements for data sovereignty. Summary of the Invention

[0005] This application provides a database parameter adjustment method, device, and medium based on a local large language model to solve the following technical problem: When optimizing a database, the working mode of cloud-based intelligent optimization services requires uploading performance indicators containing sensitive business data to the cloud for analysis, which can easily lead to data leakage and privacy compliance risks, and is particularly difficult to meet the needs of information technology innovation environments and private deployments that have strict requirements for data sovereignty.

[0006] The embodiments of this application adopt the following technical solutions: This application provides a database parameter tuning method based on a local large language model. The method includes: acquiring performance metrics corresponding to the target database and converting these metrics into feature vectors reflecting the current database bottlenecks; wherein the feature vectors at least include bottleneck type labels and confidence scores for the metrics; executing an appropriate retrieval strategy based on the bottleneck scenario complexity corresponding to the feature vectors and / or the case distribution density of the local vector knowledge base to retrieve historical tuning cases from the local vector knowledge base; wherein the representation structure of historical tuning cases includes at least one of scenario features, bottleneck type labels, tuning parameter sets, execution effects, and constraints; performing conflict analysis on the retrieved historical tuning cases; if conflicts exist, constructing a candidate strategy set based on the original strategy and counterfactual strategy, and driving the locally deployed large language model to perform counterfactual inference to generate reference cases; inputting the historical tuning cases and / or reference cases, along with the feature vectors, into the locally deployed large language model to obtain parameter tuning suggestions.

[0007] In one implementation of this application, performance metrics are transformed into feature vectors reflecting current database bottlenecks. Specifically, this includes: analyzing performance metrics based on a performance benchmark threshold to identify potential bottleneck types; determining initial confidence scores for each potential bottleneck type based on the deviation of the performance metrics from the performance benchmark threshold; performing similarity matching between potential bottleneck types and cases in a local vector knowledge base to obtain similar bottleneck type cases; and revising the initial confidence scores based on the performance improvement recorded in the execution effect field of similar bottleneck type cases to generate dynamic confidence scores; and encoding the performance metrics, potential bottleneck types, and dynamic confidence scores, and concatenating them into a feature vector.

[0008] In one implementation of this application, an adaptive retrieval strategy is executed based on the bottleneck scenario complexity corresponding to the feature vector. Specifically, this includes: mapping the feature vector to a dense vector and matching it with the scenario feature vector fields of each case in the local vector knowledge base to obtain a first similarity; calculating the matching degree between the bottleneck type corresponding to the feature vector and the constraint information of the target database and the bottleneck type label and constraint condition fields of each case in the local vector knowledge base to obtain a second similarity; weighting and fusing the first and second similarities to obtain a preliminary comprehensive similarity, and selecting a primary candidate case set based on the preliminary comprehensive similarity; converting the feature vector into a natural language query describing the current database bottleneck, performing semantic retrieval in the local vector knowledge base based on the natural language query, and taking the intersection of the retrieval results with the primary candidate case set to obtain an enhanced candidate case set; and reordering the enhanced candidate case set through a semantic cross-encoder and scenario adaptation strategy to obtain historical optimization cases.

[0009] In one implementation of this application, the enhancement candidate case set is reordered using a semantic cross-encoder and a scenario adaptation strategy to obtain historical optimization cases. Specifically, this includes: pairing a natural language query with the field information corresponding to each case in the enhancement candidate case set, inputting the pairings into the semantic cross-encoder, which outputs a semantic relevance score; identifying cases in the enhancement candidate case set whose target database version and hardware configuration do not match the constraint fields, and assigning descending scores to these mismatched cases; identifying cases in the enhancement candidate case set whose bottleneck type labels match the current bottleneck type label, and assigning first ascending scores to these matching cases; identifying the optimization effect quantification value corresponding to each case in the enhancement candidate case set, and assigning second ascending scores to these cases based on the optimization effect quantification value; and reordering the enhancement candidate case set based on the semantic relevance score, descending score, first ascending score, and second ascending score to obtain historical optimization cases.

[0010] In one implementation of this application, an adapted retrieval strategy is executed based on the case distribution density of the local vector knowledge base. Specifically, this includes: constructing a bottleneck feature sub-vector based on the feature dimensions corresponding to bottleneck types with confidence scores greater than a preset threshold; using the bottleneck feature sub-vector as a query; determining the third similarity between the feature vector and each historical optimization case in the local vector knowledge base; and selecting a reference candidate case set based on the third similarity; extracting the parameter adjustment items corresponding to each historical case in the reference candidate case set; and determining, based on preset knowledge of the influence relationships between parameters, items with direct or indirect influence on the current parameter adjustment item. The database performance dimensions affected are analyzed, and the expected strength of the adjustment item's effect on each dimension is determined to construct a weighted set of impact dimensions corresponding to the current historical cases. The set of impact dimensions is then matched with the set of actual performance bottleneck dimensions corresponding to the current feature vector to calculate the transmission similarity corresponding to the current historical cases. Based on the performance improvement values ​​corresponding to each historical case in the reference candidate case set, the effect weights are determined. The third similarity, transmission similarity, and effect weights are then weighted and summed to obtain the comprehensive retrieval score corresponding to each historical case. Based on the comprehensive retrieval score, the reference candidate case set is reordered to obtain historical optimization cases.

[0011] In one implementation of this application, a candidate strategy set is constructed based on the original strategy and the counterfactual strategy, and a locally deployed large language model is driven to perform counterfactual inference to generate reference cases. Specifically, this includes: identifying the parameter set with recommendation conflicts, and dividing the overall parameter space into a subspace of parameters to be decided and a subspace of determined parameters based on the inherent relationship between the parameters; for the conflicting parameters in the subspace of parameters to be decided, generating counterfactual strategies with different adjustment directions from the original strategies based on the conflicting original strategies, and constructing a candidate strategy set based on the original strategies and the counterfactual strategies; pairing the feature vectors of the current target database with each strategy in the candidate strategy set to generate multiple inference units; driving the local large language model to perform counterfactual inference on the inference units; determining the final recommendation value based on the counterfactual inference results and the preset emergent consensus and the principle of minimum risk, and generating reference cases based on the inference logic and the final recommendation value.

[0012] In one implementation of this application, historical tuning cases and / or reference cases, along with feature vectors, are input into a locally deployed large language model to obtain parameter tuning suggestions. Specifically, this includes: assembling the parameter adjustment items and associated adjustment logic contained in the historical tuning cases and / or reference cases, as well as the bottleneck type and key performance indicators of the current database corresponding to the feature vectors, in a predefined structured format to obtain an input prompt context; inputting the input prompt context into the locally deployed large language model and driving it to perform an inference task; wherein the inference task includes at least inferring the applicability of the parameter adjustment suggestions in the historical tuning cases and / or reference cases to the current specific scenario, and also includes generating parameter tuning suggestion entries item by item; wherein each suggestion entry includes at least one of the following: parameter name, current value, recommended value, adjustment range, adjustment reason, and expected effect; and outputting all parameter tuning suggestion entries generated by the locally deployed large language model as a structured parameter tuning suggestion report.

[0013] In one implementation of this application, before outputting a structured parameter tuning suggestion report, the method further includes: querying the value range corresponding to the recommended parameters in a preset system configuration library, comparing the recommended values ​​with the value ranges, and marking recommended values ​​that do not conform to the value ranges as invalid; and / or, based on a preset parameter dependency graph, determining the conflicting parameter combinations in the recommended parameter set and generating conflict alarms; and / or, comparing the similarity of the recommended parameter set with historical failed tuning cases, and generating risk alarms when the similarity is greater than a preset threshold.

[0014] This application provides a database parameter tuning device based on a local large language model, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: acquire performance indicators corresponding to a target database and convert the performance indicators into feature vectors reflecting the current database bottlenecks; wherein the feature vectors at least include bottleneck type labels and confidence scores of the indicators; execute an adapted retrieval strategy based on the bottleneck scenario complexity corresponding to the feature vectors and / or the case distribution density of the local vector knowledge base to retrieve historical tuning cases from the local vector knowledge base; wherein the representation structure of historical tuning cases includes at least one of scenario features, bottleneck type labels, tuning parameter sets, execution effects, and constraints; perform conflict analysis on the retrieved historical tuning cases, and if conflicts exist, construct a candidate strategy set based on the original strategy and counterfactual strategy, and drive the locally deployed large language model to perform counterfactual inference to generate reference cases; input the historical tuning cases and / or reference cases, as well as the feature vectors, into the locally deployed large language model to obtain parameter tuning suggestions.

[0015] This application provides a non-volatile computer storage medium storing computer-executable instructions. These instructions are configured to: acquire performance metrics corresponding to a target database and convert the performance metrics into feature vectors reflecting the current database bottlenecks; wherein the feature vectors at least include bottleneck type labels and confidence scores for the metrics; based on the bottleneck scenario complexity corresponding to the feature vectors and / or the case distribution density of the local vector knowledge base, execute an adapted retrieval strategy to retrieve historical optimization cases from the local vector knowledge base; wherein the representation structure of historical optimization cases includes at least one of scenario features, bottleneck type labels, optimization parameter sets, execution effects, and constraints; perform conflict analysis on the retrieved historical optimization cases; if conflicts exist, construct a candidate strategy set based on the original strategy and counterfactual strategy, and drive the locally deployed large language model to perform counterfactual inference to generate reference cases; input the historical optimization cases and / or reference cases, along with the feature vectors, into the locally deployed large language model to obtain parameter optimization suggestions.

[0016] The at least one technical solution adopted in this application embodiment can achieve the following beneficial effects: In this application embodiment, the large language model inference, feature extraction, and case retrieval are all completed in the user's local environment, ensuring the performance of sensitive databases and the security of configuration data, reducing the risk of data leakage, and avoiding continuous cloud service costs. Secondly, this application embodiment improves the accuracy of optimization and scenario adaptability through interpretable structured feature vectors and a multi-strategy adaptive retrieval mechanism. By transforming the original performance indicators into structured vectors containing bottleneck types and confidence scores, the essence of the problem can be diagnosed more accurately, ensuring that the retrieved reference cases are both relevant and reliable. When historical experience is contradictory, by constructing a comparison strategy set, the local large model is driven to perform inference, thereby determining a robust optimal reference solution and improving the decision-making quality in complex and uncertain scenarios. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 A flowchart illustrating a database parameter adjustment method based on a local large language model, provided in this application embodiment; Figure 2 A schematic diagram of a database parameter adjustment system architecture based on a local large language model is provided for embodiments of this application; Figure 3 This is a schematic diagram of the structure of a database parameter adjustment device based on a local large language model, provided in an embodiment of this application.

[0018] Figure label: 200: Database parameter adjustment device based on local large language model; 201: Processor; 202: Memory. Detailed Implementation

[0019] This application provides a method, device, and medium for adjusting database parameters based on a local large language model.

[0020] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.

[0021] Figure 1 A flowchart illustrating a database parameter adjustment method based on a local large language model, as provided in this application embodiment, is shown below. Figure 1 The database parameter adjustment method based on the local large language model includes the following steps: Step 101: Obtain the performance metrics corresponding to the target database and convert the performance metrics into feature vectors that reflect the current database bottlenecks.

[0022] In one implementation of this application, performance metrics are analyzed based on a performance benchmark threshold to identify potential bottleneck types. Based on the deviation of the performance metrics from the performance benchmark threshold, an initial confidence score is determined for each potential bottleneck type. The potential bottleneck types are then matched with cases in a local vector knowledge base to obtain similar bottleneck type cases. The initial confidence score is then corrected based on the performance improvement recorded in the execution effect field of the similar bottleneck type cases to generate a dynamic confidence score. Finally, the performance metrics, potential bottleneck types, and dynamic confidence scores are encoded and concatenated into a feature vector.

[0023] Specifically, the database parameter adjustment method in this application embodiment is completed locally, and the data does not leave the local machine.

[0024] First, runtime performance metrics are collected in real time from the target database instance, including query latency, throughput, connection count, buffer pool hit rate, lock wait time, CPU utilization, and I / O read / write rate. The collector runs automatically at a set period to continuously monitor the database's operating status. Second, bottleneck identification is performed on the collected raw metrics to determine the current system bottleneck type (such as I / O intensive, CPU intensive, memory intensive, lock contention, etc.), and the bottleneck type, key metric values, and load characteristics are encoded into a structured feature vector.

[0025] It should be noted that the feature vectors in this embodiment are used in two directions: first, as query vectors for knowledge retrieval to search for similar cases in the vector knowledge base; and second, as input context for reasoning in the large language model, enabling the model to make more accurate reasoning based on structured features.

[0026] Furthermore, the bottleneck type identification algorithm in this embodiment is as follows: based on a comprehensive judgment of threshold rules and indicator weights, a benchmark threshold is first set for each type of indicator (e.g., I / O wait time ratio > 40% is judged as I / O bottleneck, CPU utilization consistently > 80% is judged as CPU bottleneck). Simultaneously, the ratio relationship between indicators is introduced as an auxiliary judgment factor, and the bottleneck type label is determined by comprehensively considering multiple dimensions. This embodiment also outputs a confidence score for each dimension; that is, it calculates the deviation of the performance indicator corresponding to each potential bottleneck type. This deviation is directly used as the initial confidence score for that potential bottleneck type. In this embodiment, the confidence score is used as a confidence weight component in the feature vector for subsequent retrieval, enabling the same indicator set to generate feature vectors with subtle differences under different threshold boundaries, thereby improving the discriminative power of subsequent retrieval.

[0027] The system uses all identified potential bottleneck types as a query set and matches them against the bottleneck type label field of all historical optimization cases in the local vector knowledge base. It then extracts the execution effect field of these matching cases, which quantitatively records the performance improvement brought about by historical optimization, such as a percentage increase in TPS. Weights are assigned to these historical cases based on their improvement magnitude, with more significant improvements receiving higher weights. Finally, these weights are used to vote on the bottleneck types associated with the matching cases, generating a correction factor based on historical experience. This correction factor is then weighted and fused with the calculated initial confidence score to obtain the dynamic confidence score for that potential bottleneck type.

[0028] The original multidimensional performance metrics are normalized, mapping each metric value to a uniform numerical range, forming the first segment of the vector. For each identified potential bottleneck type, a learned embedding vector is used, arranged in a fixed order, forming the middle segment of the vector. The dynamic confidence score corresponding to each potential bottleneck type is used as a scalar value, forming the last segment of the vector. Finally, the performance metric segment, bottleneck type encoding segment, and confidence score segment are sequentially concatenated to form a structured feature vector.

[0029] Step 102: Based on the bottleneck scenario complexity corresponding to the feature vector and / or the case distribution density of the local vector knowledge base, execute an appropriate retrieval strategy to retrieve historical optimization cases from the local vector knowledge base.

[0030] In one implementation of this application, if an adaptive retrieval strategy is executed based on the bottleneck scenario complexity corresponding to the feature vector, the feature vector is mapped to a dense vector and matched with the scenario feature vector fields of each case in the local vector knowledge base to obtain a first similarity. The bottleneck type corresponding to the feature vector and the constraint information of the target database are matched with the bottleneck type label and constraint condition fields of each case in the local vector knowledge base to obtain a second similarity. The first and second similarities are weighted and fused to obtain a preliminary comprehensive similarity, and a primary candidate case set is selected based on the preliminary comprehensive similarity. The feature vector is converted into a natural language query describing the current database bottleneck, and semantic retrieval is performed in the local vector knowledge base based on the natural language query. The intersection of the retrieval results and the primary candidate case set is taken to obtain an enhanced candidate case set. The enhanced candidate case set is reordered through a semantic cross-encoder and a scenario adaptation strategy to obtain historical optimization cases.

[0031] Specifically, this application proposes a case representation structure specifically for database parameter tuning. Each historical tuning case includes five fields: scenario feature vector, bottleneck type label, tuning parameter set (parameter name, original value, recommended value, adjustment range), execution effect, and constraints. This structure encodes tuning experience into a computable vector form, enabling case retrieval to simultaneously match indicator similarity and constraint compatibility, thereby improving retrieval accuracy.

[0032] Furthermore, the generated structured feature vectors are input into a pre-trained embedding model, which maps high-dimensional feature vectors to low-dimensional dense vector representations. Simultaneously, bottleneck type labels are parsed from these feature vectors, and the version and hardware configuration information of the target database are obtained from the system configuration. This structured information is encoded into sparse vectors. In the local vector knowledge base, the metadata of each historical optimization case contains two parts: a pre-calculated dense vector for its scene feature vector field, and a sparse vector encoded by its bottleneck type label and constraint condition fields. Two calculations are performed in parallel: the first calculates the cosine similarity between the query dense vector and the dense vectors of each case in the knowledge base, obtaining the first similarity; the second calculates the matching degree between the query sparse vector and the sparse vectors of each case in the knowledge base, obtaining the second similarity. Then, the first and second similarities are weighted and summed according to preset weights to calculate a preliminary comprehensive similarity score for each case in the knowledge base. Based on this score, cases are sorted in descending order, and the top K cases are selected to form a preliminary candidate case set.

[0033] The generated structured feature vectors are converted into natural language queries describing the current database bottleneck. Using these queries as input, semantic retrieval is performed on the full-text index of the local vector knowledge base to find cases semantically similar to the current problem in the descriptive text. The result set returned by this text retrieval is then intersected with the initial candidate case set; the cases within this intersection form the enhanced candidate case set.

[0034] Furthermore, for each case in the enhanced candidate case set, the structured information of the case is converted into a text description. This text description is composed of key fields such as the case's scene feature description, bottleneck type label, core changes to the tuning parameter set, execution effect summary, and constraints. The generated natural language query is then paired with this case text description to form a text pair containing the query and candidate content. Subsequently, this text pair is input into a semantic cross-encoder model, which analyzes the semantic association between the query and candidate description and performs interactive computation through its internal attention mechanism. Finally, the cross-encoder outputs a refined semantic relevance score for the text pair. This score is a scalar value; the higher the value, the stronger the semantic relevance between the historical case description and the current query question. The training process of this semantic cross-encoder model is as follows: using paired natural language queries and case text descriptions as input, it performs joint encoding through a deep attention mechanism, and the output is a scalar score representing the semantic relevance between the two. The training objective is to make the model's output score as close as possible to the manually labeled relevance tags.

[0035] Furthermore, the current version number and hardware configuration details of the target database are read and compared with the constraint fields of each candidate case. When a case's database version or key hardware indicators are clearly incompatible with the target environment, a punitive reduction in weight is applied to the current score of that case, for example, by multiplying its score by a discount factor less than one, thus obtaining an adjusted descending score. The core bottleneck type label of the current diagnosis is compared with the bottleneck type label of each candidate case. For cases with completely matching or highly similar bottleneck types, a reward bonus is given to their current score, such as by increasing a fixed gain value, thus obtaining an adjusted first ascending score. The execution effect field of each candidate case is parsed, and its quantified performance improvement value is extracted. All cases are normalized according to the magnitude of the improvement value, and an effect weight is assigned to each case based on the normalized value. This effect weight is converted into an adjustment amount for the current score, thus obtaining an adjusted second ascending score.

[0036] The descending, first ascending, and second ascending adjustments are superimposed according to preset priorities and weights. For example, the reduction in weight for constraint mismatch has the highest priority and may directly and significantly lower the score; the increase in weight for bottleneck matching is secondary; the adjustment of effect weights serves as fine-tuning to obtain the final comprehensive score. Based on this final comprehensive score, all historical optimization cases in the enhancement candidate case set are globally sorted in descending order to filter out historical optimization cases. The selected cases are not only highly semantically relevant to the current problem, but also ensure their potential applicability in the current target database environment, match the diagnosis of the root cause of the problem, and have a proven track record of good optimization results.

[0037] In one implementation of this application, if an adapted retrieval strategy is executed based on the case distribution density of the local vector knowledge base, then, based on the feature dimensions corresponding to the bottleneck types with confidence scores greater than a preset threshold, a bottleneck feature sub-vector is constructed. Using the bottleneck feature sub-vector as the query, the third similarity between the feature vector and each historical optimization case is determined in the local vector knowledge base, and a reference candidate case set is selected based on the third similarity. For each historical case in the reference candidate case set, the corresponding parameter adjustment items are extracted. Based on the preset knowledge of the influence relationship between parameters, the database performance dimensions that have direct and indirect influence on the current parameter adjustment item are determined, and the expected strength of the adjustment item's effect on each influence dimension is determined, thereby constructing a weighted set of influence dimensions corresponding to the current historical case. The matching degree of the set of influencing dimensions is calculated with the set of actual performance bottleneck dimensions corresponding to the current feature vector to obtain the transmission similarity corresponding to the current historical case. Based on the performance improvement value corresponding to each historical case in the reference candidate case set, the effect weight is determined. The third similarity, transmission similarity and effect weight are weighted and summed to obtain the comprehensive search score corresponding to each historical case. Based on the comprehensive search score, the reference candidate case set is re-ranked to obtain historical optimization cases.

[0038] Specifically, this application embodiment sets a confidence threshold to filter out all bottleneck dimensions with confidence scores exceeding the threshold from the structured feature vectors of the current database state. Based on a preset dimension index mapping, the corresponding values ​​or codes are extracted from the complete feature vectors and reassembled to dynamically construct bottleneck feature sub-vectors. Next, using this bottleneck feature sub-vector as the core query vector, the local vector knowledge base is accessed. From the complete scene feature vectors of each historical optimization case in the knowledge base, the completely corresponding parts are extracted based on the same dimension index mapping to form the corresponding scene feature sub-vector for each historical case. Subsequently, the cosine similarity between the currently queried bottleneck feature sub-vector and the corresponding scene feature sub-vector of each historical case in the knowledge base is calculated; this is the third similarity. All calculated third similarity values ​​are globally sorted in descending order, and the final reference candidate case set is determined according to a preset selection strategy. For each historical case in the reference candidate case set, the optimization parameter set field of that historical case is parsed, and all explicitly recorded parameter adjustment items are extracted. Each adjustment item specifies the specific modified parameter, its adjustment direction, and magnitude. Subsequently, the system accesses a pre-built knowledge base of parameter influence relationships. This knowledge base stores known dependencies, mutual exclusions, positive correlations, negative correlations, and other relationships between database parameters in the form of graphs or rules. Starting with the extracted parameter adjustment item, the system traverses the influence relationship path in the knowledge base to deduce the performance dimensions directly affected by the adjustment, as well as other performance dimensions that may be indirectly affected due to the chain reaction between parameters. Aggregating all the deduced affected performance dimensions constitutes the set of influence dimensions corresponding to this historical case.

[0039] Furthermore, the performance bottleneck dimension set is parsed from the current feature vector. This performance bottleneck dimension set typically consists of bottleneck type labels and anomaly indicator dimensions with high confidence scores from the feature vector. Next, the matching degree between the impact dimension set of each historical case and the current actual bottleneck dimension set is calculated. Simultaneously, the system reads the execution effect field of each historical case in the reference candidate case set, extracts the quantified performance improvement value, and normalizes it into an effect weight value between zero and one; the larger the improvement value, the higher the weight. The final comprehensive retrieval score for each case is calculated by weighting the third similarity, transitivity similarity, and effect weight. Based on this comprehensive retrieval score, the candidate case set is reordered in descending order to obtain historical optimization cases. Through this scheme, this embodiment of the application can find the historical experience that is theoretically most likely to solve the current problem when cases are sparse or unevenly distributed, by analyzing the internal logic of parameter adjustment and historical effects.

[0040] Step 103: Perform conflict analysis on the retrieved historical optimization cases. If conflicts exist, construct a candidate strategy set based on the original strategy and counterfactual strategy, and drive the locally deployed large language model to perform counterfactual inference to generate reference cases.

[0041] In one implementation of this application, a set of parameters with recommendation conflicts is identified. Based on the inherent relationships between the parameters, the overall parameter space is divided into a subspace of parameters to be decided and a subspace of determined parameters. For conflicting parameters in the subspace of parameters to be decided, a counterfactual policy with a different adjustment direction than the original policy is generated based on the conflicting original policy. A candidate policy set is constructed based on the original policy and the counterfactual policy. The feature vector of the current target database is paired with each policy in the candidate policy set to generate multiple inference units. The local large language model is driven to perform counterfactual inference on the inference units. Based on the counterfactual inference results and the preset emergent consensus and the principle of minimum risk, the final recommendation value is determined. Reference cases are generated based on the inference logic and the final recommendation value.

[0042] Specifically, the system first performs a structured analysis of these conflicts, comparing the optimization parameter sets of all conflict cases to identify database parameters that received different recommendation values ​​in two or more cases, which are then designated as core conflict parameters. Next, the system accesses a predefined database parameter relationship knowledge graph, which records the intrinsic relationships between parameters, such as dependencies, mutual exclusion, positive correlations, and negative correlations. Using the identified core conflict parameters as seed nodes, the system traverses the knowledge graph with a finite step size, associating other parameters with strong dependencies or strong mutual exclusions with these core parameters. Finally, the set consisting of these core conflict parameters and their closely related parameters serves as the subspace of parameters to be decided. All other parameters with consistent recommendation values ​​in historical cases and weak correlations with the core conflict parameters are then classified into the determined parameter subspace.

[0043] For each conflicting core parameter in the subspace of parameters to be decided, the system initiates a process to generate a causal testing strategy. First, it collects all historical cases that provide different recommended values ​​for the parameter and uses these recommended values ​​as the candidate value set. For each value in the candidate value set, the system uses that value as a benchmark to construct two types of strategies: the first is the original strategy, which directly adopts the candidate value; the second is the counterfactual strategy, which, based on the parameter type and value range, generates one or more comparative values ​​that differ from or are even opposite to the current candidate value in the direction of adjustment. For example, for a connectivity parameter, if the candidate value is to increase, the counterfactual strategy might generate to decrease or remain unchanged. Finally, all the original strategies and counterfactual strategies are combined to form a candidate strategy set used to test the differences in the effects of different parameter values ​​in the current scenario. Each strategy in this set corresponds to a complete set of parameter assignments in the subspace of parameters to be decided.

[0044] After constructing the candidate strategy set, the system drives the large language model to perform inferences. The system pairs the structured feature vectors of the current target database with each strategy in the strategy set, with each pair of feature vectors and strategies forming an independent inference unit. These inference units are submitted in batches to the locally deployed large language model. During submission, the system uses prompts to instruct the large language model to act as a database performance inference expert. For each inference unit, based on the system state described by the given feature vectors, the system infers how the key performance indicators of the database will change if the strategy is executed. The model needs to output structured inference conclusions for each inference unit, including expected performance ratings and confidence levels. The system collects and analyzes the inference conclusions of the large language model for all inference units.

[0045] The decision-making process in this embodiment is divided into two stages. The first stage deals with determining the parameter subspace, where the system directly adopts the recommended values ​​reached in historical cases. The second stage deals with the parameter subspace to be decided. The system first seeks emergent consensus; that is, for a given parameter, if a recommended value is predicted by the model with high confidence in more than half of the relevant inferences as bringing significant positive returns with controllable risk, then that value is adopted as the final recommended value. If no such strong consensus is formed, the system uses the principle of lowest risk, adopting the recommended value marked as having the lowest risk level in the model evaluation, or generating a conservative recommendation with verification conditions. Finally, the decision results of all subspaces are integrated to form a complete set of final recommended parameters. Simultaneously, key decision logic and attribution analysis are extracted from the inference conclusions and encapsulated together with the final recommended values ​​to generate structured reference cases.

[0046] Step 104: Input the historical tuning cases and / or reference cases, as well as the feature vectors, into the locally deployed large language model to obtain parameter tuning suggestions, and perform feedback calibration on the feature vector generation logic based on the execution effect corresponding to the parameter tuning suggestions.

[0047] In one implementation of this application, parameter adjustment items and associated adjustment logic contained in historical tuning cases and / or reference cases, as well as the bottleneck type and key performance indicators of the current database corresponding to the feature vectors, are assembled in a predefined structured format to obtain an input prompt context. The input prompt context is input to a locally deployed large language model, driving the model to perform an inference task. This inference task includes at least inferring the applicability of parameter adjustment suggestions from historical tuning cases and / or reference cases to the current specific scenario, and also includes generating parameter tuning suggestion entries item by item. Each suggestion entry includes at least one of the following: parameter name, current value, recommended value, adjustment range, adjustment reason, and expected effect. All parameter tuning suggestion entries generated by the locally deployed large language model are output as a structured parameter tuning suggestion report.

[0048] Specifically, the system receives historical tuning cases and / or reference cases generated through previous processes, as well as structured feature vectors from the current database. Following a pre-defined data structure template, it assembles these two pieces of information. First, it extracts a list of core parameter adjustment items and their key adjustment logic descriptions from the historical tuning cases and / or reference cases. Simultaneously, it parses the identified bottleneck type labels and the current values ​​of key performance indicators in abnormal states from the current feature vector. These elements, including parameter adjustment items, adjustment logic, bottleneck types, and current values ​​of key performance indicators, are organized into a structured data format according to a specific order and field identifiers. This format can be a JSON object, an XML document, or other predefined serialization form. This structured data body is encapsulated into a complete, context-rich input prompt. Through prompt word engineering, a reasoning task is explicitly assigned to the large language model, which includes two core sub-objectives. The first sub-objective is comprehensive evaluation, requiring the large language model to carefully analyze and judge the overall applicability, potential risks, and benefits of parameter adjustment suggestions proposed in the historical tuning cases and / or reference cases based on the current specific scenario information. The second sub-goal is item-by-item generation, requiring the large language model to output a structured suggestion for each parameter tuning item mentioned in the input context. Each suggestion must strictly include the parameter name, the parameter's current operating value in the target database, the final recommended tuning target value after evaluation, the specific adjustment range from the current value to the recommended value, a detailed explanation of the rationale for this adjustment, and a description of the expected performance effect after implementing this adjustment. After the large language model completes inference, it outputs a text containing a series of parameter tuning suggestion items. Upon receiving this output, the system first identifies and extracts each complete parameter tuning suggestion item from the output text. Then, it arranges these items according to the report template. Simultaneously, the system will populate the report's overview or summary section with some global analysis conclusions generated by the model during the comprehensive evaluation phase. Finally, a standardized and complete structured parameter tuning suggestion report is generated.

[0049] The optimization suggestions, which have been verified for safety, are compiled into a structured report, which includes parameter name, current value, recommended value, reason for adjustment and expected effect. The report is presented to the user in natural language. The user can choose to confirm and apply the suggestions to the target database automatically, or submit successful cases to the database to enrich the knowledge base.

[0050] In one implementation of this application, before outputting a structured parameter tuning suggestion report, the method further includes: querying the value range corresponding to the recommended parameters in a preset system configuration library, comparing the recommended values ​​with the value ranges, and marking recommended values ​​that do not conform to the value ranges as invalid; and / or, determining conflicting parameter combinations in the recommended parameter set based on a preset parameter dependency graph, and generating conflict alarms; and / or, comparing the similarity of the recommended parameter set with historical failed tuning cases, and generating risk alarms when the similarity is greater than a preset threshold.

[0051] Specifically, for different database types and versions, the system queries the system configuration database for the valid range of each parameter (e.g., max_connections must be >0 and ≤65536), and each parameter exceeding the range is marked as an invalid recommendation. A parameter dependency graph is maintained, and the recommended parameter set is traversed to detect conflicting parameter combinations (e.g., excessively large max_connections leading to reduced available shared_buffers space), triggering conflict alerts and providing avoidance suggestions. Historical failure cases are included in the conflict detection reference; when a new recommendation's similarity to a historical failure case exceeds a threshold, an alert is proactively issued, achieving dual protection of conflict detection and avoidance.

[0052] In one implementation of this application, after the optimization is completed, the system automatically calculates the performance improvement. If the improvement is lower than a preset threshold, the system sends the original feature vector of the optimization case back to the bottleneck identification module as a negative sample, so that it reduces the confidence of the corresponding bottleneck type in the next judgment under similar index distribution, thereby achieving adaptive calibration of feature extraction accuracy and continuously optimizing the identification accuracy without retraining the model.

[0053] Figure 2 A schematic diagram of a database parameter adjustment system architecture based on a local large language model is provided for embodiments of this application, such as... Figure 2As shown, the system consists of a three-layer architecture, from bottom to top: a data acquisition layer, a knowledge management layer, an intelligent inference layer, and a user interaction layer. The data acquisition layer obtains real-time operational metrics of the target database instance through query performance collectors, resource utilization collectors, and connection status collectors, and then structures and transmits these metrics upwards. The knowledge management layer, based on a local vector knowledge base, has its knowledge storage unit performing persistent storage, and its similarity retrieval unit quickly retrieving similar optimization records from historical cases based on feature vector matching. The intelligent inference layer, as the core decision engine, calls upon a local large language model, collaborating with the intent recognition unit, solution generation unit, and explanation generation unit to logically integrate the retrieval results and generate specific parameter optimization suggestions and natural language explanations. The user interaction layer provides a web graphical interface and a command-line interface, supporting users to initiate optimization requests and visually present the final results. Each layer interacts efficiently with the others through standardized interfaces, ensuring that the system can securely, efficiently, and adaptively optimize database performance continuously in the local environment.

[0054] Figure 3 This is a schematic diagram of the structure of a database parameter adjustment device based on a local large language model, provided as an embodiment of this application. Figure 3 As shown, a database parameter adjustment device 200 based on a local large language model includes: at least one processor 201; and a memory 202 communicatively connected to the at least one processor 201. The memory 202 stores instructions executable by the at least one processor 201, which, when executed by the at least one processor 201, enable the at least one processor 201 to: acquire performance metrics corresponding to the target database and convert the performance metrics into feature vectors reflecting the current database bottlenecks; wherein the feature vectors at least include a bottleneck type label and a confidence score for the metrics; and based on the bottleneck scenario complexity corresponding to the feature vectors, and / or The local vector knowledge base is configured with a case distribution density, and an adapted retrieval strategy is implemented to retrieve historical optimization cases from the local vector knowledge base. The representation structure of each historical optimization case includes at least one of the following: scene features, bottleneck type labels, optimization parameter set, execution effect, and constraints. Conflict analysis is performed on the retrieved historical optimization cases. If conflicts exist, a candidate strategy set is constructed based on the original strategy and counterfactual strategy, and the locally deployed large language model is driven to perform counterfactual inference to generate reference cases. The historical optimization cases and / or reference cases, along with feature vectors, are input into the locally deployed large language model to obtain parameter optimization suggestions.

[0055] This application provides a non-volatile computer storage medium storing computer-executable instructions. These instructions are configured to: acquire performance metrics corresponding to a target database and convert the performance metrics into feature vectors reflecting the current database bottlenecks; wherein the feature vectors at least include bottleneck type labels and confidence scores for the metrics; based on the bottleneck scenario complexity corresponding to the feature vectors and / or the case distribution density of the local vector knowledge base, execute an adapted retrieval strategy to retrieve historical optimization cases from the local vector knowledge base; wherein the representation structure of historical optimization cases includes at least one of scenario features, bottleneck type labels, optimization parameter sets, execution effects, and constraints; perform conflict analysis on the retrieved historical optimization cases; if conflicts exist, construct a candidate strategy set based on the original strategy and counterfactual strategy, and drive the locally deployed large language model to perform counterfactual inference to generate reference cases; input the historical optimization cases and / or reference cases, along with the feature vectors, into the locally deployed large language model to obtain parameter optimization suggestions.

[0056] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0057] The above descriptions are merely embodiments of this application and are not intended to limit the scope of this application. For those skilled in the art, various modifications and variations can be made to the embodiments of this application. These modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions in the embodiments of this application.

Claims

1. A database parameter adjustment method based on a local large language model, characterized in that, The method includes: Obtain the performance metrics corresponding to the target database and transform the performance metrics into feature vectors that reflect the current database bottlenecks; wherein, the feature vectors at least include bottleneck type labels and confidence scores of the metrics; Based on the bottleneck scenario complexity corresponding to the feature vector, or the case distribution density of the local vector knowledge base, an appropriate retrieval strategy is executed to retrieve historical optimization cases in the local vector knowledge base; wherein, the representation structure of the historical optimization cases includes at least one of the following: scenario features, bottleneck type labels, optimization parameter set, execution effect, and constraint conditions. If an appropriate retrieval strategy is executed based on the bottleneck scenario complexity corresponding to the feature vector, it specifically includes: The feature vector is mapped to a dense vector and matched with the scene feature vector field of each case in the local vector knowledge base to obtain the first similarity. The bottleneck type corresponding to the feature vector and the constraint information of the target database are matched with the bottleneck type label and constraint field of each case in the local vector knowledge base to obtain the second similarity. The first similarity and the second similarity are weighted and fused to obtain a preliminary comprehensive similarity, and a preliminary candidate case set is selected based on the preliminary comprehensive similarity. The feature vectors are converted into natural language queries that describe the current database bottlenecks. Semantic retrieval is performed on the local vector knowledge base based on the natural language queries, and the intersection of the retrieval results with the primary candidate case set is taken to obtain the enhanced candidate case set. The enhanced candidate case set is reordered using a semantic cross-encoder and a scenario adaptation strategy to obtain historical optimization cases. Based on the case distribution density of the local vector knowledge base, an adapted retrieval strategy is executed, specifically including: Based on the feature dimensions corresponding to the bottleneck type with a confidence score greater than a preset threshold, a bottleneck feature sub-vector is constructed. Using the bottleneck feature sub-vector as a query, the third similarity between the feature vector and each historical optimization case is determined in the local vector knowledge base. A set of reference candidate cases is selected based on the third similarity. For each historical case in the reference candidate case set, the corresponding parameter adjustment items are extracted; Based on the knowledge of the influence relationship between preset parameters, the database performance dimensions that have direct and indirect influence on the current parameter adjustment item are identified, and the expected strength of the effect of the adjustment item on each influence dimension is determined, so as to construct a weighted set of influence dimensions corresponding to the current historical case. The matching degree is calculated between the set of influence dimensions and the set of actual performance bottleneck dimensions corresponding to the current feature vector to obtain the transmission similarity corresponding to the current historical case. Based on the performance improvement values ​​corresponding to each historical case in the reference candidate case set, the effect weights are determined. The third similarity, the transmission similarity, and the effect weight are weighted and summed to obtain the comprehensive search score corresponding to each historical case. The reference candidate case set is reordered based on the comprehensive search score to obtain the historical optimization cases; Conflict analysis is performed on the retrieved historical optimization cases. If a conflict exists, a candidate strategy set is constructed based on the original strategy and the counterfactual strategy, and the locally deployed large language model is driven to perform counterfactual inference to generate reference cases. Input the historical tuning cases and / or reference cases, along with the feature vectors, into the locally deployed large language model to obtain parameter tuning suggestions. 2.The database parameter adjustment method based on a local large language model according to claim 1, wherein, The process of converting the performance metrics into feature vectors reflecting the current database bottleneck specifically includes: The performance indicators are analyzed based on performance benchmark thresholds to identify potential bottleneck types. Based on the deviation of the performance index from the performance benchmark threshold, the initial confidence score corresponding to each potential index bottleneck type is determined. The potential bottleneck type is matched with cases in the local vector knowledge base to obtain similar bottleneck type cases. The initial confidence score is then corrected based on the performance improvement recorded in the execution effect field of the similar bottleneck type cases to generate a dynamic confidence score. The performance metrics, the potential bottleneck types, and the dynamic confidence scores are encoded and concatenated into the feature vector. 3.The database parameter adjustment method based on local large language model according to claim 1, wherein, The step of reordering the enhanced candidate case set using a semantic cross-encoder and a scene adaptation strategy to obtain historical optimization cases specifically includes: The natural language query is paired with the field information corresponding to each case in the enhanced candidate case set and then input into the semantic cross-encoder, which outputs a semantic relevance score. In the enhanced candidate case set, the version and hardware configuration of the target database are identified, and cases that do not match the constraint fields are assigned descending scores. In the enhanced candidate case set, cases whose bottleneck type labels match the current bottleneck type label are identified, and a first ascending score is assigned to the matching cases; In the enhanced candidate case set, the optimization effect quantification value corresponding to each case is determined, and a second ascending score is set for the cases based on the optimization effect quantification value; Based on the semantic relevance score, the descending score, the first ascending score, and the second ascending score, the enhanced candidate case set is reordered to obtain historical optimization cases. 4.The database parameter adjustment method based on local large language model according to claim 1, wherein, The process of constructing a candidate strategy set based on the original strategy and counterfactual strategy, and driving a locally deployed large language model to perform counterfactual inference to generate reference cases, specifically includes: Identify the set of parameters with recommendation conflicts, and based on the inherent relationships between the parameters, divide the overall parameter space into a subspace of parameters to be decided and a subspace of parameters to be determined; For conflicting parameters in the subspace of the decision parameters, based on the original strategy with conflict, a counterfactual strategy with a different adjustment direction than the original strategy is generated, and a candidate strategy set is constructed based on the original strategy and the counterfactual strategy. The feature vector of the current target database is paired with each strategy in the candidate strategy set to generate multiple inference units; Drive the local large language model to perform counterfactual inference on the inference unit; Based on the counterfactual reasoning results and the pre-set emergent consensus and the principle of minimum risk, the final recommended value is determined, and the reference case is generated based on the reasoning logic and the final recommended value. 5.The database parameter adjustment method based on local large language model according to claim 1, wherein, The step of inputting the historical tuning cases and / or reference cases, along with the feature vectors, into the locally deployed large language model to obtain parameter tuning suggestions specifically includes: The parameter adjustment items and associated adjustment logic contained in the historical optimization cases and / or historical optimization cases and / or reference cases, as well as the bottleneck type and key performance indicators of the current database corresponding to the feature vector, are assembled in a predefined structured format to obtain the input prompt context. The input prompt context is input to the locally deployed large language model, driving the locally deployed large language model to perform an inference task; wherein, the inference task includes at least inferring the applicability of the current specific scenario based on parameter adjustment suggestions in the historical tuning cases and / or reference cases, and also includes generating parameter tuning suggestion items item by item; wherein, the suggestion item includes at least one of the following: parameter name, current value, recommended value, adjustment range, adjustment reason, and expected effect; The system outputs all parameter tuning suggestion entries generated by the locally deployed large language model as a structured parameter tuning suggestion report. 6.The database parameter adjustment method based on local large language model according to claim 5, wherein, Before the output is a structured parameter tuning suggestion report, the method further includes: The system queries the value range corresponding to the recommended parameter in the preset system configuration library, compares the recommended value with the value range, and marks the recommended value that does not conform to the value range as invalid. And / or, based on a preset dependency graph between parameters, determine the conflicting parameter combinations in the recommended parameter set and generate conflict alerts; And / or, compare the recommended parameter set with historical failed optimization cases for similarity, and generate a risk alarm when the similarity is greater than a preset threshold. 7.A database parameter adjustment device based on a local large language model, characterized by, The device includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to perform the method described in any one of claims 1-6.

8. A non-transitory computer storage medium storing computer-executable instructions that, when executed, cause a computer to: The computer-executable instructions are capable of performing the method described in any one of claims 1-6. ​