A Deep Learning-Based Method and Apparatus for Estimating Cardinality of Skyline Queries

By constructing a data distribution learning model and a cardinality estimation model based on deep learning, the problems of low accuracy and low efficiency in Skyline query cardinality estimation are solved, and efficient support for Skyline query variants is achieved, improving the accuracy and robustness of the model.

CN115392477BActive Publication Date: 2025-11-14ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210884022.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-26
Publication Date
2025-11-14
Estimated Expiration
2042-07-26

AI Technical Summary

Technical Problem

Existing methods for estimating the cardinality of Skyline queries are inaccurate and inefficient, cannot effectively support Skyline query variants, especially reverse Skyline queries, and are extremely time-consuming.

Method used

A deep learning-based approach is adopted to construct a data distribution learning model and a cardinality estimation model by parsing historical query logs. The model is trained using a deep self-attention transform network and a Transformer neural network to achieve a fast and accurate estimation of the query cardinality of Skyline.

Benefits of technology

It improves the accuracy and efficiency of Skyline query cardinality estimation, supports various Skyline query variants, and enhances the robustness and scalability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115392477B_ABST
    Figure CN115392477B_ABST
Patent Text Reader

Abstract

This invention discloses a deep learning-based method and apparatus for estimating the cardinality of Skyline queries. The method includes: parsing historical query logs of a database to obtain Skyline queries and their corresponding cardinality on a given target dataset, constructing a training set; constructing and training data distribution learning models based on the distribution information of the target dataset and the training set; using the model parameters of the trained data distribution learning models as initialization parameters for the cardinality estimation model, and training the cardinality estimation model based on the training set; and inputting a query point based on the trained cardinality estimation model to obtain the final cardinality estimate. This invention provides a solution for cardinality estimation of Skyline query variants and ensures the monotonicity property present in the cardinality estimation of Skyline query variants. It proposes an efficient and accurate cardinality estimation method with advantages such as high accuracy, high efficiency, strong robustness, and strong scalability. It has broad application scenarios in modern database management systems and query optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information retrieval technology, and in particular to a method and apparatus for estimating the cardinality of Skyline queries based on deep learning. Background Technology

[0002] Skyline queries are a classic multi-objective optimization problem that returns the optimal set of data based on the queryer's preferences, making them one of the most classic database queries. Skyline queries have wide applications in multi-objective decision-making problems, such as customer information services, recommender systems, decision support, and decision systems, demonstrating significant practical value and research potential. In recent years, various variations of skyline queries have been proposed, such as dynamic skyline queries, inverse skyline queries, k-Dominant skyline queries, k-Skyband queries, and ε-skyline queries, greatly enriching the connotation of traditional skyline queries and expanding their application scenarios.

[0003] When these Skyline operations are integrated into a database management system, the issue of Skyline query cardinality estimation arises. This is crucial because the query optimizer is an indispensable component of the database management system, and accurate and efficient cardinality estimation is essential for query optimization. Query optimization requires estimating the size of intermediate results (i.e., cardinality estimation) in order to propose an optimal execution plan. When the execution plan is based on an incorrect cardinality estimate, it will be several orders of magnitude slower than the optimal plan. Furthermore, if the cardinality estimation operation itself is inefficient, query optimization loses its purpose.

[0004] Currently, there are some statistical methods for estimating the cardinality of Skyline queries, such as sampling-based, kernel density-based, and histogram-based methods. However, these methods still have limitations: (1) These Skyline query cardinality estimation methods still provide suboptimal solutions; (2) These traditional methods require the entire estimation process to be performed for each query object, which is very time-consuming when the query volume is large; (3) These methods do not support Skyline query variants well, especially inverse Skyline queries, and there is currently a lack of a general solution for estimating the cardinality of these Skyline query variants. Summary of the Invention

