Model-accelerated database retrieval optimization system and method based on knowledge graph
By building a real-time updated multi-level knowledge graph and high-frequency pre-cache sub-database in a distributed database, combining path generation and reinforcement learning models, the problem of low retrieval efficiency in a distributed database environment is solved, and fast query and efficient data are achieved access.
Patent Information
- Application Number
- CN202411528003.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-10-30
AI Technical Summary
In a complex and huge distributed database environment, it is difficult for the prior art to improve retrieval efficiency and reduce latency while balancing the load.
Using a model-based knowledge graph-accelerated database search optimization system, the system uses a prediction model to build a real-time updated distributed multi-level knowledge graph, combined with a path generation algorithm and a high-frequency pre-cache sub-database, and pre-loads the high-frequency query results with the prediction model, and pre-loads the high-frequency query results in Provide real-time recommendation and path selection units during querying to determine the optimal query path to quickly return results.
It significantly improves database retrieval speed and user experience, and uses the intelligent graph module to understand data relevance in advance, pre-generate query paths, reduce query delays, and optimize path selection through high-frequency pre-cache and reinforcement learning models, improving query efficiency and accuracy .
Smart Images

Figure CN119046315B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of database optimization, and in particular to a system and method for accelerating database retrieval optimization based on a knowledge graph model. Background Art
[0002] With the advent of the big data era, the amount of data is growing explosively, and database systems are facing unprecedented challenges, especially in terms of data retrieval speed and query performance. Traditional database retrieval technology mainly relies on index structures, such as B-trees and hash tables, to speed up the data search process; however, in the face of increasingly complex query requirements, massive data, and complex sharded database nodes, these traditional index technologies have begun to expose their limitations, resulting in increased query latency and extended system response time, which seriously affects user experience and business efficiency.
[0003] For example, a Chinese patent with publication number CN115004170A discloses optimized query scheduling according to data freshness requirements, including receiving a request (110) in an information retrieval data processing system (200) to accelerate query execution of a specified query (120) to a time (130) before a scheduled time (190); the method includes identifying a specified field (140) corresponding to data in a database (250) in the query, and retrieving the data freshness requirement (160) of the specified field and the change frequency (150) of the data corresponding to the specified field. The method includes determining whether executing the specified query at a time before the scheduled time instead of the scheduled time violates the data freshness requirement based on the change frequency of the data corresponding to the specified field. When the execution does not violate the freshness, the method includes scheduling the specified query to be executed at a time before the scheduled time.
[0004] For example, a Chinese patent with authorization announcement number CN116304213B discloses a method for optimizing RDF graph database subgraph matching queries based on graph neural networks, which includes: training a GraphSAGE graph neural network model based on RDF graph data to obtain a trained network model; converting the SPARQL query statement in the query load into a first query graph to determine a frequently queried subgraph; converting the structural features of the frequently queried subgraph into a first subgraph embedded feature vector; obtaining the query results and index intermediate values of the frequently queried subgraph in the RDF graph database index; constructing an auxiliary index; converting the target SPARQL query statement into a second query graph, converting the structural features of the second query graph into a second subgraph embedded feature vector; searching the second subgraph embedded feature vector in the auxiliary index to determine the query result. The above scheme converts subgraph matching into vector matching to accelerate the query of RDF data.
[0005] The above existing technologies have the following problems: How to improve the efficiency of retrieval while balancing the load in a complex and large distributed database environment and reduce the waiting time is still difficult to solve with the existing technology. In order to solve the above problems, the present invention provides a model-accelerated database retrieval optimization system and method based on a knowledge graph. Summary of the invention
[0006] In view of the shortcomings of the prior art, the present invention proposes a model-accelerated database retrieval optimization system and method based on a knowledge graph. The system collects and preprocesses database cache and query data to build a real-time updated distributed multi-level knowledge graph, and uses a path generation algorithm to enhance query efficiency. Secondly, the high-frequency pre-caching sub-database is linked with the graph node, and the high-frequency query results are preloaded in combination with the prediction model, and regular updates are made to ensure data timeliness. Thirdly, when querying, the system provides real-time recommendations, pre-caches intent queries, and parses global queries and generates query paths when intent queries are missed. Finally, a path selection unit is used to determine the optimal path to execute the query, quickly return the results, and perform secondary query optimization on the query results based on the returned results and the secondary query statements. The overall process significantly improves the database retrieval speed and user experience.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] The model-accelerated database retrieval optimization system based on knowledge graph includes: data processing module, intelligent graph module and accelerated optimization module;
[0009] The data processing module is used for the collection and preprocessing of cache data and query process data of each sharded sub-database in the distributed database;
[0010] The intelligent graph module includes a graph construction unit and a cache management unit; the graph construction unit is used to construct a distributed multi-level knowledge graph through a natural language algorithm based on the pre-processed cache and query process data of various sub-nodes of the distributed database, and a path generation algorithm is built into the distributed multi-level knowledge graph. According to the obtained user query requirements, the query path corresponding to the user query requirements is pre-generated through the path generation algorithm; the cache management unit is used to construct a high-frequency pre-cache sub-database, and a high-frequency prediction model is built into the high-frequency pre-cache sub-database node, and high-frequency query data is predicted based on the obtained database query data, and the predicted data is pre-cached in the high-frequency pre-cache sub-database, and the low-hit rate data is sent to the original shard sub-database for storage;
[0011] The acceleration optimization module includes a query recommendation unit, a query parsing unit, a path selection unit and a secondary query optimization unit; the query recommendation unit is used to recommend the intended query statement to the user through a recommendation algorithm based on the partial query statement input by the user and the constructed intended query statement library, and at the same time, the query data corresponding to the intended query statement is pre-cached into the high-frequency pre-caching sub-database through the cache management unit; the query parsing unit, through the built-in multi-modal query parsing algorithm, performs real-time parsing of the global query statement input by the user to obtain the user's query requirements;
[0012] The path selection unit is used to select the optimal query path through the reinforcement learning model and perform data query based on the acquired user query requirements, pre-generated query paths and distributed multi-level knowledge graphs;
[0013] The secondary query optimization unit pre-caches the query data corresponding to the user's secondary input query statement in the result data into a high-frequency pre-cache sub-database through the cache management unit based on the result data obtained by the query recommendation unit or the path selection unit and the user's secondary input query statement, and feeds it back to the query user.
[0014] Specifically, the distributed multi-level knowledge graph includes query nodes, parsing nodes, path selection nodes, high-frequency pre-cache sub-database nodes and data coordination nodes and sharding sub-database nodes;
[0015] The query node is a first-level node, which has a built-in intention query statement library and obtains the user's intention query statement through the query recommendation unit. The parsing node is a second-level node, which performs query statement parsing through the query parsing unit. The path selection node is a third-level node, which performs query path selection through the path selection unit. The high-frequency pre-cache sub-database node and the data coordination node are both fourth-level nodes. The high-frequency pre-cache sub-database node predicts and caches high-frequency query data through the cache management unit, and saves the fast query path from the third-level node to the high-frequency pre-cache sub-database node pre-generated by the path generation algorithm; the data coordination node includes multiple query paths pre-generated by the path generation algorithm in the distributed multi-level knowledge graph, which is used for the optimal path query of data not in the high-frequency pre-cache sub-database; the shard sub-database node is a fifth-level node, including all shard sub-databases in the distributed database, which is used for query data storage; the priority levels of the first-level node, the second-level node, the third-level node, the fourth-level node and the fifth-level node are: first-level node>second-level node>third-level node>fourth-level node>fifth-level node;
[0016] Specifically, the connection rules and workflows of the first-level nodes, second-level nodes, third-level nodes, fourth-level nodes and fifth-level nodes include:
[0017] The first-level node is directly connected to the high-frequency pre-cached sub-database node in the second-level node and the fourth-level node; the first-level node judges and obtains the intention query statement through the built-in intention query statement library and recommendation algorithm. If the intention query statement is obtained, the query data corresponding to the intention query statement is pre-cached from the fifth-level node to the high-frequency pre-cached sub-database node through the cache management unit. When the query instruction is issued according to the intention query statement, the corresponding data pre-cached by the high-frequency pre-cached sub-database node is directly fed back to the query interface; if the intention query statement is not obtained, the obtained global query statement is input into the second-level node;
[0018] The second-level node is directly connected to the third-level node; the second-level node obtains the user's query requirements through the multimodal query parsing algorithm and the received global query statement;
[0019] The third-level node is directly connected to the high-frequency pre-cache sub-database node and the data coordination node in the fourth-level node; the third-level node determines and generates instructions for selecting the optimal query path through the reinforcement learning model based on the received user query requirements; the determination process includes: when the high-frequency pre-cache sub-database node includes query data corresponding to the user query requirements, a path call instruction 1 from the third-level node to the high-frequency pre-cache sub-database node is generated through the reinforcement learning model, and the path call instruction 1 is transmitted to the high-frequency pre-cache sub-database node in the fourth-level node; when the high-frequency pre-cache sub-database node does not include query data corresponding to the user query requirements, a path call instruction 2 is generated through the reinforcement learning model, and the path call instruction 2 is transmitted to the data coordination node in the fourth-level node; when the fourth-level node receives the path call instruction 1, it calls the fast query path pre-generated by the built-in path generation algorithm stored in the fourth-level node according to the path call instruction 1, and accesses the corresponding query data in the high-frequency pre-cache sub-database;
[0020] The data coordination node in the fourth-level node is directly connected to the fifth-level node. When the fourth-level node receives the path call instruction 2, it calls the optimal n query paths in the multiple query paths pre-generated by the built-in path generation algorithm in the fourth-level node according to the path call instruction 2, accesses the sharded sub-database corresponding to the path in the fifth-level node, and performs query feedback on the data corresponding to the user's query requirements; among them, the query priority of the high-frequency pre-cache sub-database node is higher than the query priority of the data coordination node;
[0021] The fifth-level node is interactively connected with the high-frequency pre-caching sub-database node in the fourth-level node; the fifth-level node and the fourth-level node exchange data through the built-in high-frequency prediction model and reinforcement learning model.
[0022] Specifically, the specific steps of the reinforcement learning model to generate path call instructions include:
[0023] A1. Build the current input state of the reinforcement learning model based on the cache data and query process data of each sharded sub-database in the distributed database ,in represents the user query demand obtained by the query parsing unit at the current time t, Indicates the hit status of the user query demand at the current time t and the cached query data in the high-frequency pre-caching sub-database. represents the multiple query paths pre-generated at the current time t, Indicates the high-frequency query threshold;
[0024] A2. Set the trigger information according to the current input status of the build, specifically:
[0025] A21, when hit When the first path execution information is triggered, that is, the high-frequency pre-cache sub-database contains query data corresponding to the user query demand;
[0026] A22, when hit When the second path execution information is triggered, that is, the high-frequency pre-cache sub-database does not contain the query data corresponding to the user query demand;
[0027] A23, when the query data frequency corresponding to the second path execution information is greater than or equal to When the query frequency is greater than or equal to The corresponding query data is cached in the high-frequency pre-cache sub-database.
[0028] Specifically, the specific steps of the reinforcement learning model generating the path call instruction also include:
[0029] A3: Construct the joint execution action at the current time t according to the trigger information set in A2 ,in, Indicates the action corresponding to the triggering of the first path execution information, that is, the action of executing the generated path call instruction 1; Indicates the action corresponding to the triggering of the second path execution information, that is, the action of executing the generated path call instruction 2; Indicates the action that triggers the execution corresponding to the third execution information, that is, the action of executing high-frequency query data cache;
[0030] A4. Construct a reward function based on the actions performed in A3 , specifically:
[0031] ,
[0032] Among them, G represents the total number of times the reinforcement learning model executes the generated path call instruction, Indicates the number of times the generated path call instruction 1 is executed. Represents the reward for executing the action of generating path call instruction 1 once, Indicates the number of times the generated path call instruction 2 is executed. Represents the reward for executing the action of generating path calling instruction 2 once. , Q represents the action performed by the reinforcement learning model The total number of times, Indicates the qth execution of an action The reward at this time , when the query frequency is greater than or equal to , but no action is performed hour, ; They represent the gain coefficients of the corresponding rewards in the reward function in turn;
[0033] A5. Build a reinforcement learning model based on the reinforcement learning algorithm, input the constructed current input state, joint execution action and reward function into the reinforcement learning model for training, and embed the trained reinforcement learning model into the path selection unit;
[0034] A6. Collect and obtain the cache data and query process data of each sharded sub-database in real time, and use the obtained data to obtain the corresponding trigger information in A2, and input the obtained trigger information into the path selection unit, generate the corresponding path call instruction, and select the corresponding data query path.
[0035] Specifically, the specific steps for the fifth-level node and the fourth-level node to exchange data through the built-in high-frequency prediction model and reinforcement learning model include:
[0036] B1. Obtain the types, query frequencies and hit rates of historical query data corresponding to different query cycles through the fast query path and the multiple query path, preprocess the acquired data, construct a fast query training set using the types and hit rates of query data corresponding to the fast query path, and construct a multiple query training set using the types, query frequencies and hit rates of query data corresponding to the multiple query paths;
[0037] B2. Construct high-frequency prediction sub-model 1 and high-frequency prediction sub-model 2 based on support vector machine, and integrate high-frequency prediction sub-model 1 and high-frequency prediction sub-model 2 into the high-frequency prediction model by using an integrated method, and input the obtained fast query training set into the high-frequency prediction sub-model 1, and input the multiple query training set into the high-frequency prediction sub-model 2, perform integrated training on the high-frequency prediction model, and obtain a trained high-frequency prediction model;
[0038] B3, deploy the obtained high-frequency prediction model to the cache management unit, obtain the query process data of the high-frequency pre-cache sub-database and the sharding sub-database in real time, input the query process data of the high-frequency pre-cache sub-database into the high-frequency prediction sub-model 1, and predict the hit rate of the corresponding type of pre-cache data in the high-frequency pre-cache sub-database in the current query cycle and the next query cycle;
[0039] B4. Input the query process data of the shard sub-database into the high-frequency prediction sub-model 2 to predict the query frequency and hit rate of the corresponding type of query data in the current query cycle and the next query cycle respectively.
[0040] Specifically, the specific steps for the fifth-level node and the fourth-level node to exchange data through the built-in high-frequency prediction model and reinforcement learning model also include:
[0041] B5. Set the quick query hit rate threshold , if the hit rate of the corresponding type of pre-cached data predicted in B3 in the current query cycle and the next query cycle is greater than or equal to The corresponding type of pre-cached data is retained, otherwise the corresponding type of pre-cached data is sent to the shard sub-database with the smallest load in the distributed database for storage;
[0042] B6. Set multiple query hit rate thresholds , if the query frequency and hit rate of the corresponding type of query data predicted in B4 in the current query cycle and the next query cycle are both greater than or equal to the corresponding threshold and , then pre-caches the corresponding type query data in the shard sub-database into the high-frequency pre-caching sub-database;
[0043] B7. When the query frequency of the corresponding type of query data in the current query cycle is greater than or equal to , then the reinforcement learning model is called to perform actions , cache the corresponding type query data into the high-frequency pre-cache sub-database.
[0044] Specifically, the multiple query paths include the proportion of each type of query data in each shard sub-database, the comprehensive score information of each shard sub-database, and the keyword information of each type of query data;
[0045] The specific steps of calling the optimal n query paths among the multiple query paths pre-generated by the built-in path generation algorithm in the fourth-level node according to the path call instruction 2 and accessing the shard sub-database corresponding to the path in the fifth-level node include:
[0046] C1. According to the user query requirements contained in the path call instruction 2 and the keyword information of each type of query data contained in the multiple query paths, the matching degree between the user query requirements and the keyword information in the corresponding query path is obtained through a matching algorithm. ,in Indicates the matching degree between the i-th user query demand and the k-th type query data keyword information in the j-th query path in the multiple query paths;
[0047] C2. According to the obtained And the proportion of the k-th type query data in the u-th shard sub-database The comprehensive score of the u-th shard sub-database , calculate the path selection score of querying the i-th user's query requirement through the j-th query path to the u-th shard sub-database , specific ;
[0048] C3. Set the path selection score threshold , according to the calculated Sort in descending order and use the set path selection score threshold to obtain Greater than The n optimal query path sets are used to obtain the n optimal query path sets and perform access queries on the sharded sub-databases corresponding to the paths.
[0049] The model-accelerated database retrieval optimization method based on knowledge graph includes:
[0050] S1. Obtain cache data and query process data of each sharded sub-database, and pre-process the obtained data;
[0051] S2. Based on the preprocessed data, a distributed multi-level knowledge graph is constructed through a natural language algorithm, and a path generation algorithm and a high-frequency pre-cache sub-database with a built-in high-frequency prediction model are embedded in the constructed distributed multi-level knowledge graph;
[0052] S3. Obtain the intended query statement according to the partial query statement through the intention query statement library built into the interactive interface, and cache the data corresponding to the intended query statement into the high-frequency pre-cache sub-database through the built-in high-frequency prediction model;
[0053] S4. If the intended query statement is not obtained, the global query statement obtained from the interactive interface is input into the query parsing unit to parse the query statement, obtain the user query demand, and feed the obtained user query demand back to the distributed multi-level knowledge graph to pre-generate a query path corresponding to the query statement through the built-in path generation algorithm;
[0054] S5. According to the acquired household query requirements and the pre-generated query path, the path selection unit selects the optimal query path, performs data query, and obtains the data query result.
[0055] A computer-readable storage medium stores computer instructions, which, when executed, execute a knowledge graph-based model-accelerated database retrieval optimization method.
[0056] Compared with the prior art, the present invention has the following beneficial effects:
[0057] 1. In view of the deficiencies in the prior art, the present invention constructs a distributed multi-level knowledge graph, combines the intelligent graph module with the acceleration optimization module, and forms a multi-level, adaptive query processing architecture. The intelligent graph module pre-understands and stores the correlation between data, and uses the natural language algorithm to construct the knowledge graph. The built-in path generation algorithm can predict user query needs and pre-generate query paths, which significantly reduces query delays. At the same time, the establishment of a high-frequency pre-cache sub-database and a data coordination node not only pre-caches high-frequency data through a prediction model, but also quickly responds to low-frequency queries by optimizing the path, effectively balancing the load pressure. The query recommendation, parsing and path selection units in the acceleration optimization module use recommendation algorithms and multimodal parsing to improve the accuracy and speed of queries, while the reinforcement learning model dynamically selects the optimal path, which enhances the system's ability to handle complex queries and further improves the efficiency of distributed database queries.
[0058] 2. The present invention ensures efficient and orderly data access through the design of multi-level nodes and priority allocation in the distributed multi-level knowledge graph, especially the collaborative work of the reinforcement learning model and the high-frequency prediction model, realizes the intelligent caching and dynamic adjustment of data, and further improves the query performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 This is a module diagram of the knowledge graph-based model-accelerated database retrieval optimization system of the present invention;
[0060] Figure 2 This is a distributed multi-level knowledge graph node workflow structure diagram of the present invention;
[0061] Figure 3 This is a working architecture diagram of a system unit for accelerating database retrieval optimization based on a knowledge graph model of the present invention;
[0062] Figure 4 This is a flow chart of the knowledge graph-based model-based database retrieval optimization method of the present invention. DETAILED DESCRIPTION
[0063] Example 1
[0064] See also Figure 1 , an embodiment provided by the present invention: a model-accelerated database retrieval optimization system based on a knowledge graph, comprising: a data processing module, an intelligent graph module, an accelerated optimization module and an interactive module;
[0065] The data processing module is used for the collection and preprocessing of cache data and query process data of each sharded sub-database in the distributed database; the cache data includes cache entries, cache hit rate, cache update log, cache size and data usage status; the query process data includes query log, query plan, query statistics, cache hit and miss statistics and single query resource ratio; the query statistics include query execution times, average response time and maximum response time;
[0066] An intelligent graph module is used to construct a database query graph based on the acquired cache data and query process data; the intelligent graph module includes a graph construction unit, a graph evolution unit, a cache management unit and a cache update unit;
[0067] A graph construction unit is used to construct a distributed multi-level knowledge graph through a natural language algorithm based on the pre-processed distributed database sub-node cache and query process data, and a path generation algorithm is built into the distributed multi-level knowledge graph. According to the acquired user query requirements, a query path corresponding to the user query requirements is pre-generated through the path generation algorithm; further, the natural language algorithm in this embodiment includes BERT, RoBERTa and knowledge graph embedding;
[0068] Furthermore, in this embodiment, the distributed multi-level knowledge graph includes query nodes, parsing nodes, path selection nodes, high-frequency pre-cache sub-database nodes and data coordination nodes and sharding sub-database nodes; wherein the query node is a first-level node, the first-level node has a built-in intention query statement library, and obtains the user's intention query statement through the query recommendation unit, the parsing node is a second-level node, the second-level node performs query statement parsing through the query parsing unit, the path selection node is a third-level node, the third-level node performs query path selection through the path selection unit, the high-frequency pre-cache sub-database node and the data coordination node are both fourth-level nodes, the high-frequency pre-cache sub-database node predicts and caches high-frequency query data through the cache management unit, and saves the fast query path from the third-level node to the high-frequency pre-cache sub-database node pre-generated by the path generation algorithm; the data coordination node includes the path generation algorithm in the distributed multi-level knowledge graph pre-generated The generated multiple query paths are used for optimal path query of data that is not in the high-frequency pre-cache sub-database; the shard sub-database node is a five-level node, including all the shard sub-databases in the distributed database, which is used to query the storage of data; the priority levels of the first-level node, the second-level node, the third-level node, the fourth-level node and the fifth-level node are: first-level node> second-level node> third-level node> fourth-level node> fifth-level node; further, in this embodiment, the multiple query paths include the proportion information of each type of query data in each shard sub-database, the comprehensive score information of each shard sub-database and the keyword information of each type of query data; further, each type of query data includes literature, technology, geography or medicine, etc.; the specific data type classification is carried out by technical personnel in this field according to the field to which the specific data belongs; for example, it can be specifically classified according to the field, industry or specific physical object corresponding to the corresponding data.
[0069] Furthermore, in this embodiment, the specific steps of obtaining the comprehensive score information of each shard sub-database include:
[0070] a1. Collect the attributes and working data of each shard sub-database in the distributed database, and pre-process the collected data; further, the attributes and working data of the shard sub-database in this embodiment include query frequency, query speed, data freshness, data integrity, data volume and load balancing degree of the corresponding shard sub-database;
[0071] a2. Build an evaluation model based on a comprehensive evaluation algorithm, and embed evaluation indicators into the evaluation model. Input the pre-processed attributes and work data of each sharded sub-database into the evaluation model to obtain a comprehensive score for each sharded sub-database. At the same time, arrange the obtained comprehensive scores in real time in descending order to obtain a comprehensive score set for the sharded sub-database.
[0072] Further, in this embodiment, the multiple query paths include the paths from the data coordination node to all sharded sub-databases, and each path has built-in information on the proportion of each type of data in the corresponding sharded sub-database, the comprehensive score, and the degree of load balancing at the connection of the data coordination node; further, in this embodiment, the degree of load balancing includes CPU cost, I / O cost, and communication cost, wherein the CPU cost refers to the computing time consumed by the corresponding sharded sub-database data query, the I / O cost refers to the time used to access the auxiliary memory, and the communication cost refers to the cost of the network transmitting information through each node;
[0073] Furthermore, the path generation algorithms in this embodiment include Dijkstra algorithm, depth-first search, bidirectional search, and K-Shortest Paths;
[0074] For further information, see Figure 2 The connection rules and workflow of the first-level nodes, second-level nodes, third-level nodes, fourth-level nodes and fifth-level nodes in this embodiment specifically include:
[0075] The first-level node is directly connected to the high-frequency pre-cached sub-database node in the second-level node and the fourth-level node; the first-level node judges and obtains the intention query statement through the built-in intention query statement library and recommendation algorithm. If the intention query statement is obtained, the query data corresponding to the intention query statement is pre-cached from the fifth-level node to the high-frequency pre-cached sub-database node through the cache management unit. When the query instruction is issued according to the intention query statement, the corresponding data pre-cached by the high-frequency pre-cached sub-database node is directly fed back to the query interface; if the intention query statement is not obtained, the obtained global query statement is input into the second-level node;
[0076] The second-level node is directly connected to the third-level node; the second-level node obtains the user's query requirements through the multimodal query parsing algorithm and the received global query statement;
[0077] The third-level node is directly connected to the high-frequency pre-cache sub-database node and the data coordination node in the fourth-level node; the third-level node determines and generates instructions for selecting the optimal query path through the reinforcement learning model based on the received user query requirements; the determination process includes: when the high-frequency pre-cache sub-database node includes query data corresponding to the user query requirements, a path call instruction 1 from the third-level node to the high-frequency pre-cache sub-database node is generated through the reinforcement learning model, and the path call instruction 1 is transmitted to the high-frequency pre-cache sub-database node in the fourth-level node; when the high-frequency pre-cache sub-database node does not include query data corresponding to the user query requirements, a path call instruction 2 is generated through the reinforcement learning model, and the path call instruction 2 is transmitted to the data coordination node in the fourth-level node; when the fourth-level node receives the path call instruction 1, it calls the fast query path pre-generated by the built-in path generation algorithm stored in the fourth-level node according to the path call instruction 1, and accesses the corresponding query data in the high-frequency pre-cache sub-database;
[0078] The data coordination node in the fourth-level node is directly connected to the fifth-level node. When the fourth-level node receives the path call instruction 2, it calls the optimal n query paths in the multiple query paths pre-generated by the built-in path generation algorithm in the fourth-level node according to the path call instruction 2, accesses the sharded sub-database corresponding to the path in the fifth-level node, and performs query feedback on the data corresponding to the user's query requirements; among them, the query priority of the high-frequency pre-cache sub-database node is higher than the query priority of the data coordination node;
[0079] The fifth-level node is interactively connected with the high-frequency pre-caching sub-database node in the fourth-level node; the fifth-level node and the fourth-level node exchange data through the built-in high-frequency prediction model and reinforcement learning model.
[0080] This process enables the system to predict the user's query intention through the built-in intention query statement library and its recommendation mechanism of the first-level node, and load high-frequency query data into the high-frequency pre-cache sub-database in advance, significantly reducing the response time; for queries that hit the cache, the data can be returned directly from the high-frequency pre-cache sub-database, avoiding unnecessary underlying database access, thereby speeding up the query process; for queries that miss, the system uses the multimodal parsing of the second-level node and the path selection unit of the third-level node, combined with the built-in path generation algorithm, to intelligently plan the optimal query path to ensure that the required data can be efficiently located even in complex query scenarios; the existence of the data coordination node further enhances the flexibility of the system, it can schedule resources according to the pre-generated multiple query paths, ensuring that even non-high-frequency data can be quickly accessed; in addition, the interactive connection between the fifth-level node and the high-frequency pre-cache sub-database allows real-time updating of the cache strategy to ensure the timeliness and relevance of the cached content.
[0081] The graph evolution unit collects distributed database node change data in real time to update and expand the constructed multi-level knowledge graph in real time;
[0082] The cache management unit is used to build a high-frequency pre-cache sub-database and build a high-frequency prediction model in the sub-database node. According to the acquired database query data, the high-frequency query data is predicted, the predicted data is pre-cached in the high-frequency pre-cache sub-database, and the low-hit rate cache data is sent to the original shard sub-database for storage;
[0083] Furthermore, in this embodiment, the specific steps of exchanging data between the fifth-level node and the fourth-level node through the built-in high-frequency prediction model and the reinforcement learning model include:
[0084] B1. Obtain the type, query frequency and hit rate of historical query data corresponding to different query cycles through the fast query path and the multiple query path, respectively, and pre-process the acquired data, use the type and hit rate of the query data corresponding to the fast query path to construct a fast query training set, and use the type, query frequency and hit rate of the query data corresponding to the multiple query paths to construct a multiple query training set; further, in this embodiment, the different query cycles are specifically: within the working time length of the distributed database every day, every half an hour is a query cycle;
[0085] B2. Construct high-frequency prediction sub-model 1 and high-frequency prediction sub-model 2 based on support vector machine, and integrate high-frequency prediction sub-model 1 and high-frequency prediction sub-model 2 into the high-frequency prediction model by using an integrated method, and input the obtained fast query training set into the high-frequency prediction sub-model 1, and input the multiple query training set into the high-frequency prediction sub-model 2, perform integrated training on the high-frequency prediction model, and obtain a trained high-frequency prediction model;
[0086] B3, deploy the obtained high-frequency prediction model to the cache management unit, obtain the query process data of the high-frequency pre-cache sub-database and the sharding sub-database in real time, input the query process data of the high-frequency pre-cache sub-database into the high-frequency prediction sub-model 1, and predict the hit rate of the corresponding type of pre-cache data in the high-frequency pre-cache sub-database in the current query cycle and the next query cycle;
[0087] B4. Input the query process data of the shard sub-database into the high-frequency prediction sub-model 2 to predict the query frequency and hit rate of the corresponding type of query data in the current query cycle and the next query cycle respectively.
[0088] B5. Set the quick query hit rate threshold , if the hit rate of the corresponding type of pre-cached data predicted in B3 in the current query cycle and the next query cycle is greater than or equal to The corresponding type of pre-cached data is retained, otherwise the corresponding type of pre-cached data is sent to the shard sub-database with the smallest load in the distributed database for storage;
[0089] B6. Set multiple query hit rate thresholds , if the query frequency and hit rate of the corresponding type of query data predicted in B4 in the current query cycle and the next query cycle are both greater than or equal to the corresponding threshold and , then pre-caches the corresponding type query data in the shard sub-database into the high-frequency pre-caching sub-database;
[0090] B7. When the query frequency of the corresponding type of query data in the current query cycle is greater than or equal to , then the reinforcement learning model is called to perform actions , cache the corresponding type query data into the high-frequency pre-cache sub-database.
[0091] By constructing a fast query training set and a multiple query training set, combined with support vector machine technology, the system can train a high-frequency prediction model to predict the frequency and hit rate of query data. This prediction capability allows the system to pre-cache high-frequency query data in the high-frequency pre-cache sub-database in advance, significantly reducing query latency. At the same time, by setting the hit rate threshold, the system can dynamically adjust the cache strategy, store data with low hit rates in the sharded sub-database, and release the space of the high-frequency pre-cache sub-database for high-frequency data. In addition, the application of the reinforcement learning model enables the system to dynamically adjust the cache strategy according to the actual query situation. When the query frequency exceeds a certain threshold, the system can intelligently cache the corresponding type of data in the high-frequency pre-cache sub-database, further improving the cache hit rate. This dynamic strategy not only improves query efficiency, but also ensures efficient use of cache space.
[0092] The cache update unit is used to periodically update the data pre-cached in the high-frequency pre-cache sub-database through a built-in cache update strategy to reduce the load of the high-frequency pre-cache sub-database; further, the cache update strategy in this embodiment is the same as the above-mentioned B4-B7 process, which will not be repeated here.
[0093] The acceleration optimization module is used for the recommendation and analysis of query statements and the selection of query paths; the acceleration optimization module includes a query recommendation unit, a query analysis unit, a path selection unit and a secondary query optimization unit;
[0094] A query recommendation unit is used to recommend intended query statements to users through a recommendation algorithm based on a partial query statement input by the user and the constructed intended query statement library, and at the same time pre-cache the query data corresponding to the intended query statement into a high-frequency pre-cache sub-database through a cache management unit;
[0095] Furthermore, in this embodiment, the specific steps of the multimodal query parsing algorithm for obtaining the user's query requirements include:
[0096] b1. Obtain historical global query statements, and use entity extraction algorithms to extract query keywords containing user query intent from each global query statement, and combine the extracted query keywords and global query statements into query pairs, and use the constructed query pairs to construct an intent query statement library;
[0097] b2. Set the recommended threshold , build a recommendation model based on the pre-trained Chinese Bert model, and input the query pairs in the intended query statement library into the recommendation model for training, obtain the query pair matching score, and when all the query pair matching scores are greater than , obtain the trained recommendation model;
[0098] b3. Deploy the recommendation model to the query recommendation unit. When the user enters part of the query statement, the recommendation model recommends to the user the matching score greater than The global query statements are sorted in descending order according to the matching scores in the query interface.
[0099] The query parsing unit parses the global query statement input by the user in real time through the built-in multimodal query parsing algorithm to obtain the user's query requirements; further, in this embodiment, the multimodal query parsing algorithm includes a text parsing algorithm and an image parsing algorithm; wherein the text parsing algorithm includes an intent recognition algorithm and a semantic role labeling algorithm; the image parsing algorithm includes a pre-trained lightweight VIT model and an OCR algorithm.
[0100] The path selection unit is used to select the optimal query path through the reinforcement learning model according to the obtained user query requirements and the pre-generated query path, and perform data query.
[0101] Furthermore, in this embodiment, the specific steps of generating a path call instruction by the reinforcement learning model to select the optimal query path include:
[0102] A1. Build the current input state of the reinforcement learning model based on the cache data and query process data of each sharded sub-database in the distributed database ,in represents the user query demand obtained by the query parsing unit at the current time t, Indicates the hit status of the user query demand at the current time t and the cached query data in the high-frequency pre-caching sub-database. represents the multiple query paths pre-generated at the current time t, Indicates the high-frequency query threshold;
[0103] A2. Set the trigger information according to the current input status of the build, specifically:
[0104] A21, when hit When the first path execution information is triggered, that is, the high-frequency pre-cache sub-database contains query data corresponding to the user query demand;
[0105] A22, when hit When the second path execution information is triggered, that is, the high-frequency pre-cache sub-database does not contain the query data corresponding to the user query demand;
[0106] A23, when the query data frequency corresponding to the second path execution information is greater than or equal to When the query frequency is greater than or equal to The corresponding query data is cached in the high-frequency pre-cache sub-database.
[0107] A3: Construct the joint execution action at the current time t according to the trigger information set in A2 ,in, Indicates the action corresponding to the triggering of the first path execution information, that is, the action of executing the generated path call instruction 1; Indicates the action corresponding to the triggering of the second path execution information, that is, the action of executing the generated path call instruction 2; Indicates the action that triggers the execution corresponding to the third execution information, that is, the action of executing high-frequency query data cache;
[0108] A4. Construct a reward function based on the actions performed in A3 , specifically:
[0109] ,
[0110] Among them, G represents the total number of times the reinforcement learning model executes the generated path call instruction, Indicates the number of times the generated path call instruction 1 is executed. Represents the reward for executing the action of generating path call instruction 1 once, Indicates the number of times the generated path call instruction 2 is executed. Represents the reward for executing the action of generating path calling instruction 2 once. , Q represents the action performed by the reinforcement learning model The total number of times, Indicates the qth execution of an action The reward at this time , when the query frequency is greater than or equal to , but no action is performed hour, ; They represent the gain coefficients of the corresponding rewards in the reward function in turn;
[0111] A5. Build a reinforcement learning model based on the reinforcement learning algorithm, input the constructed current input state, joint execution action and reward function into the reinforcement learning model for training, and embed the trained reinforcement learning model into the path selection unit;
[0112] A6. Collect and obtain the cache data and query process data of each sharded sub-database in real time, and use the obtained data to obtain the corresponding trigger information in A2, and input the obtained trigger information into the path selection unit, generate the corresponding path call instruction, and select the corresponding data query path.
[0113] This process significantly improves query efficiency by intelligently selecting query paths and optimizing cache strategies. The system can dynamically adjust query paths based on user query requirements and historical data hits to achieve effective resource allocation and utilization. This adaptive mechanism not only reduces unnecessary computing overhead, but also enhances the system's response speed and stability. At the same time, by learning and memorizing high-frequency queries, the system can automatically update the cache, further optimize the data access process, and reduce latency. This method not only improves the overall performance of distributed databases, but also has good scalability and resource optimization capabilities, and is suitable for large-scale data processing scenarios.
[0114] Furthermore, in this embodiment, the specific steps of calling the optimal n query paths in the multiple query paths pre-generated by the built-in path generation algorithm in the fourth-level node according to the path call instruction 2 and accessing the shard sub-database corresponding to the path in the fifth-level node include:
[0115] C1. According to the user query requirements contained in the path call instruction 2 and the keyword information of each type of query data contained in the multiple query paths, the matching degree between the user query requirements and the keyword information in the corresponding query path is obtained through a matching algorithm. ,in Indicates the matching degree between the i-th user query demand and the k-th type query data keyword information in the j-th query path in the multiple query paths;
[0116] C2. According to the obtained And the proportion of the k-th type query data in the u-th shard sub-database The comprehensive score of the u-th shard sub-database , calculate the path selection score of querying the i-th user's query requirement through the j-th query path to the u-th shard sub-database , specific ;
[0117] C3. Set the path selection score threshold , according to the calculated Sort in descending order and use the set path selection score threshold to obtain Greater than The n optimal query path sets are used to obtain the n optimal query path sets and perform access queries on the sharded sub-databases corresponding to the paths.
[0118] Through precise matching evaluation, weight consideration, dynamic sorting and screening, and flexible parameter setting, this process enables the system to better understand user needs and recommend the most appropriate query path for them, avoiding invalid or inefficient query operations, and greatly improving query efficiency and overall system performance.
[0119] The secondary query optimization unit pre-caches the query data corresponding to the user's secondary input query statement in the result data into a high-frequency pre-cache sub-database through the cache management unit based on the result data obtained by the query recommendation unit or the path selection unit and the user's secondary input query statement, and feeds it back to the query user.
[0120] Further, in the present embodiment, the second-time input query statement of the user is obtained based on the result data obtained by the query recommendation unit or the path selection unit, that is, the user determines whether the result data obtained by the query needs to be queried for a second time based on the query result data. If a second query is performed, the corresponding keyword to be queried in the result data obtained by the query recommendation unit or the path selection unit is used as the second-time input query statement of the user. The second-time input query statement of the user includes a partial second-time query statement input by the user or a global second-time query statement input by the user. Then, the specific process of the query by the query recommendation unit or the path selection unit is repeated to query the query data corresponding to the second-time input query statement of the user. At the same time, the second-time query data is cached in the high-frequency pre-cache sub-database through the cache management unit, and the second-time query result is fed back to the corresponding query user.
[0121] The interactive module is used to provide an interactive interface and build an intention query statement library based on the query statements captured in real time by the interactive interface; the interactive module includes a display unit and an intention query library unit;
[0122] The display unit is used to provide a query interface and display the query results in real time; the intention query library unit is used to build an intention query statement library through historical query data and the natural language algorithm in the graph construction unit, and build the constructed intention query statement library into the query interface of the query interface, and at the same time use the query statements obtained in real time to update the intention query statement library in real time.
[0123] Example 2
[0124] See also Figure 3 Another embodiment provided by the present invention: The corresponding unit workflow of the model-accelerated database retrieval optimization system based on the knowledge graph includes:
[0125] First, the data processing module collects cache data and query process data of each shard sub-database and pre-processes the collected data;
[0126] Second, based on the preprocessed data, a distributed multi-level knowledge graph is constructed through a graph construction unit, a path generation algorithm is built into the distributed multi-level knowledge graph, and a graph evolution unit is used to update and expand the constructed distributed multi-level knowledge graph in real time;
[0127] Third, the constructed high-frequency pre-cache sub-database is connected to the node representing the path selection in the distributed multi-level knowledge graph through the cache management unit, and the high-frequency query data in the distributed multi-level knowledge graph is predicted through the high-frequency prediction model built into the high-frequency pre-cache sub-database, and the prediction results are cached in the high-frequency pre-cache sub-database. At the same time, the cache update unit is used to regularly update the constructed high-frequency pre-cache sub-database;
[0128] Fourth, when performing data query, a query statement is input through the display unit, and at the same time, the query recommendation unit recommends the intended query statement to the user in real time based on the input part of the query statement and the intended query statement library constructed by the intended query library unit. When the intended query statement is obtained, the intended query statement is fed back to the cache management unit, and the query data corresponding to the intended query statement is pre-cached into the high-frequency pre-cache sub-database through the cache management unit. When the intended query statement is not obtained, the obtained global query statement is input into the query parsing unit to parse the query statement, and the parsing result is input into the graph construction unit, and the query path corresponding to the query statement is pre-generated through the built-in path generation algorithm, and the global query statement is updated to the intended query statement library at the same time;
[0129] Fifth, according to the obtained user query requirements and query paths, the path selection unit selects the optimal query path, performs data query, obtains data query results, and feeds the obtained query results back to the display unit for result display.
[0130] By continuously collecting and preprocessing the cache and query data of the sharded database, the system is able to build and maintain a dynamic, multi-level distributed knowledge graph, which not only enhances the relevance and accessibility of the data, but also the built-in path generation algorithm and graph evolution unit ensure the real-time update and expansion of the graph, making the query path more intelligent and efficient; secondly, the high-frequency pre-cache sub-database combined with the prediction model pre-stores high-probability query results, which greatly shortens the response time. At the same time, the regular update mechanism ensures the freshness of the cached data and avoids redundant calculations; thirdly, the query recommendation function improves interactivity. Users can obtain accurate query suggestions after entering part of the query statement, which speeds up the query process, and the pre-caching of intended queries further optimizes resource allocation; finally, the reinforcement learning model is used to select the optimal query path, so that the system can autonomously learn and adapt to different query modes, improving query accuracy and efficiency.
[0131] Example 3
[0132] See also Figure 4 Another embodiment provided by the present invention is a method for accelerating database retrieval optimization based on a knowledge graph model, the steps comprising:
[0133] S1. Obtain cache data and query process data of each sharded sub-database, and pre-process the obtained data;
[0134] S2. Based on the preprocessed data, a distributed multi-level knowledge graph is constructed through a natural language algorithm, and a path generation algorithm and a high-frequency pre-cache sub-database with a built-in high-frequency prediction model are embedded in the constructed distributed multi-level knowledge graph;
[0135] S3. Obtain the intention query statement according to the partial query statement through the intention query statement library built into the interactive interface, and cache the data corresponding to the intention query statement into the high-frequency pre-cache sub-database through the built-in high-frequency prediction model to obtain the data query result;
[0136] S4. If the intended query statement is not obtained, the global query statement obtained from the interactive interface is input into the query parsing unit to parse the query statement, obtain the user query demand, and feed the obtained user query demand back to the distributed multi-level knowledge graph to pre-generate a query path corresponding to the query statement through the built-in path generation algorithm;
[0137] S5. According to the acquired household query requirements and the pre-generated query path, the path selection unit selects the optimal query path, performs data query, and obtains the data query result;
[0138] S6. Based on the query result obtained in S3 or the query result obtained in S5 and the user's secondary input query statement, the query data corresponding to the user's secondary input query statement in the query result is pre-cached into a high-frequency pre-cache sub-database through the cache management unit, and fed back to the querying user.
[0139] Example 4
[0140] A computer-readable storage medium stores computer instructions, which, when executed, execute a knowledge graph-based model-accelerated database retrieval optimization method.
[0141] An electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, a model-accelerated database retrieval optimization method based on a knowledge graph is implemented.
[0142] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in the field may also change, modify, replace and modify the above-mentioned embodiments without departing from the scope of protection of the purpose of the present invention and the claims, and all of these are within the protection of the present invention.
[0143] If the disclosed technical solution involves personal information, the product using the disclosed technical solution has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the disclosed technical solution involves sensitive personal information, the product using the disclosed technical solution has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A model-accelerated database retrieval optimization system based on knowledge graph, characterized in that: include: Data processing module, intelligent graph module and acceleration optimization module; The data processing module is used for collecting and preprocessing cache data and query process data of each shard sub-database in the distributed database; The intelligent graph module includes a graph construction unit and a cache management unit; the graph construction unit is used to construct a distributed multi-level knowledge graph through a natural language algorithm based on the pre-processed cache and query process data of various sub-nodes of the distributed database, and a path generation algorithm is built into the distributed multi-level knowledge graph. According to the acquired user query requirements, a query path corresponding to the user query requirements is pre-generated through the path generation algorithm; the cache management unit is used to construct a high-frequency pre-cache sub-database, and a high-frequency prediction model is built into the high-frequency pre-cache sub-database node, and high-frequency query data is predicted based on the acquired database query data, and the predicted data is pre-cached in the high-frequency pre-cache sub-database, and the low-hit rate data is sent to the original shard sub-database for storage; The acceleration optimization module includes a query recommendation unit, a query parsing unit, a path selection unit and a secondary query optimization unit; The query recommendation unit is used to recommend intended query statements to users through a recommendation algorithm based on partial query statements input by users and the constructed intended query statement library, and pre-caches the query data corresponding to the intended query statements into a high-frequency pre-cache sub-database through a cache management unit; the query parsing unit uses a built-in multimodal query parsing algorithm to perform real-time parsing of global query statements input by users to obtain user query requirements; the path selection unit is used to select the optimal query path through a reinforcement learning model to perform data query based on the obtained user query requirements, pre-generated query paths and distributed multi-level knowledge graphs; the secondary query optimization unit pre-caches the query data corresponding to the secondary user input query statements in the result data into a high-frequency pre-cache sub-database through a cache management unit based on the result data obtained by the query recommendation unit or the path selection unit and the secondary user input query statement, and feeds it back to the querying user.
2. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 1, characterized in that: The distributed multi-level knowledge graph includes query nodes, parsing nodes, path selection nodes, high-frequency pre-cache sub-database nodes and data coordination nodes and sharding sub-database nodes; The query node is a first-level node, which has a built-in intention query statement library and obtains user intention query statements through a query recommendation unit. The parsing node is a second-level node, which performs query statement parsing through a query parsing unit. The path selection node is a third-level node, which performs query path selection through a path selection unit. The high-frequency pre-cache sub-database node and the data coordination node are both fourth-level nodes. The high-frequency pre-cache sub-database node predicts and caches high-frequency query data through a cache management unit, and saves a fast query path from the third-level node to the high-frequency pre-cache sub-database node pre-generated by a path generation algorithm; the data coordination node includes multiple query paths pre-generated by a path generation algorithm in a distributed multi-level knowledge graph, which is used for optimal path query of data not in a high-frequency pre-cache sub-database; the shard sub-database node is a fifth-level node, including all shard sub-databases in a distributed database, and is used for storage of query data; the priority levels of the first-level node, the second-level node, the third-level node, the fourth-level node and the fifth-level node are: first-level node>second-level node>third-level node>fourth-level node>fifth-level node.
3. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 2, characterized in that: The connection rules and workflow of the first-level nodes, second-level nodes, third-level nodes, fourth-level nodes and fifth-level nodes specifically include: The first-level node is directly connected to the high-frequency pre-cached sub-database node in the second-level node and the fourth-level node; the first-level node judges and obtains the intention query statement through the built-in intention query statement library and recommendation algorithm. If the intention query statement is obtained, the query data corresponding to the intention query statement is pre-cached from the fifth-level node to the high-frequency pre-cached sub-database node through the cache management unit. When the query instruction is issued according to the intention query statement, the corresponding data pre-cached by the high-frequency pre-cached sub-database node is directly fed back to the query interface; if the intention query statement is not obtained, the obtained global query statement is input into the second-level node; The secondary node is directly connected to the tertiary node; the secondary node obtains the user query demand through the multimodal query parsing algorithm and the received global query statement; The third-level node is directly connected to the high-frequency pre-cache sub-database node and the data coordination node in the fourth-level node; the third-level node determines and generates instructions for selecting the optimal query path through the reinforcement learning model according to the received user query demand; the determination process includes: when the high-frequency pre-cache sub-database node includes query data corresponding to the user query demand, a path call instruction 1 from the third-level node to the high-frequency pre-cache sub-database node is generated through the reinforcement learning model, and the path call instruction 1 is transmitted to the high-frequency pre-cache sub-database node in the fourth-level node; when the high-frequency pre-cache sub-database node does not include query data corresponding to the user query demand, a path call instruction 2 is generated through the reinforcement learning model, and the path call instruction 2 is transmitted to the data coordination node in the fourth-level node; when the fourth-level node receives the path call instruction 1, the fast query path pre-generated by the built-in path generation algorithm stored in the fourth-level node is called according to the path call instruction 1, and the corresponding query data in the high-frequency pre-cache sub-database is accessed; The data coordination node in the fourth-level node is directly connected to the fifth-level node. When the fourth-level node receives the path call instruction 2, it calls the optimal n query paths in the multiple query paths pre-generated by the built-in path generation algorithm in the fourth-level node according to the path call instruction 2, accesses the shard sub-database corresponding to the path in the fifth-level node, and performs query feedback on the data corresponding to the user query demand; wherein the query priority of the high-frequency pre-cache sub-database node is higher than the query priority of the data coordination node; The fifth-level node is interactively connected with the high-frequency pre-caching sub-database node in the fourth-level node; the fifth-level node and the fourth-level node exchange data through the built-in high-frequency prediction model and reinforcement learning model.
4. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 3, characterized in that: The specific steps of generating a path call instruction by the reinforcement learning model include: A1. Build the current input state of the reinforcement learning model based on the cache data and query process data of each sharded sub-database in the distributed database ,in represents the user query demand obtained by the query parsing unit at the current time t, Indicates the hit status of the user query demand at the current time t and the cached query data in the high-frequency pre-caching sub-database. represents the multiple query paths pre-generated at the current time t, Indicates the high-frequency query threshold; A2. Set the trigger information according to the current input status of the build, specifically: A21, when hit When the first path execution information is triggered, that is, the high-frequency pre-cache sub-database contains query data corresponding to the user query demand; A22, when hit When the second path execution information is triggered, that is, the high-frequency pre-cache sub-database does not contain the query data corresponding to the user query demand; A23, when the query data frequency corresponding to the second path execution information is greater than or equal to When the query frequency is greater than or equal to The corresponding query data is cached in the high-frequency pre-cache sub-database.
5. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 4, characterized in that: The specific steps of generating the path call instruction by the reinforcement learning model also include: A3: Construct the joint execution action at the current time t according to the trigger information set in A2 ,in, Indicates the action corresponding to the triggering of the first path execution information, that is, the action of executing the generated path call instruction 1; Indicates the action corresponding to the triggering of the second path execution information, that is, the action of executing the generated path call instruction 2; Indicates the action that triggers the execution corresponding to the third execution information, that is, the action of executing high-frequency query data cache; A4. Construct a reward function based on the actions performed in A3 , specifically: , Among them, G represents the total number of times the reinforcement learning model executes the generated path call instruction, Indicates the number of times the generated path call instruction 1 is executed. Represents the reward for executing the action of generating path call instruction 1 once, Indicates the number of times the generated path call instruction 2 is executed. Represents the reward for executing the action of generating path calling instruction 2 once. , Q represents the action performed by the reinforcement learning model The total number of times, Indicates the qth execution of an action The reward at this time , when the query frequency is greater than or equal to , but no action is performed hour, ; They represent the gain coefficients of the corresponding rewards in the reward function in turn; A5. Build a reinforcement learning model based on the reinforcement learning algorithm, input the constructed current input state, joint execution action and reward function into the reinforcement learning model for training, and embed the trained reinforcement learning model into the path selection unit; A6. Collect and obtain the cache data and query process data of each sharded sub-database in real time, and use the obtained data to obtain the corresponding trigger information in A2, and input the obtained trigger information into the path selection unit, generate the corresponding path call instruction, and select the corresponding data query path.
6. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 5, characterized in that: The specific steps of exchanging data between the fifth-level node and the fourth-level node through the built-in high-frequency prediction model and the reinforcement learning model include: B1. Obtain the types, query frequencies and hit rates of historical query data corresponding to different query cycles through the fast query path and the multiple query path, preprocess the acquired data, construct a fast query training set using the types and hit rates of query data corresponding to the fast query path, and construct a multiple query training set using the types, query frequencies and hit rates of query data corresponding to the multiple query paths; B2. Construct high-frequency prediction sub-model 1 and high-frequency prediction sub-model 2 based on support vector machine, and integrate high-frequency prediction sub-model 1 and high-frequency prediction sub-model 2 into the high-frequency prediction model by using an integrated method, and input the obtained fast query training set into the high-frequency prediction sub-model 1, and input the multiple query training set into the high-frequency prediction sub-model 2, perform integrated training on the high-frequency prediction model, and obtain a trained high-frequency prediction model; B3, deploy the obtained high-frequency prediction model to the cache management unit, obtain the query process data of the high-frequency pre-cache sub-database and the sharding sub-database in real time, input the query process data of the high-frequency pre-cache sub-database into the high-frequency prediction sub-model 1, and predict the hit rate of the corresponding type of pre-cache data in the high-frequency pre-cache sub-database in the current query cycle and the next query cycle; B4. Input the query process data of the shard sub-database into the high-frequency prediction sub-model 2 to predict the query frequency and hit rate of the corresponding type of query data in the current query cycle and the next query cycle respectively.
7. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 6, characterized in that: The specific steps of exchanging data between the level 5 node and the level 4 node through the built-in high-frequency prediction model and the reinforcement learning model also include: B5. Set the quick query hit rate threshold , if the hit rate of the corresponding type of pre-cached data predicted in B3 in the current query cycle and the next query cycle is greater than or equal to The corresponding type of pre-cached data is retained, otherwise the corresponding type of pre-cached data is sent to the shard sub-database with the smallest load in the distributed database for storage; B6. Set multiple query hit rate thresholds , if the query frequency and hit rate of the corresponding type of query data predicted in B4 in the current query cycle and the next query cycle are both greater than or equal to the corresponding threshold and , then pre-caches the corresponding type query data in the shard sub-database into the high-frequency pre-caching sub-database; B7. When the query frequency of the corresponding type of query data in the current query cycle is greater than or equal to , then the reinforcement learning model is called to perform actions , cache the corresponding type query data into the high-frequency pre-cache sub-database.
8. The model-accelerated database retrieval optimization system based on knowledge graph according to claim 7, characterized in that: The multiple query paths include the proportion information of each type of query data in each shard sub-database, the comprehensive score information of each shard sub-database and the keyword information of each type of query data; The specific steps of calling the optimal n query paths among the multiple query paths pre-generated by the built-in path generation algorithm in the fourth-level node according to the path calling instruction 2 and accessing the shard sub-database corresponding to the path in the fifth-level node include: C1. According to the user query requirements contained in the path call instruction 2 and the keyword information of each type of query data contained in the multiple query paths, the matching degree between the user query requirements and the keyword information in the corresponding query path is obtained through a matching algorithm. ,in Indicates the matching degree between the i-th user query demand and the k-th type query data keyword information in the j-th query path in the multiple query paths; C2. According to the obtained And the proportion of the k-th type query data in the u-th shard sub-database The comprehensive score of the u-th shard sub-database , calculate the path selection score of querying the i-th user's query requirement through the j-th query path to the u-th shard sub-database , specific ; C3. Set the path selection score threshold , according to the calculated Sort in descending order and use the set path selection score threshold to obtain Greater than The n optimal query path sets are used to obtain the n optimal query path sets and perform access queries on the sharded sub-databases corresponding to the paths.
9. A method for accelerating database retrieval optimization based on a knowledge graph, which is used to implement a system for accelerating database retrieval optimization based on a knowledge graph as claimed in any one of claims 1 to 8, characterized in that the steps include: S1. Obtain cache data and query process data of each sharded sub-database, and pre-process the obtained data; S2. Based on the preprocessed data, a distributed multi-level knowledge graph is constructed through a natural language algorithm, and a path generation algorithm and a high-frequency pre-cache sub-database with a built-in high-frequency prediction model are embedded in the constructed distributed multi-level knowledge graph; S3. Obtain the intended query statement according to the partial query statement through the intention query statement library built into the interactive interface, and cache the data corresponding to the intention query statement into the high-frequency pre-cache sub-database through the built-in high-frequency prediction model; S4. If the intended query statement is not obtained, the global query statement obtained from the interactive interface is input into the query parsing unit to parse the query statement, obtain the user query demand, and feed the obtained user query demand back to the distributed multi-level knowledge graph to pre-generate a query path corresponding to the query statement through the built-in path generation algorithm; S5. According to the acquired household query requirements and the pre-generated query path, the path selection unit selects the optimal query path, performs data query, and obtains the data query result.
10. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed, the model-accelerated database retrieval optimization method based on knowledge graph described in claim 9 is executed.