A method and system for implementing a form combination query condition of a low-code platform
By using word vector models and multi-set convolutional neural networks to perform cardinality estimation and query optimization for multi-table join queries on low-code platforms, the problem of inaccurate cardinality estimation in existing technologies is solved, query performance and user experience are improved, and a self-improving closed-loop optimization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 杭州量算科技有限公司
- Filing Date
- 2026-02-02
- Publication Date
- 2026-04-17
AI Technical Summary
Existing low-code platforms suffer from inaccurate cardinality estimation in multi-table join queries, resulting in poor query performance, impacting user experience and system resource consumption, especially when querying complex business data.
We employ word vector models to embed character-type predicates and combine multi-set convolutional neural networks to aggregate structural features of multi-table join pattern graphs. We generate optimized query plans through reinforcement learning and optimize the model using an adaptive learning framework to achieve accurate cardinality estimation and query optimization.
It significantly improves the accuracy of cardinality estimation, reduces the execution time of multi-table join queries, enhances the performance and stability of low-code platforms when handling complex queries, and has continuous optimization capabilities.
Smart Images

Figure CN121614493B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, specifically relating to a method and system for implementing combined query conditions in a low-code platform form. Background Technology
[0002] In the wave of low-code platform development, visual development and rapid application building have become core trends. By providing graphical interfaces and pre-built components, they have significantly reduced the development threshold and time cost of business applications. However, as enterprise data volume and business complexity increase, users' needs for complex business data querying and retrieval are growing, especially in scenarios that require joint queries across multiple data tables and dynamic combination of various filtering conditions. The data querying and retrieval capabilities of many existing low-code platforms are proving inadequate, becoming a bottleneck restricting the platform's ability to handle complex business scenarios.
[0003] A search revealed that patent publication number CN117235119A discloses a method for multi-table joint queries on a low-code platform. This technical solution mainly includes importing table data into the low-code platform and preprocessing it, constructing and training a query model, executing the query according to the query plan selected by the query model, and finally generating query results. This invention combines deep learning technology and user feedback to automatically optimize the query process, improve query speed and result accuracy. By using a dual DNN model and an improved Q-value function, it dynamically adjusts query weights based on user feedback, making the query more aligned with the user's actual needs.
[0004] However, after in-depth analysis, this existing technical solution may still encounter specific technical problems in practical applications. First, while the solution mentions multi-table joins, its core optimization focuses more on adjusting the weights of query conditions based on user feedback. It fails to provide a targeted and efficient solution for the critical challenge of cardinality estimation in multi-table join scenarios, especially complex join scenarios. The accuracy of cardinality estimation directly determines whether the query optimizer can select the optimal execution plan. In multi-table join queries, cardinality estimation becomes exceptionally difficult due to the complexity of the join relationships between tables and the correlation of data distribution. If the existing solution cannot accurately handle such scenarios, the generated query plan may not be optimal, and could even lead to poor query performance. Second, the solution does not fully consider the semantic understanding and quantitative association challenges posed by the large number of character-based predicates present when users dynamically configure and combine query conditions through a visual interface on low-code platforms. This further increases the difficulty of accurately estimating the cardinality of the query result set.
[0005] If the aforementioned technical issues are not effectively resolved, they will have significant impacts and consequences in practical work. Inaccurate cardinality estimation will cause the query optimizer to select inefficient query execution plans, leading to problems such as excessively long query response times and increased consumption of system resources (such as CPU, memory, and I / O), severely affecting the performance and user experience of low-code platforms when handling complex business data queries. When users set complex multi-table combined query conditions through a visual interface, if the platform returns results slowly or even times out due to resource exhaustion, it will directly undermine users' confidence in the low-code platform's ability to handle complex business scenarios, hindering the promotion and in-depth application of low-code platforms in data-intensive application scenarios. Therefore, there is an urgent need for a technical solution that can effectively handle complex combined queries in low-code platforms, especially in multi-table join environments, enabling accurate cardinality estimation and query optimization to overcome the shortcomings of existing technologies and improve the platform's overall performance and user experience. Summary of the Invention
[0006] To address the shortcomings of existing technologies, the present invention aims to provide a method and system for implementing combined query conditions in a low-code platform form.
[0007] The objective of this invention is achieved through the following technical solution: a method for implementing combined query conditions in a low-code platform form, comprising the following steps:
[0008] It receives and parses complex combined query conditions to obtain a set of data tables, a set of inter-table join conditions, and a set of user-specified data filtering predicates.
[0009] Based on the set of connection conditions, the inter-table association keys are identified and a pattern graph is constructed with data tables as nodes and connection relationships as edges.
[0010] A word vector model is used to embed character-type predicates in the query, and the data table set, the set of inter-table join conditions, and the set of predicates are transformed into a structured query feature vector.
[0011] The cardinality estimate of the results of this multi-table join query is learned from the query feature vector based on the convolutional neural network model.
[0012] The cardinality estimate is used as the main input for query cost evaluation. Combined with a query plan selection strategy based on reinforcement learning training, an optimized multi-table join query execution plan is generated outside the database.
[0013] The multi-table join query execution plan is fed back to the data query engine of the low-code platform for execution, and the performance metrics of the query plan in actual operation are captured in real time.
[0014] The performance metrics are input into the adaptive learning framework, and several queries with the largest estimation errors and their actual data are collected. After being re-encoded using the word vector model, the convolutional neural network model is incrementally trained and its parameters are fine-tuned to complete the closed-loop optimization of the word vector model.
[0015] Furthermore, the complex combination query conditions are configured by the user through a visual interface on the low-code platform, and the parsing process is as follows:
[0016] Establish a mapping function to map user-specified data filtering predicates to their respective data tables, thus completing field name disambiguation;
[0017] Predicates with multiple writing forms are normalized into a standardized predicate representation set, which includes predicate type identifiers, operator standard codes, and vector representations in their original text form.
[0018] The table join condition expression is parsed into a structured binary relation triplet form, and the join direction and equivalence or non-equivalence attributes are recorded to obtain a structured set of table join conditions.
[0019] Furthermore, the parsing process includes:
[0020] Calculate the number of edges in the set of join conditions for each table; based on the set of predicates mapped to each table, calculate the selectivity of each predicate;
[0021] Different weights are assigned to the number of edges and the selectivity of each predicate in the data table to generate an importance score for each table, resulting in a set of data table importance scores.
[0022] Furthermore, the specific steps of identifying inter-table association keys and constructing a pattern graph with data tables as nodes and connection relationships as edges are as follows:
[0023] Based on the parsing engine, the set of inter-table join conditions is scanned to identify potential data table join pairs and extract the corresponding join field information;
[0024] Based on the set of importance scores for the data tables, the direction of the inter-table joins is determined and the join weights are assigned, wherein the join weights are determined according to the join type and the relative proportion of the importance scores of the two data tables;
[0025] The data table set is used as the node set, the set of inter-table connection conditions is used as the edge set, and each node is injected with its importance score and corresponding predicate tightness index to construct a pattern graph.
[0026] The pattern graph is subjected to topological connectivity detection and connectivity correction to ensure the connectivity of the graph;
[0027] The adjacency vector and aggregation weight metric of each node in the pattern graph are calculated to characterize the centrality and propagation influence of the node in the graph's topology.
[0028] Furthermore, the step of using a word vector model to embed character-type predicates in the query, transforming the data table set, the inter-table join condition set, and the predicate set into a structured query feature vector, specifically involves:
[0029] The original string vectors of character-type predicates in the predicate representation set are input into a pre-trained word vector model. The embedding representations of words in the global semantic space are obtained through the context window and the sub-word segmentation strategy, and the initial embedding vector of each predicate is output.
[0030] Based on the initial embedding vector and pattern graph, the comprehensive feature representation vector of each data table node is calculated by weighted averaging.
[0031] Aggregate the comprehensive feature representation vectors of all data table nodes to generate a query-level feature vector representing the entire query.
[0032] Furthermore, the convolutional neural network model is a pre-trained lightweight multi-ensemble convolutional neural network model, composed of multiple perceptron layers and ensemble convolutional modules; the calculation method of the cardinality estimate is specifically as follows:
[0033] By using the ensemble convolution module, local aggregation is performed on the vector of each data table node. The information of adjacent nodes is weighted and passed through the weight matrix. An updated node representation is generated at each layer, and the final aggregated vector is obtained after multiple iterations.
[0034] The final aggregated vectors of all data table nodes are globally summarized, and the contributions of different nodes are weighted based on the importance score of the table to generate an overall cardinality estimate.
[0035] Furthermore, the step of using the cardinality estimate as the primary input for query cost evaluation, combined with a query plan selection strategy based on reinforcement learning training, to generate an optimized multi-table join query execution plan outside the database specifically involves:
[0036] Map all data table sets and inter-table join condition sets to a join tree candidate space, where the nodes of the tree represent data tables or intermediate results, and the edges represent join operations;
[0037] The reinforcement learning agent uses the current connection tree structure as its state representation, generates an action probability distribution through a policy network, and selects the next connection operation from the action space. The action space includes connection order selection, connection algorithm type selection, and execution parameter adjustment.
[0038] Based on the cardinality estimate and importance score, the expected cost of the current action is calculated, and the value function guides the policy network to prioritize high-potential connection operations.
[0039] The negative value of the action execution time is used as a reward signal. The network parameters of the optimization strategy are optimized by maximizing the long-term cumulative reward to generate the final query execution plan.
[0040] Furthermore, the performance metrics include execution time and the actual number of tuples returned, where the actual number of tuples is the true cardinality of the corresponding cardinality estimate; the overall cardinality prediction bias is calculated based on the true cardinality and the cardinality estimate.
[0041] Furthermore, the step of inputting the performance metrics into the adaptive learning framework, collecting several queries with the largest estimation errors and their actual data, re-encoding them using the word vector model, and then incrementally training and fine-tuning the parameters of the convolutional neural network model to complete the closed-loop optimization of the word vector model specifically involves:
[0042] The cardinality estimation error is analyzed using an adaptive learning framework, and several query instances with cardinality prediction bias at the top of the preset range and their corresponding real execution results are selected as training samples.
[0043] The character-type predicates in the query are re-encoded based on the word vector model to generate an updated embedding vector, and combined with the data table and table importance score to form a new query feature vector;
[0044] The new query feature vector is used as input to incrementally train the convolutional neural network model, and the weight parameters are fine-tuned to minimize the cardinality prediction bias.
[0045] This invention also provides a low-code platform form combination query condition implementation system, comprising:
[0046] The query condition receiving and parsing module is used to receive and parse complex combination query conditions configured by the user, and obtain a set of data tables, a set of inter-table join conditions, and a set of data filtering predicates specified by the user.
[0047] The pattern graph construction module is used to identify the inter-table association keys and construct a pattern graph with data tables as nodes and connection relationships as edges based on the set of connection conditions.
[0048] The query feature vectorization module is used to embed character-type predicates in the query using a word vector model, and to transform the data table set, the set of join conditions between tables, and the set of predicates into a structured query feature vector.
[0049] The cardinality estimation module is used to learn from the query feature vector based on the convolutional neural network model and output the cardinality estimate of the result of this multi-table join query, which is used to predict the final number of tuples that satisfy all conditions.
[0050] The query plan generation module is used to take the cardinality estimate as the main input for query cost evaluation, and combine it with a query plan selection strategy based on reinforcement learning training to generate an optimized multi-table join query execution plan outside the database. The reinforcement learning model adaptively selects the join order and underlying implementation method by reconstructing the plan selection process in the form of a join tree and using the execution time cost as a reward function.
[0051] The query execution and monitoring module is used to feed back the generated optimized query plan to the data query engine of the low-code platform for execution, and to capture the performance indicators of the query plan in real time during actual operation, including execution time and the actual number of tuples in the returned results, i.e., the true cardinality.
[0052] The adaptive learning module is used to input the performance metrics into the adaptive learning framework, collect several queries with the largest estimation errors and their real data, re-encode them using the word vector model, and then perform incremental training and parameter fine-tuning on the convolutional neural network model to complete the closed-loop optimization of the word vector model.
[0053] The beneficial effects of this invention are as follows:
[0054] 1. This invention proposes an improved cardinality estimation method. By using a word vector model to embed character-type predicates and combining a multi-set convolutional neural network to aggregate structural features in a multi-table connection pattern graph, semantic information and topological relationships are uniformly encoded into query feature vectors. This enables a more accurate estimation of the cardinality of complex multi-table combined queries, significantly improving the accuracy of cardinality estimation.
[0055] 2. This invention proposes a novel query plan generation mechanism. By integrating the cardinality estimate and table importance score into the action value function of reinforcement learning, the policy network can simultaneously consider the estimated intermediate result size and the criticality of each table in the connection structure when generating the connection tree, thereby generating a better query execution plan and effectively reducing the execution time of multi-table join queries.
[0056] 3. This invention proposes an innovative adaptive learning framework. By capturing the error between the actual cardinality and the estimated cardinality of query execution in real time, high-error samples are filtered out. The cardinality estimation model is then incrementally trained and its parameters are fine-tuned after being re-encoded using the original word vector model. This achieves closed-loop optimization from execution feedback to model self-improvement, enabling the system to have continuous optimization capabilities and adapt to dynamic changes in data distribution.
[0057] 4. This invention proposes a complete method for processing complex combined queries on a low-code platform. Through collaborative optimization of the entire process from query parsing, schema graph construction, feature vectorization to cardinality estimation, plan generation and adaptive learning, the modules are closely connected through structured data flow to form a unified optimization system, which improves the overall performance and stability of the low-code platform when processing complex queries involving multiple table joins. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention.
[0060] Figure 2 This is a detailed flowchart of the query parsing and pattern diagram construction of the present invention;
[0061] Figure 3 This is a flowchart of the query feature vector generation and cardinality estimation process of this invention;
[0062] Figure 4 This is a flowchart illustrating the query plan generation and execution monitoring process of this invention.
[0063] Figure 5 This is a flowchart of the adaptive learning closed-loop optimization process of the present invention. Detailed Implementation
[0064] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.
[0065] This invention provides a low-code platform form combined query condition implementation system, comprising:
[0066] The query condition receiving and parsing module is used to receive complex combined query conditions configured by users of the low-code platform through a visual interface. The query conditions involve the correlation of multiple data tables, and the module parses the query to extract the set of data tables involved, the set of join conditions between tables, and the set of data filtering predicates specified by the user.
[0067] The schema graph construction module is used to automatically identify the inter-table association keys based on the parsed set of join conditions and construct a schema graph to describe the multi-table join relationship. This schema graph uses tables as nodes and join relationships as edges, and provides a data structure foundation for subsequent query optimization.
[0068] The query feature vectorization module is used to embed character-type predicates in the query using a word vector model. It transforms the table set, join condition set, and predicate set into a structured query feature vector. This process can capture the semantic correlation between data column values to solve the problem of character-type predicates being difficult to quantify and correlate.
[0069] The cardinality estimation module is used to input the query feature vector into a pre-trained lightweight multi-table convolutional neural network model for processing. The model learns from the query features through its multilayer perceptron structure and outputs a cardinality estimate of the result of this multi-table join query. The cardinality estimate is used to predict the final number of tuples that satisfy all conditions.
[0070] The query plan generation module is used to use the cardinality estimate as the main input for query cost evaluation, and combined with a query plan selection strategy based on reinforcement learning training, to generate an optimized multi-table join query execution plan outside the database. The reinforcement learning model adaptively selects the join order and underlying implementation method by reconstructing the plan selection process in the form of a join tree and using the execution time cost as a reward function.
[0071] The query execution and monitoring module is used to feed back the generated optimized query plan to the data query engine of the low-code platform for execution, and to capture the performance indicators of the query plan in real time during actual operation, including execution time and the actual number of tuples in the returned results, i.e., the true cardinality.
[0072] The adaptive learning module is used to input the actual execution effect of the query, especially the error between the true cardinality and the estimated cardinality, as feedback information into an adaptive learning framework. This framework collects several queries with the largest estimation errors and their actual data, re-encodes them using the word vector model, and then incrementally trains and fine-tunes the parameters of the multi-set convolutional neural network model. This dynamically adjusts and optimizes the subsequent cardinality estimation accuracy, forming a closed-loop optimization system from execution feedback to model self-improvement.
[0073] like Figure 1 As shown, this embodiment of the invention also provides a method for implementing combined query conditions in a low-code platform form, including the following steps:
[0074] S1 receives complex combined query conditions configured by the low-code platform user through a visual interface. These query conditions involve joins between multiple data tables. The query is then parsed to extract the set of data tables involved, the set of join conditions between the tables, and the set of data filtering predicates specified by the user.
[0075] S2, based on the parsed set of join conditions, automatically identifies the join keys between tables and constructs a schema graph to describe the join relationships between multiple tables. This schema graph uses tables as nodes and join relationships as edges, and provides a data structure foundation for subsequent query optimization.
[0076] S3 uses a word vector model to embed character-type predicates in the query, transforming the table set, join condition set, and predicate set into a structured query feature vector. This process can capture the semantic correlation between data column values, thus solving the problem of difficulty in quantifying and associating character-type predicates.
[0077] S4, the query feature vector is input into a pre-trained lightweight multi-table convolutional neural network model for processing. The model learns from the query features through its multilayer perceptron structure and outputs a cardinality estimate of the result of this multi-table join query. The cardinality estimate is used to predict the final number of tuples that satisfy all conditions.
[0078] S5. Using the cardinality estimate as the main input for query cost evaluation, and combining it with a query plan selection strategy based on reinforcement learning training, an optimized multi-table join query execution plan is generated outside the database. The reinforcement learning model adaptively selects the join order and underlying implementation method by reconstructing the plan selection process in the form of a join tree and using the execution time cost as a reward function.
[0079] S6 feeds back the generated optimized query plan to the data query engine of the low-code platform for execution and captures the performance metrics of the query plan in real time, including execution time and the actual number of tuples returned, i.e., the true cardinality.
[0080] S7. The actual execution effect of the query, especially the error between the true cardinality and the estimated cardinality, is used as feedback information and input into an adaptive learning framework. This framework collects several queries with the largest estimation errors and their actual data, re-encodes them using the word vector model, and then performs incremental training and parameter fine-tuning on the multi-set convolutional neural network model. This dynamically adjusts and optimizes the subsequent cardinality estimation accuracy, forming a closed-loop optimization system from execution feedback to model self-improvement.
[0081] As a preferred embodiment, such as Figure 2As shown, step S1 is specifically implemented in the following way: After receiving the complex combination query conditions configured by the low-code platform user through the visual interface, the parsing module first structures the original expression into three core object sets, denoted as the data table set T, the inter-table join condition set J, and the user-specified data filtering predicate set P, respectively. During the parsing process, the following three key tasks are completed:
[0082] Unique mapping between fields and tables: Complete field name disambiguation and output the mapping relationship of each predicate to the table. Output the mapping function m to map the predicate p to the table t for subsequent aggregation;
[0083] Predicate normalization: unifies various written forms of user input into a normalized predicate representation set P', including predicate type identifiers, operator standard codes, and the original vector representation of the character-type expression of the original text form. ;
[0084] Join condition normalization: The join expression is parsed into a binary relation triplet form t_ajoin_key_aopt_bjoin_key_b, and the join direction and equivalence / non-equivalence attributes are recorded, thus obtaining a structured J for subsequent graph construction. To quantify the importance of tables in subsequent optimization, this step uses an original scoring formula weighted by table connectivity and predicate "difficulty" to assign an importance score to each table t. The formula is as follows:
[0085] ;
[0086] in, The number of edges in the join condition set J obtained from the analysis indicates the connectivity of the table t. This represents the subset of predicates mapped to table t. This is an estimate of the predicate selectivity based on the current table's statistical histogram or the most recent query sample. To prevent the logarithm from diverging, a minimal constant, and The platform provides configurable weight hyperparameters to balance connectivity and predicate constraint tightness.
[0087] The purpose of this formula is to combine structural information with the estimation of the reduction of the result set by the predicate. The scoring effect is to enable the early identification of tables that should be given priority in the connection plan or are more likely to become cardinality bottlenecks, thereby providing informative priors for subsequent pattern graph node sorting and connection order candidate generation.
[0088] At the implementation level, the parser operates according to the following deterministic process:
[0089] Lexical segmentation: Separating field selection, comparison operations, constants, and logical connectives in visual controls;
[0090] Syntax unification: Using template matching and a set of extensible syntax rules, the combined conditions generated by the control are mapped to an abstract syntax tree and T, J and P are extracted from the tree;
[0091] Statistical completion: If column statistics exist in the metadata, calculate the initial selectivity for each predicate. Otherwise, an empirical selection rate is given based on column type and common dispersion heuristic rules, and marked as low confidence for subsequent feedback correction;
[0092] Character predicate preprocessing: Perform basic normalization on character constants, including case unification, segmentation with common delimiters and removal of stop words, while retaining the original string for subsequent word vector embedding.
[0093] During the parsing process, metadata is attached to each output element, including the source control identifier, user-displayed text, strings before and after parsing, and confidence scores. This step ultimately produces structured objects T, J, and P', along with an importance score set R for each table, and combines this content with the original character vectors of the predicates. This information is then passed to the next module used to automatically identify inter-table association keys and build a schema diagram.
[0094] As a preferred embodiment, such as Figure 2 As shown, step S2 is specifically implemented in the following way: After receiving the structured result from the previous step, the system begins to automatically identify the inter-table association keys and construct the schema graph based on the join condition set J. The parsing engine first scans each join condition in set J, and identifies the two tables involved. and Identify potential connection pairs and extract the corresponding connection field information.
[0095] During the identification phase, the system calls the table importance score output from the previous phase. This determines the join direction and weight allocation method. If the scores of the two tables differ significantly, the weights will be biased towards the table with the higher score to ensure that the table with high connectivity and high constraints maintains its dominant position in subsequent query optimization.
[0096] The construction of connection weights follows deterministic logic: first, the connection type is used to determine its equivalence or range nature, and then the table score is combined with the results. and The relative proportion determines the edge weight coefficient. This reflects the importance of connections between different tables at the structural level.
[0097] After completing the identification of all edge weights, the system constructs a pattern graph using the table set T as the node set and the connection set J as the edge set. During the graph construction process, the system assigns an importance score to each node. And the corresponding predicate tightness index, so that the pattern diagram describes both the connection relationship and the tightness of the logical constraints.
[0098] After the graph is constructed, the system performs topological connectivity detection, automatically corrects isolated nodes, and infers potential foreign key paths by retrieving historical query metadata, achieving full connectivity across the multi-table system. Subsequently, the system calculates the adjacency vector and aggregation weight metric for each node to measure the centrality and propagation influence of the node in the entire graph structure, supporting subsequent feature embedding and cardinality estimation processes.
[0099] This schema diagram is not only a carrier of structural information, but also the input basis for subsequent query optimization. It forms a high-dimensional representation of the relationships between tables at the semantic level, providing topological constraints and structural support for the next step of completing the embedding of character-type predicates and the vectorization of overall query features through word vector models.
[0100] As a preferred embodiment, such as Figure 3 As shown, step S3 is specifically implemented in the following way: after completing the pattern diagram After the initial construction, the system enters the character-based predicate embedding and query feature vectorization stage. The goal of this stage is to vectorize the predicate set... The textual conditions, along with the table and connection structure, are transformed into a feature representation in a continuous numerical space, so that the subsequent neural network model can learn from it and estimate its cardinality.
[0101] First, the system from Extract the original string vector of all character predicates. The data is then input into a pre-trained word vector model, where context windows and sub-word segmentation strategies are used to obtain the word embeddings in the global semantic space. The word embedding process outputs the initial embedding vector for each predicate. This vector not only contains character combination information but also captures the semantic distance between different field values, enabling the model to perceive the correlation between text data during the query optimization phase. To integrate pattern graph and word vector information at the structural level, the system defines a comprehensive representation vector for each table node. This vector is composed of the table's structural features, connection weights, and associated predicate embedding vectors, and is calculated using the following formula:
[0102] ;
[0103] in, For the subset of predicates mapped to table t, This represents the semantic relevance weight of predicate p to table t. For word embedding vectors, For the aforementioned table importance score, This represents the structural feature vector of a table node. The normalization coefficient is... To control the balance between semantic and structural fusion strength, this formula uses a weighted average to achieve a collaborative representation of semantics and structure. This distributes nodes from different tables in the vector space according to the semantic strength of their predicate constraints and the importance of their connections, thus providing a context-sensitive feature foundation for complex queries. Subsequently, the system performs a feature aggregation operation on the entire schema graph structure to obtain a representation vector at the overall query level. The formula is:
[0104] ;
[0105] Where |T| represents the total number of tables, and σ is the nonlinear activation function. and These are the weight matrices used to map structural and relational features, respectively. This represents the aggregation relation vector of table nodes in the schema graph. This aggregation process unifies semantic embedding and schema structure into a continuous feature space, thereby resulting in the final query feature vector. It also reflects the semantic associations of character predicates, the topological relationships of inter-table connections, and the importance distribution of each table.
[0106] This vectorization result provides a high-dimensional and information-rich feature foundation for the input of subsequent multi-set convolutional neural network models, ensuring that the model can learn the logic and data association of complex combined queries in a unified numerical form, and establishing semantic support for the accuracy of the next cardinality estimation step.
[0107] As a preferred embodiment, such as Figure 3 As shown, step S4 is specifically implemented in the following way: after obtaining the query feature vector... The system then inputs the data into a pre-trained lightweight multi-ensemble convolutional neural network model for cardinality estimation. This model consists of multiple perceptron layers and ensemble convolutional modules, used to capture structural dependencies between table nodes, semantic associations of predicates, and complex interactions between tables and predicates. The ensemble convolutional modules target the vector of each table node. Local aggregation is performed, and the information of adjacent nodes is weighted and passed through a weight matrix, thereby generating updated node representations at each layer. The final aggregate vector is obtained after multiple iterations. The vectors preserve both local semantics and global topological features.
[0108] Subsequently, the system globally summarizes the final representations of all table nodes, combining this with the table's importance score. The contributions of different nodes are weighted to generate an overall cardinality estimate. The cardinality estimate formula is:
[0109] ;
[0110] in, This indicates the predicted number of tuples in the multi-table query results. Let θ be the mapping function of the multilayer perceptron and its set of trainable parameters. This represents the weighting coefficient of table nodes in the global aggregation, ensuring that high-scoring tables have a greater impact on the final cardinality estimate. The formula is designed by scoring table importance. Node representations after multi-set convolution The fusion enables joint modeling of cardinality prediction based on semantic information, table join structure, and predicate constraints, which can effectively alleviate the bias problem of traditional estimation methods in the case of complex multi-table joins.
[0111] Cardinality estimate of output This provides core cost evaluation metrics for subsequent query plan selection, enabling the reinforcement learning module to adjust the connection order and execution strategy based on the expected number of tuples when generating optimized query plans, thus laying the foundation for the next step of query plan optimization and execution.
[0112] As a preferred embodiment, such as Figure 4 As shown, step S5 is specifically implemented in the following way: after obtaining the base estimate... Afterwards, the system enters the query plan generation stage, using a reinforcement learning-based strategy selection method to construct a multi-table join plan outside the database.
[0113] This stage first maps all table sets T and join condition sets J into a candidate space for join trees. Each node in the tree corresponds to a table or intermediate result, and edges represent join operations. The reinforcement learning agent uses the join tree structure as its state representation. and through policy network Output the action probability distribution to select the next connection operation. The action space includes the selection of the connection order, the selection of the connection algorithm type (such as hash connection, nested loop connection), and the adjustment of execution parameters. The agent adjusts these parameters based on the cardinality estimate. Importance score of table Calculate the expected cost of the current action. The formula is:
[0114] ;
[0115] in, To select an action The cardinality estimate of the generated intermediate connection results. Let be the set of tables involved in the action, and α and β be hyperparameters that control the cardinality and the weights of table importance on the action value. This value function guides the policy network to prioritize candidate connection operations, achieving priority connections to high-potential nodes and key tables.
[0116] During strategy execution, the system defines a reward function. Based on actual execution time The negative value is used as the reward signal. The reinforcement learning objective is to maximize the long-term cumulative reward, and the formula is:
[0117] ;
[0118] in, This represents a policy network with parameter ϕ, where T is the length of the action sequence in the connection plan. This is to simulate the execution time outside the database.
[0119] By using reinforcement learning-based connection tree search, the system can adaptively balance the importance of tables, predicate constraints, and cardinality prediction information, select the optimal connection order and underlying execution strategy, and generate an efficient and near-optimal multi-table query execution plan. This provides strategic input for the next step of actual execution in the data query engine of the low-code platform and ensures that performance metrics can be captured for closed-loop feedback in real operation.
[0120] As a preferred embodiment, such as Figure 4 As shown, step S6 is implemented in the following way: after the optimized query plan is generated, the system sends the plan to the data query engine of the low-code platform for actual execution.
[0121] During execution, the platform engine progressively completes table joins, predicate filtering, and intermediate result calculations according to the connection order and execution strategy output by the reinforcement learning module, while simultaneously collecting performance metrics in real time at each operation node. Key metrics include execution time. The actual number of tuples returned ,in This corresponds to the previous step of cardinality estimation. The true base number.
[0122] To facilitate error analysis in the subsequent adaptive learning module, the system uses the intermediate cardinality of each node. and corresponding estimated value Save and calculate the global relative error. The formula representing the overall base prediction bias is:
[0123] ;
[0124] in, To determine the total number of tuples returned by the query. This is the cardinality estimate predicted by the previous multi-ensemble convolutional neural network model. The purpose of this formula is to quantify the difference between the cardinality estimate and the actual result, reflecting both the accuracy of a single query execution and providing error feedback for subsequent incremental training. During execution, the platform also records auxiliary performance metrics such as operation time, memory usage, and I / O latency to enrich subsequent iterative adjustments to the reinforcement learning reward function.
[0125] After the data collection is complete, the system will include , The complete dataset containing performance information for each node is transmitted to the adaptive learning framework, providing high-quality feedback for subsequent incremental model training and cardinality estimation optimization, thus providing fundamental data support for closed-loop optimization. Specifically, the adaptive learning framework receives query execution performance metrics, filters high-error queries and real data, and re-encodes them for incremental training and parameter fine-tuning of the convolutional neural network model to achieve closed-loop optimization.
[0126] As a preferred embodiment, such as Figure 5 As shown, step S7 is specifically implemented in the following way: After receiving the collected execution data, the adaptive learning framework adjusts the cardinality estimation error. The analysis was performed, and the query instances with the largest errors were selected first. and their corresponding actual execution results As training samples, the system first re-encodes the character-type predicates in the query using the existing word vector model to generate updated embedding vectors. And combined with the node representation of the pattern diagram and the importance score Form a new query feature vector This ensures that the updated features fully reflect the impact of actual execution on semantics and structure.
[0127] Then The multi-set convolutional neural network model is incrementally trained using the input, and the error between the actual cardinality and the predicted cardinality is minimized by fine-tuning the weight parameters θ. The optimization objective is expressed using the relative error loss function as:
[0128] ;
[0129] in, This represents the cardinality prediction value for the i-th query under model parameters θ. This represents the actual number of tuples returned. The number of error samples is denoted as . This loss function strengthens the penalty for large-biased queries by using squared relative error, causing the incremental training process to prioritize adjusting the weight parameters corresponding to high-biased samples, thereby improving the overall model's cardinality prediction accuracy for complex combined queries.
[0130] After incremental training is completed, the updated multi-set convolutional neural network can more accurately estimate the number of tuples in new queries and continuously apply the optimized model state to the next round of query optimization, realizing a closed-loop optimization mechanism from execution feedback to model self-improvement, ensuring that the low-code platform has dynamic adaptability and continuous optimization capabilities when facing complex multi-table combined queries.
[0131] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only.
[0132] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A method for implementing combined query conditions in a low-code platform form, characterized in that, Includes the following steps: It receives and parses complex combined query conditions to obtain a set of data tables, a set of inter-table join conditions, and a set of user-specified data filtering predicates. Based on the set of connection conditions, the inter-table association keys are identified and a pattern graph is constructed with data tables as nodes and connection relationships as edges. A word vector model is used to embed character-type predicates in the query, and the data table set, the set of inter-table join conditions, and the set of predicates are transformed into a structured query feature vector. The cardinality estimate of the results of this multi-table join query is learned from the query feature vector based on the convolutional neural network model. The cardinality estimate is used as the main input for query cost evaluation. Combined with a query plan selection strategy based on reinforcement learning training, an optimized multi-table join query execution plan is generated outside the database. The multi-table join query execution plan is fed back to the data query engine of the low-code platform for execution, and the performance indicators of the query plan in actual operation are captured in real time; the performance indicators include execution time and the actual number of tuples in the returned results, and the actual number of tuples is the true cardinality of the corresponding cardinality estimate; Calculate the overall base prediction bias based on the actual base and the base estimate; The performance metrics are input into the adaptive learning framework, and several queries with the largest estimation errors and their actual data are collected. After being re-encoded using the word vector model, the convolutional neural network model is incrementally trained and its parameters are fine-tuned to complete the closed-loop optimization of the word vector model. Specifically, this includes: analyzing the cardinality estimation error through the adaptive learning framework, and selecting several query instances with cardinality prediction deviations that are among the top preset and their corresponding actual execution results as training samples. The character-type predicates in the query are re-encoded based on the word vector model to generate an updated embedding vector, and combined with the data table and table importance score to form a new query feature vector; The new query feature vector is used as input to incrementally train the convolutional neural network model, and the weight parameters are fine-tuned to minimize the cardinality prediction bias.
2. The method according to claim 1, characterized in that, The complex combination query conditions are configured by the user through a visual interface on the low-code platform. The parsing process is as follows: Establish a mapping function to map user-specified data filtering predicates to their respective data tables, thus completing field name disambiguation; Predicates with multiple writing forms are normalized into a standardized predicate representation set, which includes predicate type identifiers, operator standard codes, and vector representations in their original text form. The table join condition expression is parsed into a structured binary relation triplet form, and the join direction and equivalence or non-equivalence attributes are recorded to obtain a structured set of table join conditions.
3. The method according to claim 2, characterized in that, The parsing process includes: Calculate the number of edges in the set of join conditions for each table; based on the set of predicates mapped to each table, calculate the selectivity of each predicate; Different weights are assigned to the number of edges and the selectivity of each predicate in the data table to generate an importance score for each table, resulting in a set of data table importance scores.
4. The method according to claim 3, characterized in that, The specific steps for identifying inter-table association keys and constructing a pattern graph with data tables as nodes and connection relationships as edges are as follows: Based on the parsing engine, the set of inter-table join conditions is scanned to identify potential data table join pairs and extract the corresponding join field information; Based on the set of importance scores for the data tables, the direction of the inter-table joins is determined and the join weights are assigned, wherein the join weights are determined according to the join type and the relative proportion of the importance scores of the two data tables; The data table set is used as the node set, the set of inter-table connection conditions is used as the edge set, and each node is injected with its importance score and corresponding predicate tightness index to construct a pattern graph. The pattern graph is subjected to topological connectivity detection and connectivity correction to ensure the connectivity of the graph; The adjacency vector and aggregation weight metric of each node in the pattern graph are calculated to characterize the centrality and propagation influence of the node in the graph's topology.
5. The method according to claim 4, characterized in that, The step of using a word vector model to embed character-type predicates in the query, and transforming the data table set, inter-table join condition set, and predicate set into a structured query feature vector, specifically involves: The original string vectors of character-type predicates in the predicate representation set are input into a pre-trained word vector model. The embedding representations of words in the global semantic space are obtained through the context window and the sub-word segmentation strategy, and the initial embedding vector of each predicate is output. Based on the initial embedding vector and pattern graph, the comprehensive feature representation vector of each data table node is calculated by weighted averaging. Aggregate the comprehensive feature representation vectors of all data table nodes to generate a query-level feature vector representing the entire query.
6. The method according to claim 5, characterized in that, The convolutional neural network model is a pre-trained lightweight multi-ensemble convolutional neural network model, consisting of multiple perceptron layers and ensemble convolutional modules; the calculation method for the cardinality estimate is as follows: By using the ensemble convolution module, local aggregation is performed on the vector of each data table node. The information of adjacent nodes is weighted and passed through the weight matrix. An updated node representation is generated at each layer, and the final aggregated vector is obtained after multiple iterations. The final aggregated vectors of all data table nodes are globally summarized, and the contributions of different nodes are weighted based on the importance score of the table to generate an overall cardinality estimate.
7. The method according to claim 6, characterized in that, The step of using the cardinality estimate as the main input for query cost evaluation, combined with a query plan selection strategy based on reinforcement learning training, to generate an optimized multi-table join query execution plan outside the database is as follows: Map all data table sets and inter-table join condition sets to a join tree candidate space, where the nodes of the tree represent data tables or intermediate results, and the edges represent join operations; The reinforcement learning agent uses the current connection tree structure as its state representation, generates an action probability distribution through a policy network, and selects the next connection operation from the action space. The action space includes connection order selection, connection algorithm type selection, and execution parameter adjustment. Based on the cardinality estimate and importance score, the expected cost of the current action is calculated, and the value function guides the policy network to prioritize high-potential connection operations. The negative value of the action execution time is used as a reward signal. The network parameters of the optimization strategy are generated by maximizing the long-term cumulative reward.
8. A low-code platform form combination query condition implementation system, used to implement the method according to any one of claims 1-7, characterized in that, include: The query condition receiving and parsing module is used to receive and parse complex combination query conditions configured by the user to obtain a set of data tables, a set of inter-table join conditions, and a set of data filtering predicates specified by the user. The pattern graph construction module is used to identify the inter-table association keys and construct a pattern graph with data tables as nodes and connection relationships as edges based on the set of connection conditions. The query feature vectorization module is used to embed character-type predicates in the query using a word vector model, and to transform the data table set, the set of join conditions between tables, and the set of predicates into a structured query feature vector. The cardinality estimation module is used to learn from the query feature vector based on the convolutional neural network model and output the cardinality estimate of the result of this multi-table join query, which is used to predict the final number of tuples that satisfy all conditions. The query plan generation module is used to take the cardinality estimate as the main input for query cost evaluation, and combine it with a query plan selection strategy based on reinforcement learning training to generate an optimized multi-table join query execution plan outside the database. The reinforcement learning model adaptively selects the join order and underlying implementation method by reconstructing the plan selection process in the form of a join tree and using the execution time cost as a reward function. The query execution and monitoring module is used to feed back the generated optimized query plan to the data query engine of the low-code platform for execution, and to capture the performance indicators of the query plan in real time during actual operation, including execution time and the actual number of tuples in the returned results, i.e., the true cardinality. The adaptive learning module is used to input the performance metrics into the adaptive learning framework, collect several queries with the largest estimation errors and their actual data, re-encode them using the word vector model, and then perform incremental training and parameter fine-tuning on the convolutional neural network model to complete the closed-loop optimization of the word vector model.
Citation Information
Patent Citations
Multi-table joint query method under low-code platform
CN117235119A