[0005] The purpose of this application is to provide a method and apparatus for estimating the cardinality of Skyline queries based on deep learning, so as to solve the problem that traditional cardinality estimation methods are difficult to estimate the cardinality of Skyline queries quickly and accurately.

[0006] According to a first aspect of the embodiments of this application, a deep learning-based Skyline query cardinality estimation method is provided, comprising:

[0007] Analyze the historical query log information of the database to filter out the Skyline queries and their corresponding cardinality on the target dataset;

[0008] Construct a training set based on Skyline queries and their corresponding cardinality;

[0009] Based on the distribution information of the target dataset and the training set, construct and train their respective data distribution learning models;

[0010] A cardinality estimation model is constructed by using the model parameters of the trained data distribution learning model as the initialization parameters of the cardinality estimation model, and training the cardinality estimation model using the training set.

[0011] Based on the trained cardinality estimation model, the final cardinality estimate is obtained by inputting the query point.

[0012] Furthermore, the Skyline query can be a dynamic Skyline query, a reverse Skyline query, a dynamic k-Dominant Skyline query, a dynamic k-Skyband query, or a dynamic ε-Skyline query.

[0013] Furthermore, the historical query log information of the database is parsed to filter out the Skyline queries and their corresponding cardinality on the target dataset, including:

[0014] Parse and filter the query statements from the historical query log information to extract the Skyline queries and their corresponding cardinality on the target dataset. The Skyline query includes the query point and its query parameters.

[0015] The size of the query result set, i.e., the query cardinality, is determined from the query results of Skyline.

[0016] Furthermore, the construction and training process of the data distribution learning model includes:

[0017] Construct a deep self-attention transformation network;

[0018] After sampling and encoding the target dataset or training set, a certain proportion of values ​​are randomly masked to obtain the masked data.

[0019] The masked data is input into a deep self-attention transformation network for training to obtain a data distribution learning model. The task of model training is to predict these masking values, and the model optimization objective is to maximize the conditional likelihood probability of the masking values.

[0020] Furthermore, the construction and training process of the cardinality estimation model includes:

[0021] 1) Construct a cardinality estimation sub-model M based on query points Q The cardinality estimation sub-model M Q The first deep neural network consists of a Transformer, a pooling layer, and a linear connection layer. The initial parameters are the parameters of the model learned from the data distribution on the target dataset.

[0022] 2) Construct a cardinality estimation sub-model M based on query parameters. P The cardinality estimation sub-model M P The second deep neural network consists of a Transformer, a pooling layer, and a linear connection layer. The initial parameters are the parameters of the model learned from the data distribution on the training set.

[0023] 3) The query points are encoded and input into the first deep neural network for training to obtain the cardinality estimation sub-model M. Q The query point and query parameters are concatenated, encoded, and then input into the second deep neural network for training, resulting in a cardinality estimation sub-model M based on the query parameters. P Among them, the cardinality estimation submodel M based on query parameters P During training, the model parameters are kept positive. The optimization objective is to minimize the error between the weighted average of the outputs of the two cardinality estimation sub-models and the true cardinality value.

[0024] Furthermore, based on the trained cardinality estimation model, the final cardinality estimate is obtained by inputting the query point, including:

[0025] The query point and query parameters are parsed from the query statement, encoded, and then input into the trained cardinality estimation model. The model output is further processed by inverse normalization to obtain the final cardinality estimate.

[0026] According to a second aspect of the present invention, a deep learning-based Skyline query cardinality estimation apparatus is provided, comprising:

[0027] The parsing and filtering module is used to parse the historical query log information of the database and filter it to obtain the Skyline queries and their corresponding cardinality on the target dataset.

[0028] The first construction module is used to build a training set based on the Skyline query and its corresponding cardinality.

[0029] The first construction training module is used to construct and train respective data distribution learning models based on the distribution information of the target dataset and the training set.

[0030] The second construction training module is used to construct a cardinality estimation model, using the model parameters of the trained data distribution learning model as the initialization parameters of the cardinality estimation model, and training the cardinality estimation model through the training set;

