Database query method and device, electronic equipment, storage medium and program product
By integrating the multi-dimensional features, sequence features and graph structure features of the fused database data, fusion features are generated, and database query plans are optimized based on these features, the problem that a single query plan in the existing technology cannot achieve efficient queries, and efficient and accurate database queries are achieved.
Patent Information
- Application Number
- CN202510417663.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-05-23
AI Technical Summary
In the prior art, a single execution query plan cannot achieve efficient database queries, especially when facing big data, complex queries and changeable data environments.
By integrating the multi-dimensional features, sequence features and graph structure features of the fused database data, the fused features are obtained, and the database query plan is executed based on these fused features, and the query plan is optimized to adapt to load changes.
It realizes efficient database query, improves query efficiency and accuracy, can adapt to the ever-changing database environment, and reduces query response time and resource consumption.
Smart Images

Figure CN120030050A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a database query method, device, electronic equipment, storage medium and program product. Background Art
[0002] With the rapid development of information technology, the demand for data storage, management and processing in various industries is growing, and database query has become a crucial step.
[0003] Currently, database queries rely on database query plans pre-built by structured query statements, and the required data is obtained from the database by executing the database query plan.
[0004] However, in the face of big data, complex queries and changing data environments, a single query plan execution approach faces the problem of being unable to achieve efficient database queries. It is necessary to further improve and optimize database query solutions to adapt to the growing data scale and complex query requirements. Summary of the invention
[0005] The present invention provides a database query method, device, electronic device, storage medium and program product, which are used to solve the defect that a single execution query plan in the prior art cannot realize efficient database query, and realize an efficient database query solution.
[0006] The present invention provides a database query method, comprising: Fusion of multidimensional features, sequence features and graph structure features of database data to obtain fusion features of the database data; Based on the fusion features, a database query plan is executed to obtain a database query result.
[0007] According to a database query method provided by the present invention, the database data is input into a multidimensional feature extraction model to obtain the multidimensional features output by the multidimensional feature extraction model; Inputting the sequence data in the database data into a sequence feature extraction model to obtain the sequence features output by the sequence feature extraction model; Inputting the graph structure of the database data into a graph feature extraction model; obtaining the graph structure features output by the graph feature extraction model; The multidimensional features, the sequence features and the graph structure features are input into a feature fusion model to obtain the fusion features output by the feature fusion model.
[0008] According to a database query method provided by the present invention, executing a database query plan based on the fusion feature to obtain a database query result includes: Obtaining load status information of a computing system executing the database query plan; Inputting the load state information into a load prediction model to obtain predicted load state information output by the load prediction model; In the case where the predicted load state is worse than the current load state, optimizing the database query plan based on a reinforcement learning algorithm to obtain an optimized query plan; the predicted load state is determined based on the predicted load state information; and the current load state is determined based on the load state information; Based on the fusion features, the optimized query plan is executed to obtain the database query result.
[0009] According to a database query method provided by the present invention, the step of optimizing the database query plan to obtain an optimized query plan includes: Inputting the database query plan and the load state information into a first optimization model to obtain an execution order optimization plan output by the first optimization model; the first optimization model is constructed based on a reinforcement learning algorithm; the first optimization model is pre-trained for the purpose of optimizing the load state of the computing system; The execution sequence optimization plan and query performance index data are input into a second optimization model to obtain a query path optimization plan output by the second optimization model; the second optimization model is constructed based on a reinforcement learning algorithm; the second optimization model is pre-trained for the purpose of optimizing the query performance of structured query statements; Based on the query path optimization plan, the optimized query plan is determined.
[0010] According to a database query method provided by the present invention, before fusing the multidimensional features, sequence features and graph structure features of the database data to obtain the fusion features of the database data, the method further includes: Inputting the original database data into the data dimension reduction model to obtain the data representation output by the data dimension reduction model; Inputting the data representation into a data enhancement model to obtain an enhanced data representation output by the data enhancement model; Based on the enhanced data representation, the database data is determined.
[0011] According to a database query method provided by the present invention, before executing the database query plan based on the fusion feature to obtain the database query result, the method further includes: Inputting the natural query language input by the user into the language conversion model to obtain a set of structured query statements output by the language conversion model; Inputting the structured query statement set into a multi-task learning model to obtain an optimized structured statement set output by the multi-task learning model; The database query plan is determined based on the optimized structured statement set.
[0012] The present invention also provides a database query device, comprising: A fusion feature acquisition module; used to fuse the multidimensional features, sequence features and graph structure features of database data to obtain the fusion features of the database data; A query plan execution module is used to execute the database query plan based on the fusion features to obtain the database query results.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements any of the above-mentioned database query methods when executing the computer program.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-mentioned database query methods.
[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned database query methods.
[0016] The database query method, device, electronic device, storage medium and program product provided by the present invention can optimize data storage, improve the efficiency of database queries, and improve the accuracy of database queries because the fused features capture the deep-level correlation between database data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 It is a flow chart of the database query method provided by the present invention.
[0019] Figure 2 It is a structural schematic diagram of the database query device provided by the present invention.
[0020] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] It should be noted that, in the description of the present invention, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0023] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" means at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0024] Combine the following Figure 1-Figure 3 The invention describes a database query method, device, electronic device, storage medium and program product provided by the invention.
[0025] Figure 1 It is a flow chart of the database query method provided by the present invention, such as Figure 1 As shown, the database query method includes but is not limited to steps 101 to 102.
[0026] It should be noted that the execution subject of the database query method provided by the present invention is the corresponding database query device, which can specifically be a server, a computer device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc.
[0027] Step 101: Fusing the multidimensional features, sequence features, and graph structure features of database data to obtain fused features of the database data.
[0028] Database data refers to all information stored in a database, including structured data (such as relational tables), semi-structured data (such as JSON and XML), and unstructured data (such as text and images).
[0029] Specifically, before executing a database query, the big data in the database, that is, the database data, is first processed, including extracting multidimensional features from the database data for characterizing the pattern and structure of the database data, extracting sequence features from the database data for characterizing the long-term dependencies of time series data in the database data, and extracting graph structure features from the database data for characterizing the complex relationships between data entities and data entities in the database data. The extracted multidimensional features, sequence features, and graph structure features of the database data are then fused to obtain fused features of the database data.
[0030] Step 102: Based on the fusion features, execute the database query plan to obtain the database query results.
[0031] Specifically, when executing a database query plan, the data is not queried directly from the database data based on the original, unprocessed database data including big data, but the database query plan is executed based on the fusion features of the multidimensional features, sequence features and graph structure features of the database data to obtain the database query results.
[0032] The database query method provided by the present invention optimizes data storage and improves the efficiency of database queries. At the same time, the accuracy of database queries is also improved because the fused features capture the deep-level correlation between database data.
[0033] Based on the above embodiment, as an optional embodiment, the fusion of the multidimensional features, sequence features and graph structure features of the database data to obtain the fusion features of the database data includes: Inputting the database data into a multidimensional feature extraction model to obtain the multidimensional features output by the multidimensional feature extraction model; Inputting the sequence data in the database data into a sequence feature extraction model to obtain the sequence features output by the sequence feature extraction model; Inputting the graph structure of the database data into a graph feature extraction model; obtaining the graph structure features output by the graph feature extraction model; The multidimensional features, the sequence features and the graph structure features are input into a feature fusion model to obtain the fusion features output by the feature fusion model.
[0034] The sequence data of database data is a data set with time sequence and / or logical sequence, such as time series data such as package transaction time, signal control instruction time, user series behavior (click, browse and purchase package) sequence, etc.
[0035] Optionally, the multi-dimensional feature extraction model is constructed based on Convolutional Neural Networks (CNN).
[0036] Optionally, the convolutional neural network is a deep convolutional neural network (Deep Convolutional Neural Networks, Deep CNN).
[0037] Optionally, the sequence feature extraction model is constructed based on a recurrent neural network (RNN) or a long short-term memory network (LSTM).
[0038] Optionally, the graph feature extraction model is built based on Graph Convolutional Networks (GNN).
[0039] Optionally, the feature fusion model is built based on a deep learning model.
[0040] Specifically, before extracting different types of complex dimensions of database data, we first use CNN, DeepCNN, etc. to build a multidimensional feature extraction model, use RNN, LSTM, etc. to build a sequence feature extraction model, use GNN, etc. to build a graph feature extraction model, and use a deep learning model to build a feature fusion model, and complete the pre-training of the multidimensional feature extraction model, sequence feature extraction model, graph feature extraction model and feature fusion model.
[0041] The database data is further input into the pre-trained multidimensional feature extraction model to perform multi-dimensional feature extraction on the data in the database to obtain multi-dimensional features; the sequence data in the database data is input into the pre-trained sequence feature extraction model to model the sequence features in the data such as time series features, logical sequence features, etc. to obtain sequence features; the graph structure of the database data is input into the pre-trained graph feature extraction model to learn the graph structure features of the data in the database to identify and utilize the complex relationships between the data to obtain graph structure features.
[0042] The three different features of the database data extracted by three different feature extraction models are input into the pre-trained graph feature extraction model, and feature fusion is performed by combining different data features to obtain fused features that capture the deep correlation between database data.
[0043] In one embodiment, when the multidimensional feature extraction model is constructed based on Deep CNN, the expression of the multidimensional features output by the multidimensional feature extraction model after inputting the database data into the multidimensional feature extraction model is as follows: ; in, It is a multidimensional feature; For database data; For multi-dimensional feature extraction model The model parameters.
[0044] In one embodiment, when the sequence feature extraction model is constructed based on RNN, the sequence data in the database data is input into the sequence feature extraction model to obtain the expression of the sequence feature output by the sequence feature extraction model as follows: ; in, is the sequence feature; It is the sequence data in the database data; Extracting features from a sequence The model parameters.
[0045] In one embodiment, when the graph feature extraction model is constructed based on GNN, the graph structure of the database data is input into the graph feature extraction model; and the expression of the graph structure feature output by the graph feature extraction model is obtained as follows: ; in, It is the graph structure feature; It is the graph structure of database data; Graph feature extraction model The model parameters.
[0046] In one embodiment, the multidimensional feature, the sequence feature and the graph structure feature are input into a feature fusion model to obtain an expression of the fusion feature output by the feature fusion model as follows: ; in, For fusion features; It is a multidimensional feature; is the sequence feature; It is the graph structure feature; Feature fusion model The model parameters.
[0047] Optionally, the time series data with time order in the sequence data of the database data is obtained in the following manner: extracting fields containing timestamps (such as package transaction time, signal control instruction time) from the database table, and arranging the data of the fields containing timestamps in the database table in time order, thereby forming time series data.
[0048] Optionally, logical sequence data having a logical order in the sequence data of the database data and which can be widely used in recommendation systems or user portrait analysis is obtained in the following manner: user operation record data (such as clicks, browsing, and package purchases, etc.) are sorted by timestamp to form logical sequence data.
[0049] The database query method provided by the present invention utilizes different types of network models to extract multidimensional features, sequence features and graph structure features of different dimensions of database data, and uses the model to fuse the complex features of three different types of dimensions to obtain fused features. It can capture the deep-level correlation between database data, and while improving the efficiency of database queries, it also improves the accuracy of database queries.
[0050] As an optional embodiment, the multidimensional features, sequence features and graph structure features of the fused database data are obtained to obtain the fused features of the database data, including: inputting the original database data into a feature enhancement model to obtain enhanced database data output by the feature enhancement model; and determining the database data based on the enhanced database data.
[0051] Optionally, the feature enhancement model is constructed based on a self-supervised learning algorithm.
[0052] In one embodiment, the original database data is input into the feature enhancement model to obtain the expression of the enhanced database data output by the feature enhancement model as follows: ; in, To enhance database data; is the original database data; Enhance the model for features The model parameters.
[0053] By inputting the original database data into the feature enhancement model built based on the self-supervised learning algorithm, it is possible to predict the missing values in the database data and help with missing value processing, thereby enhancing the robustness and expressiveness of different types of feature representations of subsequent database data.
[0054] Based on the above embodiment, as an optional embodiment, executing a database query plan based on the fusion feature to obtain a database query result includes: Obtaining load status information of a computing system executing the database query plan; Inputting the load state information into a load prediction model to obtain predicted load state information output by the load prediction model; In the case where the predicted load state is worse than the current load state, optimizing the database query plan based on a reinforcement learning algorithm to obtain an optimized query plan; the predicted load state is determined based on the predicted load state information; and the current load state is determined based on the load state information; Based on the fusion features, the optimized query plan is executed to obtain the database query result.
[0055] Specifically, in the process of executing the database query plan based on the fusion feature, the load state information of the computing system in executing the database query plan is obtained cyclically according to the preset frequency, and the current load state of the computing system is determined according to the load state information. The load state information includes but is not limited to at least one of the state information such as processor utilization, memory utilization, disk IO load, bandwidth utilization, query cache hit rate, etc.
[0056] After the load status information is acquired, the acquired load status information is input into a pre-trained load prediction model to obtain predicted load status information output by the load prediction model, and the predicted load status is determined according to the predicted load status information.
[0057] Further, the advantages and disadvantages between the predicted load state and the current load state are judged according to the preset frequency. When the predicted load state is better than the current load state, there is no need to optimize the database query plan; when the predicted load state is worse than the current load state, the database query plan is optimized based on the reinforcement learning algorithm to obtain an optimized query plan. Finally, the optimized query plan is executed based on the fusion features of the database data to obtain the database query result.
[0058] In one embodiment, the load state information is input into a load prediction model to obtain an expression for the predicted load state information output by the load prediction model as follows: ; in, To predict load status information; is the load status information; Load forecasting model The model parameters.
[0059] The database query method provided by the present invention obtains the load status information of the computing system when executing the database query plan through real-time monitoring, so as to use the prediction model to predict the load status information of the computing system, and when the predicted load status is worse than the current load status, the original database query plan is adjusted to obtain an optimized query plan, thereby realizing dynamic and continuous optimization of the query plan according to the query load feedback of the computing system, thereby allocating appropriate system resources to continue database query according to the optimized query plan, being able to adapt to the ever-changing database environment, minimizing the query response time and resource consumption, and improving the database query efficiency.
[0060] Based on the above embodiment, as an optional embodiment, optimizing the database query plan to obtain an optimized query plan includes: Inputting the database query plan and the load state information into a first optimization model to obtain an execution order optimization plan output by the first optimization model; the first optimization model is constructed based on a reinforcement learning algorithm; the first optimization model is pre-trained for the purpose of optimizing the load state of the computing system; The execution sequence optimization plan and query performance index data are input into a second optimization model to obtain a query path optimization plan output by the second optimization model; the second optimization model is constructed based on a reinforcement learning algorithm; the second optimization model is pre-trained for the purpose of optimizing the query performance of structured query statements; Based on the query path optimization plan, the optimized query plan is determined.
[0061] Among them, the query performance indicator data is the key query performance indicator data of the computing system executing the database query plan obtained in real time, including but not limited to at least one of the indicator data such as query response time, query execution time, query throughput, number of concurrent queries, number of scanned rows, etc.
[0062] Optionally, the reinforcement learning algorithm can be Q-Learning, Deep Q-Network (DQN) or Policy Gradient method, etc.
[0063] Specifically, before starting to optimize the database query plan, it is necessary to ensure that the first optimization model and the second optimization model have been constructed and pre-trained, that is, the first optimization model and the second optimization model are pre-built based on the reinforcement learning algorithm, and then the first optimization model is pre-trained with the purpose of optimizing the load state when the computing system executes the database query plan, and the second optimization model is pre-trained with the purpose of optimizing the query performance of the structured query statement in the database query plan.
[0064] When the predicted load state is worse than the current load state and the database query plan needs to be optimized, the database query plan being executed by the computing system and the load state information obtained in real time are input into the first optimization model, and the first optimization model optimizes the execution order and query resource allocation of each structured query statement in the database query plan to obtain an execution order optimization plan. The execution order optimization plan and the query performance indicator data of the computing system executing the database query plan obtained in real time are further input into the second optimization model, and the second optimization model optimizes the query path and query resource allocation of each structured query statement in the execution order optimization plan to obtain a query path optimization plan.
[0065] The query path optimization plan is used as the optimized query plan after optimizing the database plan.
[0066] In one embodiment, the database query plan and the load status information are input into the first optimization model to obtain an expression of the execution sequence optimization plan output by the first optimization model as follows: ; in, Optimize plans for execution order; is the load status information; Query plan for database; The first optimization model The model parameters.
[0067] In one embodiment, the execution order optimization plan and query performance index data are input into the second optimization model to obtain the expression of the query path optimization plan output by the second optimization model as follows: ; in, Optimize plans for execution order; Optimize the plan for the query path; To query performance indicator data; For the second optimization model The model parameters.
[0068] The database query method provided by the present invention optimizes the database query plan for the purpose of optimizing the load state of the computing system and the query performance of the structured query statement by dynamically utilizing two optimization models based on the reinforcement learning algorithm according to the system query load state feedback. Specifically, the execution order of the structured query statement in the database query plan is first optimized by the first optimization model, and then the query path of the structured query statement in the database query plan is optimized by the second optimization model to obtain an optimized query plan, thereby realizing adaptive dynamic adjustment of the query plan according to the query load feedback of the computing system, thereby allocating appropriate system resources to continue to perform database query according to the optimized query plan, thereby improving the efficiency of database query.
[0069] Based on the above embodiment, as an optional embodiment, before fusing the multidimensional features, sequence features and graph structure features of the database data to obtain the fusion features of the database data, the following further includes: Inputting the original database data into the data dimension reduction model to obtain the data representation output by the data dimension reduction model; Inputting the data representation into a data enhancement model to obtain an enhanced data representation output by the data enhancement model; Based on the enhanced data representation, the database data is determined.
[0070] Optionally, the data dimensionality reduction model is constructed based on an autoencoder neural network.
[0071] Optionally, the data dimensionality reduction model is built based on RNN.
[0072] Specifically, before extracting and fusing the multidimensional features, sequence features, and graph structure features of the database data, the database data is preprocessed. The raw database data without preprocessing is input into the data dimension reduction model, which automatically extracts and reduces the data features of the raw database data to obtain a compact and information-rich data representation. The data representation is input into the data enhancement model, which further extracts the temporal or spatial features of the database data, thereby enhancing the multidimensional characteristics of the data representation and obtaining an enhanced data representation. Finally, the obtained enhanced data representation is used as the database data.
[0073] In one embodiment, when the data dimension reduction model is constructed based on an autoencoder neural network, the original database data is input into the data dimension reduction model to obtain the expression of the data representation output by the data dimension reduction model as follows: ; in, For data representation; is the original database data; Dimensionality reduction model for data The model parameters.
[0074] In one embodiment, when the data enhancement model is constructed based on RNN, the data representation is input into the data enhancement model to obtain an expression of the enhanced data representation output by the data enhancement model as follows: ; in, To enhance data representation; For data representation; Enhance the model for data The model parameters.
[0075] The database query method provided by the present invention utilizes a model to sequentially perform dimensionality reduction and enhancement processing on the original database data, such as reconstructing the original database data through an autoencoder to retain the core features of the original database data and obtain database data represented in a low dimensional manner, thereby compressing the data dimensions of the original database data and removing redundant information, thereby improving the storage efficiency and query response speed of database queries; and facilitating more accurately discovering nonlinear models and structures in database data in the subsequent steps of integrating different types of dimensional features of database data, thereby further improving the efficiency and accuracy of database queries.
[0076] Based on the above embodiment, as an optional embodiment, before executing the database query plan based on the fusion feature to obtain the database query result, the method further includes: Inputting the natural query language input by the user into the language conversion model to obtain a set of structured query statements output by the language conversion model; Inputting the structured query statement set into a multi-task learning (MIT) model to obtain an optimized structured statement set output by the multi-task learning model; The database query plan is determined based on the optimized structured statement set.
[0077] Optionally, the language conversion model is constructed based on a sequence-to-sequence (Seq2Seq) model and LSTM.
[0078] For example, LSTM is used as the core network of the encoder and decoder in the Seq2Seq model to build a language conversion model.
[0079] Specifically, before executing the database query plan, the model is used to obtain the database query plan. A language conversion model is built based on the Seq2Seq model and LSTM, and a multi-task learning model is built based on the MIT algorithm to complete the pre-training of the language conversion model and the multi-task learning model.
[0080] The natural query language input by the user is input into the pre-trained language conversion model, and the natural query language is converted into the corresponding structured query language by capturing the semantic information in the natural language, and a structured query statement set consisting of multiple structured query statements is obtained. The structured query statement set is further input into the multi-task learning model, and the structured query statement set is simultaneously optimized for query parsing through the multi-task learning framework. During the parsing process, multiple related tasks are considered simultaneously to obtain an optimized structured statement set. Finally, the execution method, execution order, index and table connection method of each statement in the optimized structured statement set are determined to obtain a database query plan.
[0081] In one embodiment, when the language conversion model is constructed based on the Seq2Seq model and LSTM, the natural query language input by the user is input into the language conversion model to obtain an expression of a structured query statement set output by the language conversion model as follows: ; in, It is a set of structured query statements; Natural query language for user input; Language conversion model The model parameters.
[0082] In one embodiment, the structured query statement set is input into the multi-task learning model to obtain an expression of the optimized structured statement set output by the multi-task learning model as follows: ; in, To optimize the structured statement set; It is a set of structured query statements; Learning models for multi-tasks The model parameters.
[0083] The database query method provided by the present invention converts the natural query language input by the user into a set of structured query statements by utilizing a language conversion model based on a Seq2Seq model and LSTM, and simultaneously considers multiple related tasks during the parsing and conversion process, thereby improving the comprehensive efficiency of natural query language parsing, optimizing the multi-task learning framework of the structured query language, and improving the applicability of the finally determined database query plan when processing different multiple tasks.
[0084] In another embodiment, the step of inputting the structured query statement set into a multi-task learning model to obtain an optimized structured statement set output by the multi-task learning model includes: inputting the structured query statement set into an attention enhancement model to obtain an increased structured statement set output by the attention enhancement model; and inputting the increased structured statement set into the multi-task learning model to obtain an optimized structured statement set output by the multi-task learning model.
[0085] Optionally, the structured query statement set is input into the attention enhancement model to obtain an expression of the increased structured statement set output by the attention enhancement model as follows: ; in, To increase the set of structured statements; It is a set of structured query statements; To enhance the model for attention The model parameters.
[0086] By utilizing the attention mechanism in the attention enhancement model to enhance the key information in the structured query statement set, the accuracy of query parsing can be improved.
[0087] In order to better illustrate the database query method provided by the present invention, an embodiment is provided below to provide detailed parameters for the complete process of the database query method.
[0088] The original database data is input into the data dimension reduction model built based on the autoencoder neural network to obtain the data representation, and the data representation is input into the data enhancement model built based on the RNN to obtain the enhanced data representation, and the database data is determined based on the enhanced data representation. It can realize adaptive feature extraction and dimension reduction of the original database data, and form database data composed of compact and information-rich data representation, which has an important impact on improving database query efficiency and optimizing data storage.
[0089] The natural query language input by the user is input into the language conversion model based on the Seq2Seq model and LSTM, and the natural language query is converted into a structured query to obtain a set of structured query statements. The structured query statement set is further optimized using the attention mechanism and multi-task learning framework, which significantly improves the semantic understanding ability of the query and obtains an optimized structured statement set. The database query plan is determined based on the optimized structured statement set, which improves the comprehensiveness and efficiency of query processing.
[0090] The database data is input into the multidimensional feature extraction model built based on Deep CNN to obtain multidimensional features, the sequence data of the database data is input into the sequence feature extraction model built based on RNN or LSTM to obtain sequence features, the graph structure of the database data is input into the graph feature extraction model built based on GNN to obtain graph structure features, and the multidimensional features, sequence features and graph structure features are fused to obtain fused features, which can learn the complex feature representation of the database data and capture the deep correlation between the data.
[0091] The load state information of the computing system executing the database query plan is acquired by real-time monitoring, and the load state information is input into the load prediction model to obtain the predicted load state information, and the current load state and the predicted load state are determined according to the load state information and the predicted load state information respectively, and when the predicted load state is inferior to the current load state, the database query plan is optimized based on the reinforcement learning algorithm. Specifically, the first optimization model and the second optimization model are constructed in advance based on the reinforcement learning algorithm, and the first optimization model is pre-trained for the purpose of optimizing the load state of the computing system, and the second optimization model is pre-trained for the purpose of optimizing the query performance of the structured query statement. The database query plan and the load state information are input into the pre-trained first optimization model to obtain the execution order optimization plan, and then the execution order optimization plan is input into the pre-trained second optimization model to obtain the query path optimization plan, and finally the query path optimization plan after the execution order and the query path are optimized is used as the optimized query plan, and the optimized query plan is executed based on the fusion feature to obtain the database query result, so as to realize the dynamic adaptive optimization query plan according to the system load and query performance feedback to adapt to the ever-changing database environment.
[0092] On the whole, the database query method provided by the present invention can effectively perform feature extraction and dimensionality reduction on large amounts of complex data in the database, optimize data storage and query efficiency, and combine real-time load prediction and adaptive adjustment mechanisms to dynamically adjust the query plan based on query performance feedback to achieve continuous optimization of the query plan.
[0093] Figure 2 is a schematic diagram of the structure of the database query device provided by the present invention, such as Figure 2 As shown, the database query device includes but is not limited to a fusion feature acquisition module 201 and a query plan execution module 202.
[0094] The fusion feature acquisition module 201 is used to fuse the multi-dimensional features, sequence features and graph structure features of the database data to obtain the fusion features of the database data.
[0095] The query plan execution module 202 is used to execute the database query plan based on the fusion feature to obtain the database query result.
[0096] It should be noted that the database query device provided by the present invention can execute the database query method described in any of the above embodiments during specific operation, which will not be described in detail in this embodiment.
[0097] The database query device provided by the present invention can optimize data storage and improve the efficiency of database queries while also improving the accuracy of database queries because the fused features capture the deep-level correlations between database data.
[0098] As an optional embodiment, the database query device further includes: a data processing module.
[0099] The data processing module is used to input the original database data into the data dimensionality reduction model to obtain the data representation output by the data dimensionality reduction model; input the data representation into the data enhancement model to obtain the enhanced data representation output by the data enhancement model; and determine the database data based on the enhanced data representation.
[0100] As an optional embodiment, the database query device further includes: a query language conversion module.
[0101] The query language conversion module is used to input the natural query language input by the user into the language conversion model to obtain a set of structured query statements output by the language conversion model; input the set of structured query statements into the multi-task learning model to obtain an optimized set of structured statements output by the multi-task learning model; and determine the database query plan based on the optimized set of structured statements.
[0102] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor (Processor) 310, a communication interface (Communications Interface) 320, a memory (Memory) 330 and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the database query method provided by any of the above embodiments, and the database query method includes but is not limited to the following steps: fusing the multidimensional features, sequence features and graph structure features of the database data to obtain the fusion features of the database data; based on the fusion features, executing the database query plan to obtain the database query results.
[0103] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0104] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the database query method provided in any of the above embodiments. The database query method includes but is not limited to the following steps: fusing the multidimensional features, sequence features and graph structure features of the database data to obtain the fused features of the database data; based on the fused features, executing the database query plan to obtain the database query results.
[0105] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the database query method provided in any of the above embodiments is implemented. The database query method includes but is not limited to the following steps: fusing the multidimensional features, sequence features and graph structure features of the database data to obtain the fused features of the database data; based on the fused features, executing the database query plan to obtain the database query results.
[0106] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0107] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A database query method, characterized in that: include: Fusion of multidimensional features, sequence features and graph structure features of database data to obtain fusion features of the database data; Based on the fusion features, a database query plan is executed to obtain a database query result.
2. The database query method according to claim 1, characterized in that: The fusion features of the database data, the multi-dimensional features, the sequence features and the graph structure features are fused to obtain the fusion features of the database data, including: Inputting the database data into a multidimensional feature extraction model to obtain the multidimensional features output by the multidimensional feature extraction model; Inputting the sequence data in the database data into a sequence feature extraction model to obtain the sequence features output by the sequence feature extraction model; Inputting the graph structure of the database data into a graph feature extraction model; obtaining the graph structure features output by the graph feature extraction model; The multidimensional features, the sequence features and the graph structure features are input into a feature fusion model to obtain the fusion features output by the feature fusion model.
3. The database query method according to claim 1, characterized in that: The step of executing a database query plan based on the fusion feature to obtain a database query result includes: Obtaining load status information of a computing system executing the database query plan; Inputting the load state information into a load prediction model to obtain predicted load state information output by the load prediction model; In the case where the predicted load state is worse than the current load state, optimizing the database query plan based on a reinforcement learning algorithm to obtain an optimized query plan; the predicted load state is determined based on the predicted load state information; and the current load state is determined based on the load state information; Based on the fusion features, the optimized query plan is executed to obtain the database query result.
4. The database query method according to claim 3, characterized in that: The step of optimizing the database query plan to obtain an optimized query plan includes: Inputting the database query plan and the load state information into a first optimization model to obtain an execution order optimization plan output by the first optimization model; the first optimization model is constructed based on a reinforcement learning algorithm; the first optimization model is pre-trained for the purpose of optimizing the load state of the computing system; The execution sequence optimization plan and query performance index data are input into a second optimization model to obtain a query path optimization plan output by the second optimization model; the second optimization model is constructed based on a reinforcement learning algorithm; the second optimization model is pre-trained for the purpose of optimizing the query performance of structured query statements; Based on the query path optimization plan, the optimized query plan is determined.
5. The database query method according to claim 1, characterized in that: Before fusing the multidimensional features, sequence features and graph structure features of the database data to obtain the fusion features of the database data, the method further includes: Inputting the original database data into the data dimension reduction model to obtain the data representation output by the data dimension reduction model; Inputting the data representation into a data enhancement model to obtain an enhanced data representation output by the data enhancement model; Based on the enhanced data representation, the database data is determined.
6. The database query method according to claim 1, characterized in that: Before executing the database query plan based on the fusion feature to obtain the database query result, the method further includes: Inputting the natural query language input by the user into the language conversion model to obtain a set of structured query statements output by the language conversion model; Inputting the structured query statement set into a multi-task learning model to obtain an optimized structured statement set output by the multi-task learning model; The database query plan is determined based on the optimized structured statement set.
7. A database query device, characterized in that: include: Fusion feature acquisition module; Used to fuse the multidimensional features, sequence features and graph structure features of database data to obtain the fusion features of the database data; A query plan execution module is used to execute the database query plan based on the fusion features to obtain the database query results.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the database query method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the database query method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the database query method according to any one of claims 1 to 6 is implemented.