Intelligent detection method and device for database specification
By combining rule bases and large language models in database detection methods, the problem of standardization defects in database management is solved, enabling rapid and accurate detection and optimization suggestions in multi-database environments, thereby improving the efficiency and security of database management.
Patent Information
- Application Number
- CN202611233700.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-06
AI Technical Summary
Existing database management suffers from various deficiencies, including chaotic naming rules, inappropriate data type selection, unreasonable index design, inconsistent character set configuration, incomplete field comments, and lack of protection for sensitive data. These deficiencies lead to performance bottlenecks, data consistency issues, and security vulnerabilities. Furthermore, existing tools are difficult to adapt to multiple database environments and to provide differentiated customization.
By combining a rule base with a large language model, the system obtains a list of normative issues and a structural summary of the database through a scanning engine, performs deep reasoning using the large language model, generates intelligent detection results, and forms a closed-loop feedback through multi-dimensional human scoring, supporting unified detection and optimization suggestions for multiple database types.
It enables rapid and accurate detection of database specification issues, reduces reliance on senior engineers, improves detection accuracy and the credibility of optimization suggestions, and supports unified governance and differentiated needs across multiple database environments.
Smart Images

Figure CN123048540A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database management and artificial intelligence, and in particular to an intelligent detection method and apparatus for database specifications. Background Technology
[0002] In the development and operation of database application systems, due to differences in the technical skills of development teams, project deadlines, and a lack of unified development standards, many databases suffer from non-standard defects such as chaotic naming rules, inappropriate data type selection, unreasonable or missing index design, inconsistent character set configurations, incomplete field comments, and lack of protection for sensitive data. These defects may not be obvious in the early stages of system deployment, but as business scale expands and data volume continues to grow, they will gradually lead to performance bottlenecks, data consistency issues, and potential security vulnerabilities, seriously threatening the stable operation of the system and the credibility of data assets.
[0003] Specifically, the negative impacts of the aforementioned normative issues are mainly reflected in the following aspects: First, insufficient metadata governance capabilities. After the departure of table creators, database tables lacking binding by business owners and complete annotations become incomprehensible data "black boxes." New employees can only understand field semantics through manual guesswork, leading to a large number of duplicate and redundant tables. The same business data is stored in multiple locations, making data assets difficult to manage and trace effectively. Second, frequent database performance issues. Performance failures such as slow queries, table lock conflicts, and index failures often cause business interruptions, and the troubleshooting and repair cycles are long, posing a significant threat to business continuity. Third, the application of artificial intelligence technology in database optimization is limited. Due to the "illusion" problem of AI (Artificial Intelligence) models generating seemingly reasonable but actually erroneous suggestions, enterprises generally dare not directly apply AI models to database optimization operations in production environments, making it difficult to implement intelligent optimization technologies. Fourth, in the complete closed loop from problem discovery, investigation, resolution to summary, optimization experience highly depends on the individual abilities of senior engineers, lacking a systematic knowledge accumulation and reuse mechanism, causing similar problems to recur within the team.
[0004] Furthermore, existing database specification governance tools suffer from significant drawbacks, including insufficient multi-database adaptability and poor rule scalability. Most tools support only one or two mainstream databases, with limited or no support for databases such as PostgreSQL, Oracle, and SQL Server. This necessitates the use of multiple tools for separate checks in multi-database deployment environments, hindering the formation of a unified specification governance system. Simultaneously, the detection rules of existing tools are typically hard-coded into the program code. Adding or modifying detection items requires code modifications and redeployment, causing rule maintenance costs to rise sharply with the number of rules, making it difficult to meet the differentiated customization needs of different industries for database specifications. Summary of the Invention
[0005] The purpose of this application is to address at least one of the aforementioned technical deficiencies.
[0006] On the one hand, embodiments of this application provide an intelligent detection method for database specifications, the method comprising:
[0007] Retrieve detection rules from the rule base that match the target database type, and drive the scanning engine to perform normative queries on the target database based on the scanning script associated with the detection rules, to obtain a list of normative issues and a summary of the database structure;
[0008] Retrieve historical similar cases that match each list of normative issues from the experience base and obtain the rule base detection rules that each list of normative issues hits. Input each list of normative issues, database structure summary, historical similar cases and rule base detection rules into the large language model for deep reasoning to obtain intelligent detection results containing optimization suggestions. Assemble a dual evidence chain for each optimization suggestion, which includes a rule evidence chain and an experience evidence chain.
[0009] Obtain the multi-dimensional human scoring results corresponding to the intelligent detection results, and associate and store the intelligent detection results and multi-dimensional human scoring results in the experience base. At the same time, update the target database according to the intelligent detection results and multi-dimensional human scoring results to form a closed-loop feedback.
[0010] If the multi-dimensional human scoring results do not meet the preset iteration requirements, deep reasoning will be performed again based on the large language model until the multi-dimensional human scoring results meet the preset iteration requirements. Then, the final optimization report will be generated and output.
[0011] Optionally, each detection rule is defined in a structured JSON format. Each detection rule includes detection conditions, associated scan scripts, and reference standards. The scanning engine adopts an adapter pattern combined with an SPI (Serial Peripheral Interface) plug-in mechanism.
[0012] Optionally, the database structure summary is stored in JSONL format on the local file system. The directory structure of the database structure summary includes the database instance and scan time. The directory structure includes basic database information files, table list files, field list files, index list files, constraint list files, SQL (Structured Query Language) snapshot files, and slow query log files.
[0013] Optionally, the experience base includes vector data corresponding to each historical case. Historical similar cases are determined in the following ways:
[0014] The list of normative questions is concatenated into a query text, and a query vector corresponding to the query text is generated using the Embedding model;
[0015] Based on the approximate nearest neighbor algorithm, the initial historical similar cases corresponding to the query vector are retrieved from the vector data in the experience base, and the initial historical similar cases are filtered by combining metadata tags to obtain candidate historical similar cases.
[0016] Based on the preset weighted scoring conditions, each candidate historical similar case is weighted and scored to obtain the weighted score corresponding to each candidate historical similar case. Based on the weighted score corresponding to each candidate historical similar case, historical similar cases are determined from each candidate historical similar case.
[0017] Optionally, the large language model obtains intelligent detection results containing optimization suggestions through the following methods;
[0018] The list of normative issues is subjected to multi-dimensional testing to obtain the corresponding multi-dimensional testing results. The multi-dimensional testing includes consistency testing of related field types, detection of redundant tables, detection of different semantics for the same field name, and detection of the integrity of foreign key relationships.
[0019] By cross-referencing query patterns with table structures in the database structure summary based on SQL snapshot files and slow query log files, high-frequency JOIN patterns and missing indexes are obtained.
[0020] Risk assessment is conducted based on the database basic information file, table list file, field list file, index list file, and constraint list file to obtain the assessment results;
[0021] Based on multi-dimensional detection results, evaluation results, high-frequency JOIN patterns, and missing indexes, and combined with rule base detection rules and historical similar cases, business semantic reasoning is performed to obtain intelligent detection results containing optimization suggestions.
[0022] Optionally, the rule-based evidence chain includes knowledge number, rule path, matching conditions, evidence data, and reference standards; the empirical evidence chain includes the number of historical similar cases, historical adoption rate, average score, and case summary.
[0023] Optionally, the experience base adopts a two-layer architecture of structured layer and vector layer; the structured layer uses a relational database to store the experience record master table and the statistical aggregation table. The experience record master table includes experience identifier, associated rule base entry identifier, database type, original problem description, optimization suggestions, scores for each dimension, adoption status and feedback reason fields. The statistical aggregation table includes rule base entries, database type, cumulative number of industry dimension aggregation triggers, number of adoptions, adoption rate and average score; the vector layer uses a vector database to store the vector data corresponding to each historical case.
[0024] Optionally, the detection rules in the rule base are determined based on preset seed experience data. The score of each seed experience data is determined based on user feedback scores and decay factors. When the decay factor reaches a preset value, the source type of the seed experience data is automatically updated.
[0025] Optionally, the multi-dimensional human scoring result is a weighted average of the human scoring for accuracy, suggestion quality, evidence sufficiency, priority reasonableness, and business applicability. When the multi-dimensional human scoring result is lower than the preset score threshold, a human feedback report is obtained and displayed.
[0026] On the other hand, embodiments of this application provide an intelligent detection device for database specifications, including:
[0027] The rule detection module is used to obtain detection rules from the rule base that match the target database type, and drive the scanning engine to perform normative queries on the target database according to the scanning script associated with the detection rules, so as to obtain a list of normative issues and a database structure summary.
[0028] The model reasoning module is used to retrieve historical similar cases that match each list of normative questions from the experience base and to obtain the rule base detection rules that each list of normative questions hits. It then inputs each list of normative questions, the database structure summary, historical similar cases, and rule base detection rules into the large language model for deep reasoning, and obtains intelligent detection results containing optimization suggestions. It also assembles a dual evidence chain for each optimization suggestion, which includes a rule evidence chain and an experience evidence chain.
[0029] The manual review module is used to obtain the multi-dimensional manual scoring results corresponding to the intelligent detection results, and to associate and store the intelligent detection results and multi-dimensional manual scoring results in the experience base. At the same time, it updates the target database based on the intelligent detection results and multi-dimensional manual scoring results to form a closed-loop feedback.
[0030] The data iteration module is used to re-perform deep reasoning based on the large language model when the multi-dimensional human scoring results do not meet the preset iteration requirements, until the obtained multi-dimensional human scoring results meet the preset iteration requirements, and then generate and output the final optimization report.
[0031] In another aspect, embodiments of this application provide an electronic device, including a processor and a memory:
[0032] The memory is configured to store machine-readable instructions that, when executed by the processor, cause the processor to perform any of the intelligent detection methods in a database specification.
[0033] The beneficial effects of the technical solutions provided in this application include at least the following:
[0034] In this application, a rule base can be pre-configured. Then, a first-order normative query is performed on the target database based on this rule base to obtain a list of normative issues and a database structure summary. Since the detection rules in this rule base pre-define issues that can be written to the database, some issues can be detected quickly and accurately. Then, based on an experience base, deep reasoning is performed directly using a large language model, applying the AI model directly to database optimization operations in the production environment. Issues that cannot be written to the database are then identified, enabling further detection of various performance faults and ensuring comprehensive issue detection. Furthermore, because this process is based on a layered collaboration of rule scanning and large language model analysis, it avoids problems such as duplicate and redundant tables caused by manual guessing of field semantics. It also reduces reliance on the individual capabilities of senior engineers, ensuring effective management and traceability of data assets while rapidly detecting normative issues in the target database, further improving detection accuracy.
[0035] Furthermore, the optimization suggestions from the obtained intelligent detection results require multi-dimensional human scoring, and the intelligent detection results and multi-dimensional human scoring results are linked and stored in an experience base. This serves as a constraint when encountering similar problems in the future, ensuring that subsequent optimization suggestions are more accurate and applicable. The corresponding optimization suggestions all include rule-based evidence chains and experience-based evidence chains, ensuring that the optimization suggestions are verifiable and more in line with actual requirements.
[0036] Furthermore, since the detection rules in the rule base of this application are determined based on preset seed experience data, it ensures that the system's rule base has rich historical data support from the first use, and the seed experience score will gradually evolve with real user feedback, further improving the practical applicability of the rule base. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 A flowchart illustrating a database specification-based intelligent detection method provided in this application embodiment;
[0039] Figure 2 A schematic diagram of typical rules in the rule base provided for embodiments of this application;
[0040] Figure 3a A schematic diagram of a file directory provided for an embodiment of this application;
[0041] Figure 3b A schematic diagram of a JSON record provided in an embodiment of this application;
[0042] Figure 4 A schematic diagram of an experience record master table provided in an embodiment of this application;
[0043] Figure 5 A data illustration of an empirical statistical aggregation table provided in an embodiment of this application;
[0044] Figure 6 A schematic diagram illustrating data samples in a vector database provided in an embodiment of this application;
[0045] Figure 7 A schematic diagram illustrating a seed data source provided in an embodiment of this application;
[0046] Figure 8 A flowchart illustrating another intelligent detection method for database specifications provided in this application embodiment;
[0047] Figure 9 A schematic diagram of the structure of an intelligent detection device for database specifications provided in this application embodiment;
[0048] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0049] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting the invention.
[0050] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0051] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0052] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0053] Specifically, such as Figure 1 As shown, the method may include:
[0054] Step S101: Obtain the detection rules in the rule base that match the target database type, and drive the scanning engine to perform a normative query on the target database according to the scanning script associated with the detection rules to obtain a list of normative issues and a database structure summary.
[0055] The target database refers to the database that needs to be standardized. The rule library contains executable testing rules, each specifying what to check, how to scan, and how to make judgments. In practical applications, when standardization testing of a target database type is required, matching testing rules can be determined from the rule library. These rules are then loaded one by one, and the scanning engine, driven by the scanning script associated with the testing rules, performs a standardization query on the target database—that is, condition matching. When a match is found, the issue is output, resulting in a list of standardization issues and a database structure summary. Furthermore, since the rule library automatically drives the expansion of the scanning scope, adding new testing rules only requires adding entries to the rule library and configuring the scanning script; no modification to the scanning engine code is needed.
[0056] In other words, during this process, the system connects to the target database and performs a rule-by-rule compliance check based on the detection rules prepared in the rule base. For example, if there is a detection rule in the rule base that "the amount field cannot use the FLOAT type", the system will specifically check whether such a field exists in all tables of the target database. Each detection rule corresponds to a scan action, and the results are output directly after the scan is completed. This process does not require pulling down the entire database structure. After one scan, all issues that can be identified by predefined rules will be detected.
[0057] In an optional embodiment of this application, the database structure summary is stored in JSONL format on the local file system. The directory structure of the database structure summary includes the database instance and scan time. The directory structure includes a database basic information file, a table list file, a field list file, an index list file, a constraint list file, a running SQL snapshot file, and a slow query log file.
[0058] Optionally, after the scanning engine obtains the list of normative issues and the database structure summary, it stores the database structure summary as a structured local text file and organizes the directory by "database instance + scan time". This method allows both the scanning engine and the AI analysis engine to directly read the file content without intermediate database conversion. The directory structure is as follows: ├── database.txt # Basic database information (type, version, character set, etc.) ├── tables.txt # List of tables (table name, engine, number of rows, amount of data, comments, etc.) ├── columns.txt # List of fields (column names, types, precision, constraints, comments, etc.) ├── indexes.txt # Index list (index name, type, fields, etc.) ├── constraints.txt # List of constraints (primary key, foreign key, check, UNIQUE, etc.) ├── running_sql.txt # SQL snapshot in progress ├── slow_queries.txt # Slow query log └── summary.txt # Database structure summary
[0059] In this application, since each file is stored in JSON format, both readability and program parsing can be balanced. Furthermore, since summary.txt is a lightweight overview file, it can be read first during large language model analysis to understand the overall database.
[0060] In optional embodiments of this application, the rule-based evidence chain includes a knowledge number, rule path, matching conditions, evidence data, and reference standards; the experience-based evidence chain includes the number of historical similar cases, historical adoption rate, average score, and case summary.
[0061] Optionally, the rule-based evidence chain comes from the rule base and may specifically include knowledge numbers, rule paths, matching conditions, evidence data, and reference standards. The experience-based evidence chain is supported by historical data from the experience base and specifically includes the number of historical similar cases, historical adoption rates, average scores, case summaries, and related industries. In this application, because each optimization suggestion is accompanied by at least two evidence chains, the credibility and persuasiveness of the optimization suggestions can be further enhanced.
[0062] Step S102: Retrieve historical similar cases that match each list of normative issues from the experience base and obtain the rule base detection rules that each list of normative issues hits. Input each list of normative issues, database structure summary, historical similar cases and rule base detection rules into the large language model for deep reasoning to obtain intelligent detection results containing optimization suggestions. Assemble a dual evidence chain for each optimization suggestion. The dual evidence chain includes a rule evidence chain and an experience evidence chain.
[0063] The experience base contains complete records and statistical summaries of each analysis. Each record includes what problem was found, what suggestions the AI made, the score given by the human, whether the suggestions were adopted, and why they were rejected. Correspondingly, after obtaining the list of normative issues and the database structure summary, historical similar cases matching each normative issue list can be retrieved from the pre-set experience base. At the same time, the rule base detection rules that match each normative issue list are obtained. Then, the list of normative issues, the database structure summary, the historical similar cases, and the rule base detection rules are input into the large language model for deep reasoning to obtain optimization suggestions for the detected problems, and a dual evidence chain is assembled for each optimization suggestion.
[0064] In practical applications, after knowing the field list, indexes, constraints, slow query records, SQL snapshots, and detected rule-based issues for all tables, some issues cannot be written as a fixed rule in the rule base because they require understanding the relationships between tables, the semantic meaning of fields, and the SQL query patterns that only a large language model can infer. For example, both the `t_order` and `t_order_detail` tables have a `user_id` field, but one has a foreign key while the other does not, and the data types are different—one is `BIGINT UNSIGNED` and the other is `INT`. This presents a cross-table reference inconsistency problem that cannot be determined with a single SQL scan script; therefore, a large language model is needed for deep reasoning to resolve it.
[0065] In an optional embodiment of this application, the experience base includes vector data corresponding to each historical case, and historical similar cases are determined in the following ways:
[0066] The list of normative questions is concatenated into a query text, and a query vector corresponding to the query text is generated using the Embedding model;
[0067] Based on the approximate nearest neighbor algorithm, the initial historical similar cases corresponding to the query vector are retrieved from the vector data in the experience base, and the initial historical similar cases are filtered by combining metadata tags to obtain candidate historical similar cases.
[0068] Based on the preset weighted scoring conditions, each candidate historical similar case is weighted and scored to obtain the weighted score corresponding to each candidate historical similar case. Based on the weighted score corresponding to each candidate historical similar case, historical similar cases are determined from each candidate historical similar case.
[0069] Optionally, after obtaining the list of normative questions, the list can be concatenated into a query text, which is then input into the Embedding model to generate the corresponding query vector. The Embedding model has a 24-layer Transformer Encoder Block architecture, with 1024-dimensional hidden layers, 16 attention heads (64 dimensions each), a maximum input length of 512, and a 1024-dimensional token output vector. The number of parameters is approximately 335 million. Each Encoder Block's internal structure includes a multi-head self-attention layer, a residual connection layer, a feed-forward network layer, and a layer normalization layer.
[0070] Furthermore, based on the approximate nearest neighbor algorithm, the similarity between each vector data in the experience base and the query vector is determined. The historical cases corresponding to the vector data with similarity greater than the preset value are taken as the initial historical similar cases. The initial historical similar cases are filtered in combination with the preset metadata tags to filter out the initial historical similar cases that do not meet the metadata requirements, thus obtaining the candidate historical similar cases.
[0071] Correspondingly, scoring conditions corresponding to each type of score can be pre-set. Then, for each candidate historical similar case, a score can be assigned based on the scoring conditions corresponding to each type of score and the specific circumstances of each candidate historical similar case. This yields the scoring result for each candidate historical similar case corresponding to each type of score. The scoring result for each candidate historical similar case corresponding to each type of score is then weighted to obtain the weighted score for that candidate historical similar case. Finally, based on the weighted scores for each candidate historical similar case, the historical similar cases are determined from the candidate historical similar cases according to the score values.
[0072] In optional embodiments of this application, the large language model obtains intelligent detection results containing optimization suggestions in the following manner;
[0073] The list of normative issues is subjected to multi-dimensional testing to obtain the corresponding multi-dimensional testing results. The multi-dimensional testing includes consistency testing of related field types, detection of redundant tables, detection of different semantics for the same field name, and detection of the integrity of foreign key relationships.
[0074] By cross-referencing query patterns with table structures in the database structure summary based on SQL snapshot files and slow query log files, high-frequency JOIN patterns and missing indexes are obtained.
[0075] Risk assessment is conducted based on the database basic information file, table list file, field list file, index list file, and constraint list file to obtain the assessment results;
[0076] Based on multi-dimensional detection results, evaluation results, high-frequency JOIN patterns, and missing indexes, and combined with rule base detection rules and historical similar cases, business semantic reasoning is performed to obtain intelligent detection results containing optimization suggestions.
[0077] Optionally, after inputting the lists of normative issues, database structure summaries, historical similar cases, and the rule base detection rules into the large language model, the model can compare multiple lists of normative issues to identify problems that cannot be detected by a single table scan, thus obtaining corresponding multi-dimensional detection results. Specific analysis dimensions include: consistency of associated field types, redundant table detection, different semantics for the same field name, and integrity of foreign key relationships.
[0078] Furthermore, based on SQL snapshot files and slow query log files, the query patterns are cross-compared with the table structure in the database structure summary. It doesn't simply look at "which SQL is slow," but performs correlation reasoning in four dimensions: whether the JOIN combination is a high-frequency repetition at the architectural level, whether the WHERE condition field has an index, whether the ratio of scanned rows to returned rows is abnormal, whether the SELECT * can be narrowed, and high-frequency JOIN pattern identification, that is, discovering recurring multi-table JOIN combinations, assessing whether JOIN overhead can be reduced by widening the table, missing index inference, inferring potentially missing indexes based on the WHERE / ORDER BY / JOIN conditions of slow queries, and inferring architectural problems from the query pattern, etc., ultimately obtaining high-frequency JOIN patterns and missing indexes.
[0079] Correspondingly, this large language model reads natural language information from field and table comments based on the database's basic information file, table list file, field list file, index list file, and constraint list file. Then, it combines business domain knowledge to perform risk assessments, such as sensitive table security assurance, business integrity checks, and compliance risk assessments, to obtain assessment results. Finally, based on multi-dimensional detection results, assessment results, high-frequency JOIN patterns, and missing indexes, it combines rule base detection rules and historical similar cases to perform business semantic reasoning, resulting in intelligent detection results that include optimization suggestions.
[0080] The large language model in this application can be a generative language model based on the Transformer architecture. This model is an existing general model. In this application, the internal weights of the model are not modified. Instead, the inference ability of the model is called through the API interface to achieve the requirements of this application. Therefore, the specific description of the model structure and training process can be found in the prior art, and will not be repeated here.
[0081] Step S103: Obtain the multi-dimensional human scoring results corresponding to the intelligent detection results, and associate and store the intelligent detection results and multi-dimensional human scoring results in the experience database. At the same time, update the target database according to the intelligent detection results and multi-dimensional human scoring results to form a closed-loop feedback.
[0082] Optionally, after obtaining the intelligent detection results, the results can be scored by human evaluation in multiple dimensions. In order to improve the accuracy of the inspection and the accuracy of the suggestions, the intelligent detection results and the multi-dimensional human evaluation results can be associated and stored in the experience base. At the same time, the target database can be updated according to the intelligent detection results and the multi-dimensional human evaluation results to form a closed-loop feedback, thereby improving the subsequent accuracy.
[0083] In an optional example of this application, the multi-dimensional human scoring result is a weighted average of the human scoring for accuracy, recommendation quality, evidence sufficiency, priority reasonableness, and business applicability. The specific scores are shown in the table below:
[0084] Rating Dimensions Score illustrate accuracy 1-5 Is the problem diagnosis accurate? Does this problem actually exist? Recommended quality 1-5 Are the proposed optimization suggestions feasible and optimal? Sufficient evidence 1-5 Is the chain of evidence convincing? Priority rationality 1-5 Are the issues prioritized reasonably? Business Applicability 1-5 Is the suggestion suitable for the current business scenario? Overall score Automatic calculation Weighted average (accuracy weight 0.3, suggested quality weight 0.25, and the rest 0.15 each)
[0085] Optionally, to better understand the problems existing in the current target database and improve the accuracy of the optimization suggestions obtained from the analysis, this application can also obtain and display a human feedback report when the multi-dimensional human scoring results are lower than a preset score threshold. Furthermore, the human feedback report is saved to the experience base and marked as a "negative sample" for subsequent optimization and adjustment of prompt words in the AI model.
[0086] For example, when the multi-dimensional human evaluation score is lower than or equal to 3 points, the system mandates that the reviewer fill in the feedback reasons to form a human feedback report, which is then displayed. The feedback reasons are categorized as follows:
[0087] category meaning illustrate A False Positive This problem does not exist in the current scenario. B The suggestion is not feasible. The suggestion cannot be implemented in the current environment. C Insufficient evidence The chain of evidence is insufficient. D Inappropriate priority Too high or too low priority E Business Conflict The suggestion contradicts business needs. F other Custom description
[0088] Step S104: If the multi-dimensional human scoring results do not meet the preset iteration requirements, deep reasoning is performed again based on the large language model until the obtained multi-dimensional human scoring results meet the preset iteration requirements, then the final optimization report is generated and output.
[0089] Optionally, for the obtained multi-dimensional human evaluation results, if the reviewer believes that the current optimization suggestions are not good enough, i.e., they do not meet the preset iteration requirements, deep reasoning can be performed again based on the large language model until the obtained multi-dimensional human evaluation results meet the preset iteration requirements, at which point the final optimization report can be generated and output.
[0090] When the multi-dimensional manual scoring results do not meet the preset iteration requirements, the AI Prompt can be adjusted to add constraints. Then, the priority weights can be readjusted based on the rejection reasons given by the user. Low-scoring records in the experience base will receive higher "exclusion weights" in this analysis. It is recommended to set the maximum number of iterations to 3. Exceeding this limit will force the generation of the final optimization report, and the iteration count will be recorded in the experience base. The standard structure of the final optimization report includes the following:
[0091] Fields illustrate report_id Report unique identifier generated_at Generation time database_profile Database profile information summary.total_issues Total number of questions summary.critical / high / medium / low Distribution by severity optimization_items Optimization suggestion list (each item includes problem description, location, suggestion, fix SQL, evidence chain, impact analysis, etc.) iteration_count Number of iterations human_review_notes Manual review notes
[0092] The final optimization report includes various optimization suggestions. Each optimization suggestion (optimization_item) contains: item_id (suggestion number), severity, category, issue (issue description), location (issue location, such as t_order.price), suggestion, fix_sql (fix SQL), evidence_chains (dual evidence chains), confidence (AI confidence), experience_support (experience data support, including the number of similar cases and adoption rate), impact_analysis (impact analysis), and rollback_plan (rollback plan).
[0093] In optional embodiments of this application, each detection rule is defined in a structured JSON format. Each detection rule includes detection conditions, associated scanning scripts, and reference standards. The scanning engine adopts an adapter pattern combined with an SPI plug-in mechanism.
[0094] Optionally, the scanning framework of the scanning engine in this application adopts the Adapter Pattern combined with the SPI plug-in mechanism and is configured with a unified scanning adapter interface, thereby supporting unified access to multiple databases, such as the databases shown in the table below:
[0095] adapter Supported databases MySQLAdapter MySQL 5.7 / 8.0+ PostgreSQLAdapter PostgreSQL 10+ OracleAdapter Oracle 11g+ SQLServerAdapter SQL Server 2016+ DMAdapter Dameng Database GBaseAdapter Nanda General
[0096] In addition, the scanning engine includes a scan scheduler that supports full scans and incremental scans, as well as a structure summary generator, which can automatically generate database structure summaries during the scanning process for subsequent AI analysis.
[0097] In optional embodiments of this application, the experience base adopts a two-layer architecture of a structured layer and a vector layer. The structured layer uses a relational database to store the experience record master table and the statistical aggregation table. The experience record master table includes experience identifier, associated rule base entry identifier, database type, original problem description, optimization suggestions, scores for each dimension, adoption status, and feedback reason fields. The statistical aggregation table includes rule base entries, database type, cumulative number of industry dimension aggregation triggers, number of adoptions, adoption rate, and average score. The vector layer uses a vector database to store the vector data corresponding to each historical case.
[0098] Optionally, the experience base adopts a two-layer architecture of a structured layer and a vector layer. The structured layer uses a relational database to store the experience record master table and the statistical aggregation table. The experience record master table (experience_record) records the complete context of each round of analysis, specifically containing 25 fields. Core fields include: experience ID, session ID, association rule base entry ID, database type and version, database profile summary, original problem description, AI optimization suggestions, repair SQL, AI inference process record, AI confidence score, human ratings across five dimensions, overall score, whether adopted, low-score feedback category and details, feedback tags, data source type, seed source ID, and recording time. The experience statistical aggregation table (experience_statistics) aggregates statistical data by rule base entry, database type, and industry dimension. Core fields include: association rule base entry, industry category, cumulative trigger count, adoption count, adoption rate, average score, score distribution, common feedback summary, and confidence weight. The database profile table (db_profile) records the structural characteristics of each database instance. The core fields include: instance ID, database type and version, industry, number of tables, total number of fields, total data volume, average number of rows per table, maximum number of tables, index coverage, character set distribution, storage engine distribution, common query patterns, and business tags.
[0099] Optionally, the workflow of this experience base can be divided into five stages, specifically including:
[0100] Data entry phase: After each round of analysis, the multi-dimensional manual scoring results, along with the context, are written into the experience record table;
[0101] Aggregation phase: Regularly or in real time update the statistical aggregation table and calculate the adoption rate, average score, etc. of each rule;
[0102] Vectorization stage: The experience records are concatenated into a structured summary, vectors are generated through the Embedding model and stored in a vector database;
[0103] Retrieval Phase: When a new round of analysis begins, based on the currently scanned questions, semantically similar historical experiences are retrieved from the vector database. High-scoring experiences are used as "positive references," and low-scoring experiences are used as "negative constraints" and input into the large language model.
[0104] Feedback Update Phase: After the scoring and feedback are written back, the vector and statistical aggregation data are updated synchronously.
[0105] Optionally, in practical applications, the experience base utilizes a vectorization and semantic retrieval mechanism. Vectorization is the core technology for achieving "experience reuse" and "intelligent recommendation." Its goal is not to store raw scan data, but to transform readable experience records into machine-retrievalable semantic vectors, enabling the system to "recall" past experiences handling similar scenarios when facing new problems. Accordingly, when each experience record is entered into the database, the system concatenates its key text fields into a structured summary text (Experience Summary) as vectorization input. The summary template includes: scenario (database type, version, industry, scale), problem (original problem description), optimization suggestions, repair SQL, results, and feedback classification details, etc.
[0106] In the generation and storage of vector data corresponding to each historical case, text embedding models such as text-embedding and BGE series can be used to convert the experience summary text into high-dimensional vectors. The generated vectors, along with the experience record ID and metadata tags, are then stored in a vector database. Simultaneously, scalar filtering indexes are established for tag fields such as db_type and industry, thereby supporting hybrid retrieval based on "vector similarity + tag filtering." This reduces computational load while ensuring the effectiveness of search results.
[0107] In this application, the vectors in the experience database can be continuously updated. When each new experience record is added to the database, a vector can be generated in real time and inserted into the vector database without the need for a full reconstruction. Furthermore, a time decay weight is set for the experience records to ensure that recent experiences have a higher weight in the retrieval and ranking. At the same time, experience records with long-term low scores or that have not been referenced for a long time can be marked as archived and removed from the active vector index, thereby ensuring the effectiveness of the experiences in the experience database.
[0108] In an optional example of this application, the detection rules in the rule base are determined based on preset seed experience data. The score of each seed experience data is determined based on user feedback scores and a decay factor. When the decay factor reaches a preset value, the source type of the seed experience data is automatically updated.
[0109] The seed data source table records the metadata of each seed experience data source, including 15 fields: source ID, source name, source type, publisher, source link, version number, import time, import method, number of import rules, applicable database type, knowledge category involved, credibility score, last synchronization time, status, and description.
[0110] Optionally, the seed experience data employs a pre-population mechanism, specifically including:
[0111] Import phase: During system initialization, the rule content in the seed source is converted into experience record format, and the source_type is marked as seed_data;
[0112] Initial rating: The initial overall rating for each seed experience data point was set to 4.0, and the AI confidence level was set to 0.75;
[0113] Rating Evolution: As real user feedback accumulates, the rating of seed experience data will be gradually revised based on user evaluations;
[0114] Evolutionary marker: When a seed experience is covered by enough real feedback, such as more than 10 real ratings, the source_type is automatically updated to system_evolved;
[0115] Statistical pre-population: The empirical statistical aggregation table is synchronously pre-populated with industry-level statistical data.
[0116] The score for each seed experience data point is determined based on user feedback scores and a decay factor. The evolution formula for the seed experience data score is: Final Score = Seed Score × (1 - Decay Factor) + User Feedback Score × Decay Factor. The decay factor is calculated as min(Number of Real Feedback Counts / Full Evolution Threshold, 1.0), with a recommended full evolution threshold of 10. When the decay factor reaches a preset value (e.g., 1.0), the influence of the seed score completely disappears, and the score is entirely determined by real user feedback. At this point, the source type of the seed experience data is automatically updated.
[0117] Optionally, to better understand the solutions in the embodiments of this application, the following explains, from the perspective of storage implementation, where the data of each component in the system is specifically stored, in what format it is stored, and how it flows between each step, in conjunction with the data storage architecture and flow. The storage media in this application are shown in the table below:
[0118] rule base Relational database (MySQL) Structured Tables The main table for the rule base (rule_knowledge_base, 19 fields) + the industry naming convention table (naming_convention) Manual maintenance, loaded at system startup Scan result file Local file system JSONL text file (one JSON string per line) Database metadata snapshot (tables, fields, indexes, constraints, SQL) + rule hit results + structure summary Real-time writing during scanning Experience base (structured layer) Relational database (MySQL) Structured Tables experience_record (25 fields) + experience_statistics + db_profile + seed_data_source Write when experience is added to the database Experience base (vector layer) Vector database (Milvus) High-dimensional vectors + metadata tags The embedding vector of experience records supports semantic retrieval and metadata filtering. Generated asynchronously by the Embedding model during data insertion.
[0119] The experience base is not a single storage unit, but rather a two-layer architecture consisting of a structured layer and a vector layer. The structured layer stores raw records, while the vector layer stores semantic indexes. The data in the two layers corresponds one-to-one, and is updated synchronously during writes. The data read / write relationships for each step are shown in the table below:
[0120] scanning Detection rules in the rule base + scanning script Scan result file (JSONL) Rule base → Local files AI analysis Scan results file + experience base (Top-K similar cases for vector retrieval) + S1 hit rule entries (only hit items, not the full list) Optimization suggestion list (including dual evidence chains) Reading: File + Vector Library + Rule Library; Output temporary storage in memory. score Optimization suggestion list Rating results + reasons for feedback Temporarily store in memory and then transfer to the database. Warehousing Analysis results + rating feedback Add new experience records + Update vector index + Update statistical aggregation + Seed experience evolution Experience base (structured layer) + Experience base (vector layer) Seed prefilling Seed data source table (seed_data_source) Initial experience record (initial rating 4.0, confidence level 0.75) Experience base (structured layer + vector layer), system initialization or manual triggering
[0121] Optionally, to better understand "what kind of data is stored in each storage device", the following provides examples of actual data from the four types of storage media.
[0122] like Figure 2As shown in the figure, this diagram illustrates 10 typical rules in the main table of the rule base. Each rule includes a knowledge number, applicable database type, category, description of the check item, severity indicated by different colors, source of the reference standard, and whether it can be automatically corrected.
[0123] like Figure 3a As shown, the Figure 3a This is a directory of files generated from a single scan, organized by "Instance ID + Scan Time". It contains eight files: basic database information, table list, field list, indexes, constraints, SQL snapshot, slow query log, and structure summary. Figure 3b Here is an example of the actual content of tables.txt—each line contains one JSON record, including fields such as table name, engine, number of rows, data volume, comments, and character set.
[0124] like Figure 4 As shown in the diagram, this chart displays nine records in the main experience record table. The four records with a light blue background are seed experiences, while the five records with a white background are real user feedback records. High-scoring adoption records and low-scoring rejection records form a stark contrast, with the rating column marked with green / yellow / red to indicate high, medium, and low scores.
[0125] like Figure 5 As shown in the figure, this chart illustrates the data from the experience statistics aggregation table. Each record is aggregated and statistically analyzed by the dimensions of "rule + database type + industry." For example, "use FLOAT for amount" was triggered 25 times, adopted 22 times, with an adoption rate of 88% and an average score of 4.7 in the e-commerce industry; while in the financial industry, it was adopted 100%. In contrast, the adoption rate of "regional suggestions" was only 40%, indicating that AI still needs to learn in this type of problem.
[0126] like Figure 6 As shown in the figure, this diagram illustrates a data example from the vector database. Each record contains metadata tags such as vector ID, corresponding experience record ID, high-dimensional vector, database type, and industry. During retrieval, the top-K historical similarities and cases are returned by combining vector similarity (cosine) with metadata tag filtering and time decay weighting. The light blue background represents seed experience vectors, and the white / purple background represents user feedback experience vectors.
[0127] like Figure 7 As shown in the figure, this diagram illustrates the eight authoritative sources in the seed data source table. Each source records information such as the number of import rules, applicable database type, and status. During system initialization, the best practices from these sources are automatically converted into seed experience records.
[0128] In this application, a rule base can be pre-configured. Then, a first-order normative query is performed on the target database based on the rule base to obtain a list of normative issues and a database structure summary. Since the detection rules in the rule base pre-define the issues in the database that can be written into rules, some issues can be detected quickly and accurately. Then, based on an experience base and a large language model, deep reasoning is performed to uncover issues that cannot be written into rules, ensuring comprehensive issue detection. In other words, the hierarchical collaboration between rule scanning and large language model analysis in this application can both quickly detect normative issues in the target database and further improve detection accuracy.
[0129] Furthermore, the optimization suggestions from the obtained intelligent detection results require multi-dimensional human scoring, and the intelligent detection results and multi-dimensional human scoring results are linked and stored in an experience base. This serves as a constraint when encountering similar problems in the future, ensuring that subsequent optimization suggestions are more accurate and applicable. The corresponding optimization suggestions all include rule-based evidence chains and experience-based evidence chains, ensuring that the optimization suggestions are verifiable and more in line with actual requirements.
[0130] Furthermore, since the detection rules in the rule base of this application are determined based on preset seed experience data, it ensures that the system's rule base has rich historical data support from the first use, and the seed experience score will gradually evolve with real user feedback, further improving the practical applicability of the rule base.
[0131] Optionally, to better understand the method provided in the embodiments of this application, the method will be described again below with reference to Figure 8. Specifically:
[0132] Step S1, rule-based targeted scanning, which can output a defined list of questions and a database structure summary, which is stored in a local text file;
[0133] Step S2: AI intelligent analysis, specifically based on LLM (Large Language Model) and RAG (Retrieval-Augmented Generation) experience base semantic retrieval, outputs a list of optimization suggestions, each optimization suggestion contains two chains of evidence;
[0134] Step S3: Conduct multi-dimensional manual scoring and feedback, such as requiring a feedback reason to be filled in when the score is less than or equal to 3.
[0135] Step S4 involves storing the experience in the database and updating it into vectors, which specifically includes writing feedback, evolving planting experience, updating statistics, and generating vectors.
[0136] Step S5: Determine whether the final optimization list has been generated. If yes, proceed to step S6; otherwise, proceed to step S2.
[0137] Step S6: Generate the final optimization list and output a structured report.
[0138] This application provides an intelligent detection device for database specifications, such as... Figure 9 As shown, the device may include: a rule detection module 901, a model reasoning module 902, a human review module 903, and a data iteration module 904, wherein...
[0139] The rule detection module is used to obtain detection rules from the rule base that match the target database type, and drive the scanning engine to perform normative queries on the target database according to the scanning script associated with the detection rules, so as to obtain a list of normative issues and a database structure summary.
[0140] The model reasoning module is used to retrieve historical similar cases that match each list of normative questions from the experience base and to obtain the rule base detection rules that each list of normative questions hits. It then inputs each list of normative questions, the database structure summary, historical similar cases, and rule base detection rules into the large language model for deep reasoning, and obtains intelligent detection results containing optimization suggestions. It also assembles a dual evidence chain for each optimization suggestion, which includes a rule evidence chain and an experience evidence chain.
[0141] The manual review module is used to obtain the multi-dimensional manual scoring results corresponding to the intelligent detection results, and to associate and store the intelligent detection results and multi-dimensional manual scoring results in the experience base. At the same time, it updates the target database based on the intelligent detection results and multi-dimensional manual scoring results to form a closed-loop feedback.
[0142] The data iteration module is used to re-perform deep reasoning based on the large language model when the multi-dimensional human scoring results do not meet the preset iteration requirements, until the obtained multi-dimensional human scoring results meet the preset iteration requirements, and then generate and output the final optimization report.
[0143] Optionally, each detection rule is defined in a structured JSON format. Each detection rule includes detection conditions, associated scanning scripts, and reference standards. The scanning engine adopts an adapter pattern combined with an SPI plug-in mechanism.
[0144] Optionally, the database structure summary is stored in JSONL format on the local file system. The directory structure of the database structure summary includes the database instance and scan time. The directory structure contains basic database information files, table list files, field list files, index list files, constraint list files, running SQL snapshot files, and slow query log files.
[0145] Optionally, the experience base includes vector data corresponding to each historical case. Historical similar cases are determined in the following ways:
[0146] The list of normative questions is concatenated into a query text, and a query vector corresponding to the query text is generated using the Embedding model;
[0147] Based on the approximate nearest neighbor algorithm, the initial historical similar cases corresponding to the query vector are retrieved from the vector data in the experience base, and the initial historical similar cases are filtered by combining metadata tags to obtain candidate historical similar cases.
[0148] Based on the preset weighted scoring conditions, each candidate historical similar case is weighted and scored to obtain the weighted score corresponding to each candidate historical similar case. Based on the weighted score corresponding to each candidate historical similar case, historical similar cases are determined from each candidate historical similar case.
[0149] Optionally, the large language model obtains intelligent detection results containing optimization suggestions through the following methods;
[0150] The list of normative issues is subjected to multi-dimensional testing to obtain the corresponding multi-dimensional testing results. The multi-dimensional testing includes consistency testing of related field types, detection of redundant tables, detection of different semantics for the same field name, and detection of the integrity of foreign key relationships.
[0151] By cross-referencing query patterns with table structures in the database structure summary based on SQL snapshot files and slow query log files, high-frequency JOIN patterns and missing indexes are obtained.
[0152] Risk assessment is conducted based on the database basic information file, table list file, field list file, index list file, and constraint list file to obtain the assessment results;
[0153] Based on multi-dimensional detection results, evaluation results, high-frequency JOIN patterns, and missing indexes, and combined with rule base detection rules and historical similar cases, business semantic reasoning is performed to obtain intelligent detection results containing optimization suggestions.
[0154] Optionally, the rule-based evidence chain includes knowledge number, rule path, matching conditions, evidence data, and reference standards; the empirical evidence chain includes the number of historical similar cases, historical adoption rate, average score, and case summary.
[0155] Optionally, the experience base adopts a two-layer architecture of structured layer and vector layer; the structured layer uses a relational database to store the experience record master table and the statistical aggregation table. The experience record master table includes experience identifier, associated rule base entry identifier, database type, original problem description, optimization suggestions, scores for each dimension, adoption status and feedback reason fields. The statistical aggregation table includes rule base entries, database type, cumulative number of industry dimension aggregation triggers, number of adoptions, adoption rate and average score; the vector layer uses a vector database to store the vector data corresponding to each historical case.
[0156] Optionally, the detection rules in the rule base are determined based on preset seed experience data. The score of each seed experience data is determined based on user feedback scores and decay factors. When the decay factor reaches a preset value, the source type of the seed experience data is automatically updated.
[0157] Optionally, the multi-dimensional human scoring result is a weighted average of the human scoring for accuracy, suggestion quality, evidence sufficiency, priority reasonableness, and business applicability. When the multi-dimensional human scoring result is lower than the preset score threshold, a human feedback report is obtained and displayed.
[0158] The intelligent database specification detection device of this embodiment can execute the intelligent database specification detection method shown in the embodiment of this application. The implementation principle is similar and will not be described again here.
[0159] This application provides an electronic device, which includes: a processor; and a memory configured to store machine-readable instructions that, when executed by the processor, cause the processor to perform a database specification intelligent detection method.
[0160] This application provides an electronic device, such as... Figure 10 As shown, Figure 10 The illustrated electronic device includes a processor 2001 and a memory 2003. The processor 2001 and the memory 2003 are connected, for example, via a bus 2002. Optionally, the electronic device 2000 may further include a transceiver 2004. It should be noted that in practical applications, the transceiver 2004 is not limited to one type, and the structure of this electronic device 2000 does not constitute a limitation on the embodiments of this application.
[0161] Processor 2001 may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA, or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 2001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0162] Bus 2002 may include a pathway for transmitting information between the aforementioned components. Bus 2002 may be a PCI bus or an EISA bus, etc. Bus 2002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0163] The memory 2003 may be ROM or other type of static storage device capable of storing static information and instructions, RAM or other type of dynamic storage device capable of storing information and instructions, or EEPROM, CD-ROM or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0164] The memory 2003 stores the application code that executes the scheme of this application, and its execution is controlled by the processor 2001. The processor 2001 executes the application code stored in the memory 2003 to implement... Figure 10 The operation of the different XXX device provided in the illustrated embodiment.
[0165] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0166] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A database-standard intelligent detection method, characterized in that, include: Obtain detection rules from the rule base that match the target database type, and drive the scanning engine to perform a normative query on the target database based on the scanning script associated with the detection rules to obtain a list of normative issues and a database structure summary; Retrieve historical similar cases that match each of the normative question lists from the experience base and obtain the rule base detection rules that each of the normative question lists hits. Input each of the normative question lists, the database structure summary, the historical similar cases, and the rule base detection rules into a large language model for deep reasoning to obtain intelligent detection results containing optimization suggestions. Assemble a dual evidence chain for each optimization suggestion, the dual evidence chain including a rule evidence chain and an experience evidence chain. Obtain the multi-dimensional human scoring results corresponding to the intelligent detection results, and associate and store the intelligent detection results and the multi-dimensional human scoring results in the experience base. At the same time, update the target database according to the intelligent detection results and the multi-dimensional human scoring results to form a closed-loop feedback. If the multi-dimensional human scoring results do not meet the preset iteration requirements, deep reasoning will be performed again based on the large language model until the obtained multi-dimensional human scoring results meet the preset iteration requirements, then the final optimization report will be generated and output.
2. The method according to claim 1, characterized in that, Each detection rule is defined in a structured JSON format. Each detection rule includes detection conditions, associated scanning scripts, and reference standards. The scanning engine adopts an adapter pattern combined with an SPI plug-in mechanism.
3. The method according to claim 2, characterized in that, The database structure summary is stored in JSONL format on the local file system. The directory structure of the database structure summary includes the database instance and scan time. The directory structure contains basic database information files, table list files, field list files, index list files, constraint list files, SQL snapshot files, and slow query log files.
4. The method according to claim 1, characterized in that, The experience base includes vector data corresponding to each historical case, and the historical similar cases are determined in the following ways: The list of normative questions is concatenated into a query text, and a query vector corresponding to the query text is generated using the Embedding model; Based on the approximate nearest neighbor algorithm, each initial historical similar case corresponding to the query vector is retrieved from the vector data in the experience base, and each initial historical similar case is filtered in combination with metadata tags to obtain each candidate historical similar case; The candidate historical similar cases are weighted according to the preset weighted scoring conditions to obtain the weighted score corresponding to each candidate historical similar case, and the historical similar cases are determined from each candidate historical similar case based on the weighted score corresponding to each candidate historical similar case.
5. The method according to claim 3, characterized in that, The large language model obtains the intelligent detection results containing optimization suggestions in the following ways; The list of normative issues is subjected to multi-dimensional detection to obtain the corresponding multi-dimensional detection results. The multi-dimensional detection includes consistency detection of related field types, redundancy detection, different semantics of the same field name, and integrity detection of foreign key relationships. Based on the SQL snapshot file and the slow query log file, the query pattern is cross-compared with the table structure of the database structure summary to obtain the high-frequency JOIN pattern and missing indexes. A risk assessment is performed based on the database basic information file, the table list file, the field list file, the index list file, and the constraint list file to obtain the assessment results; Based on the multi-dimensional detection results, the evaluation results, the high-frequency JOIN pattern, and the missing index, business semantic reasoning is performed in conjunction with the rule base detection rules and the historical similar cases to obtain the intelligent detection results containing optimization suggestions.
6. The method according to claim 1, characterized in that, The rule-based evidence chain includes knowledge number, rule path, matching conditions, evidence data, and reference standards; the empirical evidence chain includes the number of historical similar cases, historical adoption rate, average score, and case summary.
7. The method according to claim 3, characterized in that, The experience base adopts a two-layer architecture of structured layer and vector layer; the structured layer uses a relational database to store the experience record master table and the statistical aggregation table. The experience record master table includes experience identifier, associated rule base entry identifier, database type, original problem description, optimization suggestions, scores for each dimension, adoption status, and feedback reason fields. The statistical aggregation table includes rule base entries, database type, cumulative number of industry dimension aggregation triggers, number of adoptions, adoption rate, and average score; the vector layer uses a vector database to store the vector data corresponding to each historical case.
8. The method according to claim 1, characterized in that, The detection rules in the rule base are determined based on preset seed experience data. The score of each seed experience data is determined based on user feedback scores and a decay factor. When the decay factor reaches a preset value, the source type of the seed experience data is automatically updated.
9. The method according to claim 1, characterized in that, The multi-dimensional human scoring result is a weighted average of the accuracy score, suggestion quality score, evidence sufficiency score, priority reasonableness score, and business applicability score. When the multi-dimensional human scoring result is lower than a preset score threshold, a human feedback report is obtained and displayed.
10. A database-standard intelligent detection device, characterized in that, include: The rule detection module is used to obtain detection rules from the rule base that match the target database type, and drive the scanning engine to perform normative queries on the target database according to the scanning script associated with the detection rules, so as to obtain a list of normative issues and a database structure summary. The model reasoning module is used to retrieve historical similar cases that match each of the normative question lists from the experience base and obtain the rule base detection rules that each of the normative question lists hits. The module then inputs each of the normative question lists, the database structure summary, the historical similar cases, and the rule base detection rules into the large language model for deep reasoning to obtain intelligent detection results containing optimization suggestions. Finally, the module assembles a dual evidence chain for each optimization suggestion, which includes a rule evidence chain and an experience evidence chain. The manual review module is used to obtain the multi-dimensional manual scoring results corresponding to the intelligent detection results, and associate and store the intelligent detection results and the multi-dimensional manual scoring results in the experience base. At the same time, it updates the target database according to the intelligent detection results and the multi-dimensional manual scoring results to form a closed-loop feedback. The data iteration module is used to perform deep reasoning again based on the large language model when the multi-dimensional human scoring results do not meet the preset iteration requirements, until the obtained multi-dimensional human scoring results meet the preset iteration requirements, and then generate and output the final optimization report.