[0031] The query estimation module is used to obtain the final cardinality estimate by inputting a query point based on the trained cardinality estimation model.

[0032] According to a second aspect of the present invention, an electronic device is provided, comprising:

[0033] One or more processors;

[0034] Memory, used to store one or more programs;

[0035] When the one or more programs are executed by the one or more processors, the one or more processors perform the method as described in the first aspect.

[0036] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having computer instructions stored thereon, characterized in that, when executed by a processor, the instructions implement the steps of the method as described in the first aspect.

[0037] The technical solutions provided by the embodiments of this application may include the following beneficial effects:

[0038] As can be seen from the above embodiments, this application uses a deep learning-based approach to estimate the cardinality of Skyline queries, thus overcoming the problems of low estimation accuracy and slow estimation caused by experience-based methods in traditional methods. This achieves a comprehensive improvement in efficiency, accuracy, robustness, and scalability. By learning the data distribution of the target dataset and training set through a data distribution learning model, the influence of data distribution on Skyline query results is overcome, thereby enhancing the accuracy of the model and enabling the method to support various data distributions.

[0039] The model designed in this application is applicable to almost all Skyline query variants, providing a solution to the cardinality estimation problem for these Skyline query variants.

[0040] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0042] Figure 1This is a flowchart of a Skyline query cardinality estimation method based on deep learning, according to an embodiment of the present invention.

[0043] Figure 2 This is a block diagram of the data distribution learning model according to an embodiment of the present invention.

[0044] Figure 3 This is a block diagram of the cardinality estimation model according to an embodiment of the present invention.

[0045] Figure 4 This is a block diagram of a Skyline query cardinality estimation device based on deep learning, according to an embodiment of the present invention. Detailed Implementation

[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0047] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0048] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0049] Example 1

[0050] Figure 1 This is a flowchart of a Skyline query cardinality estimation method based on deep learning according to an embodiment of the present invention. Figure 2 This is a block diagram of the data distribution learning model according to an embodiment of the present invention. Figure 3 This is a block diagram of a cardinality estimation model according to an embodiment of the present invention. The method includes the following steps:

[0051] Step S100: Parse the historical query log information of the database, and filter out the Skyline queries and their corresponding cardinality on the target dataset. This includes the following steps:

[0052] Step S101: Parse and filter the Skyline queries and their corresponding cardinality on the target dataset from the query statements in the historical query log information, where the Skyline query includes the query point and its query parameters;

[0053] Specifically, the target dataset D and a Skyline query to be performed are determined, such as the dynamic k-DominantSkyline query in this description. The dimension of the target dataset D is d; the database historical query log information is parsed to extract the target dataset D, the query point Q of the dynamic k-DominantSkyline query, and its query parameters P from the query statement.

[0054] Step S102: Parse the size of the query result set, i.e., the query cardinality, from the query results of Skyline;

[0055] Specifically, the size of the query result set, i.e., the query cardinality C, is obtained by parsing the query results of the dynamic k-DominantSkyline query.

[0056] Step S200: Construct a training set based on the Skyline query and its corresponding cardinality, specifically including the following steps:

[0057] Step S201: Take the query point Q, query parameter P, and query cardinality C extracted from the dynamic k-DominantSkyline query in step S102 and form several...<Q,P,C> Triples. If there are no corresponding query parameters, such as in a dynamic Skyline query or a reverse Skyline query, then P is recorded as 0.

[0058] Step S202: If extracted from the database historical query log<Q,P,C> If there aren't enough triples, additional triples need to be generated. This involves uniformly generating several query points Q within the target dataset D, randomly assigning query parameters P according to a uniform distribution, executing a dynamic k-DominantSkyline query based on the generated Q and P, obtaining the result set size C, and generating a new batch of triples. All generated triples are used as the training set.

[0059] Step S300: Based on the distribution information of the target dataset and the training set, construct and train their respective data distribution learning models.

[0060] Step S301: The processing procedure for the model input step is described as follows:

[0061] Step S30101: Perform simple random sampling of the target dataset according to a certain proportion. A sampling rate of 6% is recommended here to balance efficiency and accuracy. Assume there are s data points after sampling. This application uses a sampling technique, thus overcoming the problem of low model training efficiency due to large datasets, thereby enabling the method to support larger datasets.

[0062] Step S30102: Assume that database D has d dimensions containing c discrete variables and u continuous variables. Then, the u continuous variables need to be converted into discrete variables using an equidistant discretization method. For example, the i-th variable X in the database... i It is a continuous variable. Therefore, X... i Divide the space into β equal-width buckets. Assume X i The range is The interval width is defined as: Then x i Discretized result By discretizing the function To obtain. That is... Here, floor(·) is the floor function. After converting all continuous data into discrete data using the above method, all discrete data are encoded using one-hot encoding. Assume the number of distinct values ​​after discretization of the i-th dimension is n. i Then the length of the encoding for each dimension is n. i The total length of each encoded data entry is Let n be the size of the original matrix. That is, the size of the encoded matrix is ​​s×d. That is, s×n, and the encoded matrix is ​​denoted as x. This application uses an equidistant discretization method to transform continuous data into discrete data, thus overcoming the technical problem that the model input cannot support continuous data, and thereby achieving the effect that the method can support more data types.

[0063] Step S30103: Generate a mask matrix M of size s×d, where the values ​​are either 0 or 1. Where M... ij =1 indicates that the j-th dimension of the i-th data point is masked and needs to be predicted; otherwise, masking and prediction are unnecessary. A masking rate of 15% is recommended here. Then, the s×d mask matrix M is transformed into a s×n mask matrix M′, where if M... ij =1, then The rest are 0. The codes that need to be masked in x are masked with 0 according to the mask matrix M′, denoted as x′, where the masked values ​​will be used as labels to guide the training of the model.

[0064] Step S302: Construct and train the data distribution learning model, the model structure is as follows Figure 2 As shown. The specific process is described below:

[0065] Step S30201: According to... Figure 2 The model structure shown is constructed by adding a normalization module and a linear layer after l Transformer modules.

[0066] Step S30202: Input the matrix x′ obtained in step S30103 into the model. The model output is a matrix of size s×n, which represents the probability of each value in the sampled target dataset, denoted as p. Then the loss function is Loss. pre Using the masked cross-entropy loss function, the loss function for the i-th sample is:

[0067]

[0068] The loss function for all samples is:

[0069]

[0070] Step S30203: The data distribution learning model minimizes its loss function. pre Perform batch training until the model reaches the maximum number of iterations, then stop training to obtain the optimal model parameters M. D .

[0071] Step S303: Following steps S301 and S302, construct and train a data distribution learning model M on the training set. Q-P Change the input target dataset of the model in the step to the training set.<Q,P> Furthermore, the optimal model parameters M can be obtained without sampling on the training set. Q-P .

[0072] Step S400: Construct and train the cardinality estimation model, which specifically includes the following steps:

[0073] Step S401: Construct a cardinality estimation sub-model M based on the query point Q Specifically, it includes the following steps:

[0074] Step S40101: Perform one-hot encoding on the training set Q as described in step S30102, and use it as the input to the model. Assume the size of the training set Q is n. q ×d, and the size of the encoded training set is That is, n q ×n.

[0075] Step S40102: According to Figure 3 The model structure is constructed based on the cardinality estimation sub-model M of the query point. Q This involves a Transformer module plus an average pooling layer and a linear layer. The parameters of the Transformer module are initialized to the data distribution on the target dataset, and the model's cardinality M is learned. D The parameters of the Transformer module.

[0076] Step S40103: Cardinality estimation sub-model M based on query point Q The output is Size n q ×1.

[0077] Step S402: Construct a cardinality estimation sub-model M based on query parameters P Specifically, it includes the following steps:

[0078] Step S40201: Process the training set in the manner described in step S30102.<Q,P> One-hot encoding is performed and used as the input to the model. Assume the training set...<Q,P> The size is n q ×(d+1), the number of distinct values ​​of parameter P is n p The size after encoding is That is, n q ×(n+n p ).

[0079] Step S40202: According to Figure 3 The model structure is constructed based on the cardinality estimation sub-model M of the query parameters. P This involves a Transformer module plus an average pooling layer and a linear layer. The parameters of the Transformer module are initialized to the data distribution on the training set, and the model cardinality M is learned. Q-P The parameters of the Transformer module.

[0080] Step S40203: Cardinality estimation sub-model M based on query parameters P The output is Size n q ×1.

[0081] Step S40204: Note that during model training in step S405, the cardinality estimation sub-model M based on the query parameters... P Clamping is performed on the parameters, such as Figure 3 As shown, its parameters are kept positive to ensure The value increases with the query parameter P. This application guarantees the cardinality estimation sub-model M based on the query parameter. PThe model parameters are all positive numbers, thus ensuring the monotonic property that the query cardinality changes with the query parameters, thereby improving the accuracy and interpretability of the method.

[0082] Step S403: The outputs of the two cardinality estimation sub-models are weighted and averaged to obtain the final cardinality estimate, which is the model output obtained in steps S40103 and S40203. and It is obtained through a weighted average, with a size of n. q ×1. That is...

[0083]

[0084] The recommended value for α in equation (3) is 0.8. When the query operation is a dynamic k-DominantSkyline query or a dynamic k-Skyband query, the cardinality C increases with the increase of the query parameter P, and the sign in equation (3) is "+"; when the query operation is a dynamic ε-Skyline query, the cardinality C decreases with the increase of the query parameter P, and the sign in equation (3) is "-".

[0085] Step S404: Calculate the results obtained from the cardinality estimation model. The normalized true values ​​C from the training set are used as input to the mean squared error loss function to guide the optimization of model parameters. That is, the true values ​​C are normalized to [0,1] using the MaxMinScaler(·) function, denoted as y, and the loss function Loss is:

[0086]

[0087] The MaxMinScaler() function normalizes a vector X to X. std Its range is [0,1], and the specific formula is:

[0088]

[0089] Where X min and X max These are the minimum and maximum values ​​of vector X, respectively. This application uses the normalized value of the predicted cardinality instead of directly predicting the true value of the cardinality because the cardinality varies greatly, especially the cardinality of the Skyline query variant. Therefore, normalizing the cardinality to a uniform order of magnitude can make the model converge faster and more accurately.

[0090] Step S405: The cardinality estimation model is trained in batches by minimizing its loss until the model training reaches the maximum number of model iterations or the loss on the validation set no longer decreases after 3 consecutive iterations, thus obtaining the optimal model parameters.

[0091] Step S500: Using the trained cardinality estimation model, input the query point to obtain the final cardinality estimate, specifically including the following steps:

[0092] Step S501: Parse the input dynamic k-Dominant Skyline query statement and extract the query point Q and query parameter P.

[0093] Step S502: Following the method in step S30102, test Q and Q in the test set respectively.<Q,P> One-hot encoding is performed and used as input to the two query estimation sub-models.

[0094] Step S503: Input the result of step S502 into the query estimation model trained in step S405, and obtain...

[0095] Step S504: Obtain the solution from step S503 The final estimated cardinality C′ is obtained by inverse normalization using the InverseTrans(·) function. The InverseTrans(·) function normalizes a vector X to X using the MaxMinScaler(·) function. std Then, perform inverse normalization to X. The specific formula is:

[0096] X = InverseTrans(X) std ) = X std ×(X max -X min )+X min (6)

[0097] X in equation (6) min and X max With X in equation (5) min and X max The meaning is the same as the numerical value.

[0098] Step S505: The cardinality estimate C′ obtained in step S504 is the cardinality estimate for this query.

[0099] This invention also provides an embodiment of a Skyline query cardinality estimation device based on deep learning. Since the Skyline query cardinality estimation device provided by this invention corresponds to the embodiment of the Skyline query cardinality estimation method, and the Skyline query cardinality estimation device can achieve the purpose of this invention by executing the process steps in the specific implementation of the above method, the explanations in the embodiments of the Skyline query cardinality estimation method based on deep learning described above are also applicable to the embodiment of the Skyline query cardinality estimation device based on deep learning provided by this invention, and will not be repeated in the following embodiments of this invention.

[0100] like Figure 4 As shown, this embodiment of the invention also provides a deep learning-based Skyline query cardinality estimation device, comprising:

[0101] The parsing and filtering module 101 is used to parse the historical query log information of the database and filter out the Skyline queries and their corresponding cardinality on the target dataset.

[0102] The first construction module 102 is used to construct a training set based on the Skyline query and its corresponding cardinality.

[0103] The first construction and training module 103 is used to construct and train respective data distribution learning models based on the distribution information of the target dataset and the training set.

[0104] The second construction training module 104 is used to construct a cardinality estimation model, using the model parameters of the trained data distribution learning model as the initialization parameters of the cardinality estimation model, and training the cardinality estimation model through the training set;

[0105] The query estimation module 105 is used to obtain the final cardinality estimate by inputting a query point based on the trained cardinality estimation model.

[0106] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0107] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0108] Accordingly, this application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the deep learning-based Skyline query cardinality estimation method described above.

[0109] Accordingly, this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the deep learning-based Skyline query cardinality estimation method described above.

[0110] 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, and the true scope and spirit of this application are indicated by the claims.

[0111] 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. The scope of this application is limited only by the appended claims.

Claims

1. A deep learning-based method for estimating the cardinality of Skyline queries, characterized in that, include: Analyze the historical query log information of the database to filter out the Skyline queries and their corresponding cardinality on the target dataset; Construct a training set based on Skyline queries and their corresponding cardinality; Based on the distribution information of the target dataset and the training set, construct and train their respective data distribution learning models; A cardinality estimation model is constructed by using the model parameters of the trained data distribution learning model as the initialization parameters of the cardinality estimation model, and training the cardinality estimation model using the training set. Based on the trained cardinality estimation model, the final cardinality estimate is obtained by inputting the query point; The construction and training process of the cardinality estimation model includes: 1) Construct a cardinality estimation sub-model M based on query points Q The cardinality estimation sub-model M Q The first deep neural network consists of a Transformer, a pooling layer, and a linear connection layer. The initial parameters are the parameters of the model learned from the data distribution on the target dataset. 2) Construct a cardinality estimation sub-model M based on query parameters. P The cardinality estimation sub-model M P The second deep neural network consists of a Transformer, a pooling layer, and a linear connection layer. The initial parameters are the parameters of the model learned from the data distribution on the training set. 3) The outputs of the two cardinal estimation sub-models are weighted and averaged to obtain the final cardinal estimate; 4) The results obtained from the cardinality estimation model are normalized with the true cardinality values ​​in the training set and used as the input to the mean squared error loss function to guide the optimization of model parameters; 5) The query point is encoded and input into the first deep neural network for training to obtain the cardinality estimation sub-model M. Q The query point and query parameters are concatenated, encoded, and then input into the second deep neural network for training, resulting in a cardinality estimation sub-model M based on the query parameters. P Among them, the cardinality estimation submodel M based on query parameters P During training, the model parameters are kept positive. The optimization objective is to minimize the error between the weighted average of the outputs of the two cardinality estimation sub-models and the true cardinality value.

2. The method according to claim 1, characterized in that, The Skyline query includes dynamic Skyline query, reverse Skyline query, and dynamic... k Dominant Skyline Search & Updates k -Skyband query or updates ε -Skyline query.

3. The method according to claim 1, characterized in that, Parse the historical query log information of the database to filter out the Skyline queries and their corresponding cardinality on the target dataset, including: Parse and filter the query statements from the historical query log information to extract the Skyline queries and their corresponding cardinality on the target dataset. The Skyline query includes the query point and its query parameters. The size of the query result set, i.e., the query cardinality, is determined from the query results of Skyline.

4. The method according to claim 1, characterized in that, The construction and training process of the data distribution learning model includes: Construct a deep self-attention transformation network; After sampling and encoding the target dataset or training set, a certain proportion of values ​​are randomly masked to obtain the masked data. The masked data is input into a deep self-attention transformation network for training to obtain a data distribution learning model. The task of model training is to predict these masking values, and the model optimization objective is to maximize the conditional likelihood probability of the masking values.

5. The method according to claim 3, characterized in that, Based on the trained cardinality estimation model, the final cardinality estimate is obtained by inputting the query point, including: The query point and query parameters are parsed from the query statement, encoded, and then input into the trained cardinality estimation model. The model output is further processed by inverse normalization to obtain the final cardinality estimate.

6. A deep learning-based Skyline query cardinality estimation device, characterized in that, include: The parsing and filtering module is used to parse the historical query log information of the database and filter it to obtain the Skyline queries and their corresponding cardinality on the target dataset. The first construction module is used to build a training set based on the Skyline query and its corresponding cardinality. The first construction training module is used to construct and train respective data distribution learning models based on the distribution information of the target dataset and the training set. The second construction training module is used to construct a cardinality estimation model, using the model parameters of the trained data distribution learning model as the initialization parameters of the cardinality estimation model, and training the cardinality estimation model through the training set; The query estimation module is used to obtain the final cardinality estimate by inputting a query point based on the trained cardinality estimation model. The construction and training process of the cardinality estimation model includes: 1) Construct a cardinality estimation sub-model M based on query points Q The cardinality estimation sub-model M Q The first deep neural network consists of a Transformer, a pooling layer, and a linear connection layer. The initial parameters are the parameters of the model learned from the data distribution on the target dataset. 2) Construct a cardinality estimation sub-model M based on query parameters. P The cardinality estimation sub-model M P The second deep neural network consists of a Transformer, a pooling layer, and a linear connection layer. The initial parameters are the parameters of the model learned from the data distribution on the training set. 3) The outputs of the two cardinal estimation sub-models are weighted and averaged to obtain the final cardinal estimate; 4) The results obtained from the cardinality estimation model are normalized with the true cardinality values ​​in the training set and used as the input to the mean squared error loss function to guide the optimization of model parameters; 5) The query point is encoded and input into the first deep neural network for training to obtain the cardinality estimation sub-model M. Q The query point and query parameters are concatenated, encoded, and then input into the second deep neural network for training, resulting in a cardinality estimation sub-model M based on the query parameters. P Among them, the cardinality estimation submodel M based on query parameters P During training, the model parameters are kept positive. The optimization objective is to minimize the error between the weighted average of the outputs of the two cardinality estimation sub-models and the true cardinality value.

7. The apparatus according to claim 6, characterized in that, The construction and training process of the data distribution learning model includes: Construct a deep self-attention transformation network; After sampling and encoding the target dataset or training set, a certain proportion of values ​​are randomly masked to obtain the masked data. The masked data is input into a deep self-attention transformation network for training to obtain a data distribution learning model. The task of model training is to predict these masking values, and the model optimization objective is to maximize the conditional likelihood probability of the masking values.

8. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.

9. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the steps of the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Combined deep neural network-based connection cardinal number estimation method

    CN110888859A

  • Multi-dimensional range query cardinal number estimation method on database

    CN112883066A