Cardinality estimation method and device for financial database and storage medium
By constructing a financial data augmentation network to generate a high-quality training set, the robustness and estimation performance of the query-driven cardinality estimator are improved. This solves the problem that cardinality estimators in financial databases are sensitive to the quality of training data, and achieves efficient model adaptation and low-cost updates.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HARBIN HARBIN CONSUMER FINANCE CO LTD
- Filing Date
- 2025-11-26
- Publication Date
- 2026-05-01
AI Technical Summary
Existing cardinality estimators for financial databases suffer from low robustness, particularly sensitive to the quality of training data, leading to performance degradation under dynamic workloads, and the quality of training data is not adequately considered.
We construct a financial data augmentation network to generate a high-quality augmented financial data training set. By training a query-driven cardinality estimator (FDCE), we use data augmentation techniques to improve the model's estimation performance and generalization ability, generate a small number of high-quality queries to adapt to changes in data distribution, and reduce model maintenance costs.
It improves the model's estimation performance and generalization ability, enhances its robustness to outliers and noise, and reduces maintenance costs and update overhead in dynamic environments.
Smart Images

Figure CN121958320A_ABST
Abstract
Description
A cardinality estimation method, apparatus, and storage medium for financial databases. Technical Field
[0001] This invention belongs to the field of databases, and in particular relates to a cardinality estimation method, device and storage medium for financial databases. Background Technology
[0002] In the fintech field, cardinality estimation is a key tool for processing massive amounts of transaction data, customer information, and market data. Cardinality estimation is a problem in the field of database query optimization. The cardinality estimator in a DBMS estimates the number of elements in the result of an SQL query before execution, thereby helping the query optimizer generate a good query plan.
[0003] Traditional methods use statistically driven models (such as histograms and sketches) to produce lightweight summaries of financial data for assessing credit risk, monitoring unusual transactions, or predicting market trends.
[0004] For example, banks need to quickly estimate the number of high-risk customers in a specific customer group to optimize their credit strategy, or transactions require real-time statistics on the number of independent participants in high-frequency trading.
[0005] However, real-world datasets are often complex, and analytical functions are typically not powerful enough to establish a proper mapping between a coarse data summary and the cardinality of SQL queries. Furthermore, SQL queries often contain join predicates, but constructing a specific summary for each join is both difficult and time-consuming. Computing the distribution of joint data is also often challenging due to high computational and storage overhead.
[0006] Recently, traditional cardinality estimators have been revolutionized by learning-based model estimators. Learning-based cardinality estimators are mainly divided into three categories: data-driven, query-driven, and a hybrid data / query-driven approach. Data-driven models attempt to estimate cardinality by learning the joint data distribution between attributes in the underlying database; query-driven models learn the relationship between cardinality and query distribution in a supervised manner using feedback from executed queries, without specifically focusing on the underlying database. Hybrid-driven models consider both data and query information, combining information from both approaches, but do not address the shortcomings of the two aforementioned methods.
[0007] Current learning-based cardinality estimation methods have achieved good performance given training data, with nearly 90% of the estimated Q-errors approaching 1. This demonstrates the excellent fitting ability of current cardinality estimation models. However, almost all cardinality estimation methods suffer from a serious problem: model robustness, meaning they are highly sensitive to training data. For example, the model performs poorly on dynamic workloads, and its performance deteriorates significantly when the underlying data distribution changes. For query-driven models, changes in data distribution alter the mapping between the true cardinality and the query distribution, meaning the labels on previously trained data become inaccurate, thus reducing the quality of the training data. For data-driven methods, changes in the underlying data lead to differences in the joint data distribution between relations and attributes, causing the previously trained model to no longer provide accurate fitting results. Therefore, this is a common problem faced by learning-based cardinality estimation methods.
[0008] Research on the impact of training data on learned cardinality estimation methods extends beyond this. Current work includes cardinality estimation attacks that also address training data quality issues. Examples include constructing poisoned queries to interfere with query-driven cardinality estimators (PACE), and experiments targeting pre-trained methods demonstrating that different queries have varying effects on the cardinality estimator. This indicates that for learned cardinality estimation methods, especially query-driven models, the impact of training data on the model is crucial.
[0009] Furthermore, current query-driven models rely on training data derived from historical workloads or random generation, neglecting the impact of queries on model efficiency. For instance, real-world database applications often feature frequently occurring queries with similar patterns. If these queries constitute a large proportion of the training data, it leads to insufficient diversity, resulting in poor generalization even with a large total training dataset. Addressing these training data quality issues, generating higher-quality queries can improve model performance and robustness at a lower cost. Moreover, when data distribution changes, the cost of re-executing queries to obtain cardinality, necessary for retraining the query-driven estimator, can be reduced by generating a smaller number of high-quality queries. Summary of the Invention
[0010] The purpose of this invention is to address the problem of low robustness in existing cardinality estimators for financial databases. A cardinality estimation method for financial databases is provided, comprising:
[0011] Step 1: Construct a cardinality estimator for financial databases;
[0012] Step 2: Construct a financial data augmentation network; obtain a trained financial data augmentation network; use the trained financial data augmentation network to generate an augmented financial data training set;
[0013] Step 3: Train the cardinality estimator for the financial database using the enhanced financial data training set to obtain the trained cardinality estimator for the financial database.
[0014] The cardinality estimator used for financial databases is a query-driven cardinality estimator (FDCE).
[0015] Training a query-driven cardinality estimator (FDCE) using an enhanced financial data training set is well known to those skilled in the art;
[0016] The general process is as follows:
[0017] Determine the query-driven cardinality estimator model and train it using the prepared data.
[0018] Define an appropriate loss function (such as mean squared error loss, which is commonly used for regression problems, or cross-entropy loss, which is used for distributed learning).
[0019] By selecting an appropriate optimizer and iterating over the cardinality estimator for financial databases, a well-trained cardinality estimator for financial databases can be obtained.
[0020] The goal of training is to make the estimated value output by the model as close as possible to the true cardinality. The focus of this invention is data augmentation technology for query-driven cardinality estimators, that is, the process of using data augmentation networks to generate augmented financial data training sets; the training of query-driven cardinality estimators (FDCE) using training sets will not be elaborated here.
[0021] Step 4: Obtain the data to be queried. Input the data to be queried into the trained cardinality estimator for financial databases to estimate the cardinality and obtain the cardinality estimation result.
[0022] The cardinality estimator is a tool or algorithm used to estimate the number of unique elements in a dataset; an example is given below.
[0023] Applications of cardinality estimators in the financial field:
[0024] Count the number of different account types;
[0025] Banks offer various account types, such as savings accounts, checking accounts, and time deposit accounts. Bank databases store massive amounts of account information.
[0026] Suppose a bank wants to quickly determine the number of different savings accounts. Using traditional, precise calculation methods, it would require scanning the entire account database, checking each account record individually to ensure it is a savings account, and recording all unique accounts. When a bank has tens or even hundreds of millions of customer accounts, this precise calculation would consume a significant amount of time and computing resources.
[0027] A cardinality estimator can process account types to obtain certain characteristics of those types, and then estimate the approximate number of different savings accounts based on those characteristics. This allows banks to obtain a relatively accurate estimate (i.e., an estimated cardinality) in a short period of time, and then select an appropriate query plan based on the magnitude of the estimate.
[0028] Step two involves constructing a financial data augmentation network; obtaining a trained financial data augmentation network; and using the trained financial data augmentation network to generate an augmented financial data training set. The specific process is as follows:
[0029] S1: Construct a data augmentation network;
[0030] S2: Obtain the financial dataset to be enhanced;
[0031] The financial dataset to be enhanced includes M historical query samples; M is a positive integer;
[0032] S3: Train the financial data augmentation network based on the financial dataset to be augmented to obtain a trained financial data augmentation network;
[0033] S4: Use the trained financial data augmentation network to generate an augmented financial data training set.
[0034] A computer storage medium, characterized in that the storage medium stores at least one instruction, which is loaded and executed by a processor to implement the cardinality estimation method for a financial database.
[0035] A cardinality estimation device for financial databases, characterized in that the device includes a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the cardinality estimation method for financial databases.
[0036] The beneficial effects of this invention are as follows:
[0037] This invention effectively overcomes the heavy reliance of existing query-driven models on the quality of training data. Through the technology of this invention, high-quality queries can be generated. First, it can efficiently improve the estimation performance and generalization ability of the model with significantly lower data labeling and training costs. Second, the generated high-quality queries enhance the model's robustness to outlier data and noise. Crucially, when the data distribution changes in practical applications, this invention avoids the expensive process of re-executing numerous queries to obtain new cardinality estimates, as is required by traditional methods. Only a small number of high-quality new queries need to be generated to complete the model's rapid adaptation and retraining, greatly reducing the maintenance cost and update overhead of the model in dynamic environments. Attached Figure Description
[0038] Figure 1 is a schematic diagram of the process of the present invention. Detailed Implementation
[0039] Specific Implementation Method 1: The present invention will be described with reference to Figure 1.
[0040] Step 1: Construct a cardinality estimator for financial databases;
[0041] Step 2: Construct a financial data augmentation network; obtain a trained financial data augmentation network; use the trained financial data augmentation network to generate an augmented financial data training set;
[0042] Step 3: Train the cardinality estimator for the financial database using the enhanced financial data training set to obtain the trained cardinality estimator for the financial database.
[0043] The cardinality estimator used for financial databases is a query-driven cardinality estimator (FDCE).
[0044] Training a query-driven cardinality estimator (FDCE) using an enhanced financial data training set is well known to those skilled in the art;
[0045] The general process is as follows:
[0046] Determine the query-driven cardinality estimator model and train it using the prepared data.
[0047] Define an appropriate loss function (such as mean squared error loss, which is commonly used for regression problems, or cross-entropy loss, which is used for distributed learning).
[0048] By selecting an appropriate optimizer and iterating over the cardinality estimator for financial databases, a well-trained cardinality estimator for financial databases can be obtained.
[0049] The goal of training is to make the estimated value output by the model as close as possible to the true cardinality. The focus of this invention is data augmentation technology for query-driven cardinality estimators, that is, the process of using data augmentation networks to generate augmented financial data training sets; the training of query-driven cardinality estimators (FDCE) using training sets will not be elaborated here.
[0050] Step 4: Obtain the data to be queried. Input the data to be queried into the trained cardinality estimator for financial databases to estimate the cardinality and obtain the cardinality estimation result.
[0051] The cardinality estimator is a tool or algorithm used to estimate the number of unique elements in a dataset; an example is given below.
[0052] Applications of cardinality estimators in the financial field:
[0053] Count the number of different account types;
[0054] Banks offer various account types, such as savings accounts, checking accounts, and time deposit accounts. Bank databases store massive amounts of account information.
[0055] Suppose a bank wants to quickly determine the number of different savings accounts. Using traditional, precise calculation methods, it would require scanning the entire account database, checking each account record individually to ensure it is a savings account, and recording all unique accounts. When a bank has tens or even hundreds of millions of customer accounts, this precise calculation would consume a significant amount of time and computing resources.
[0056] A cardinality estimator can process account types to obtain certain characteristics of those types, and then estimate the approximate number of different savings accounts based on these characteristics. This allows banks to obtain a relatively accurate estimate (i.e., an estimated cardinality) in a short period of time, and then select an appropriate query plan based on the magnitude of the estimate.
[0057] In other domains, cardinality estimators can estimate the number of unique visitors (UV) to a website within a day. Since the same user may visit multiple times, using exact lookups is extremely costly for massive amounts of log data. Cardinality estimators can quickly estimate UVs with very little memory (e.g., at the KB level), with an error rate typically around 1%, fully meeting business needs. Furthermore, cardinality estimators can estimate the number of trucks entering and leaving a factory within a day, and in physical manufacturing enterprises, they can also estimate the real-time inventory of a specific workpiece within a day.
[0058] Specific Implementation Method Two: The difference between this implementation method and Specific Implementation Method One is that...
[0059] Step two involves constructing a financial data augmentation network; obtaining a trained financial data augmentation network; and using the trained financial data augmentation network to generate an augmented financial data training set. The specific process is as follows:
[0060] S1: Construct a data augmentation network;
[0061] S2: Obtain the financial dataset to be enhanced;
[0062] The financial dataset to be enhanced includes M historical query samples; M is a positive integer;
[0063] S3: Train the financial data augmentation network based on the financial dataset to be augmented to obtain a trained financial data augmentation network;
[0064] S4: Use the trained financial data augmentation network to generate an augmented financial data training set;
[0065] The other steps and parameters are the same as in Specific Implementation Method 1.
[0066] Specific Implementation Method Three: The difference between this implementation method and Specific Implementation Method One is that...
[0067] The data augmentation network in S1 includes: a generative adversarial network module, a data selection module, a data quality assessment module, and a data update module;
[0068] The generative adversarial network module includes: a generator network and a discriminator network;
[0069] The generator network includes: a join network, a low-bound network, and a range network;
[0070] The join network, low_bound network, range network, and discriminator network are all MLP multilayer perceptron networks.
[0071] A multilayer perceptron is a neural network consisting of fully connected layers containing at least one hidden layer, and it is a network structure well known to those in the art.
[0072] The generative adversarial network module is used to generate candidate query sequences based on the query;
[0073] The data selection module is used to select candidate query sequences to obtain query samples;
[0074] The data quality assessment module is used to assess the query samples and obtain an enhanced financial data training set.
[0075] The data update module is used to update and enhance the financial data training set.
[0076] The other steps and parameters are the same as in one of the specific implementation methods one or two.
[0077] Specific Implementation Method Four: This implementation method differs from Specific Implementation Methods One through Four in that...
[0078] In step S3, the financial data augmentation network is trained based on the financial dataset to be augmented, resulting in a trained financial data augmentation network; the specific process is as follows:
[0079] S3.1: Use a generator network to generate the first query encoding vector X1;
[0080] S3.2: Use the data selection module to select the first query encoding vector X1 to obtain the first query sample X;
[0081] S3.3: Input the first query sample X and the historical query samples into the discriminator network to obtain the discrimination result;
[0082] S3.4: Use the data quality assessment module to assess the quality of the first query sample X and obtain the query representativeness score; calculate the diversity score based on the discrimination results and historical query samples;
[0083] S3.5: Calculate the loss function based on the representativeness score and diversity score of the query, train and update the generative adversarial network module based on the loss function, and obtain the trained generative adversarial network module when the loss function is minimized;
[0084] The other steps and parameters are the same as those in one of the specific implementation methods one to three.
[0085] Specific Implementation Method Five: The difference between this implementation method and Specific Implementation Methods One to Four is that...
[0086] S3.1: Generate the first query encoding vector X1 using a generator network; the specific process is as follows:
[0087] S3.1.1: Generate random noise.
[0088] S3.1.2: Input random noise into the join network, low_bound network, and range network respectively; obtain the first intermediate vector, the second intermediate vector, and the third intermediate vector;
[0089] S3.1.3: Concatenate the first intermediate vector, the second intermediate vector, and the third intermediate vector to obtain the first query encoding vector X1;
[0090] The generator includes three sub-networks, corresponding to three types of information: join, low_bound, and range. Among them, join corresponds to the join predicate of the SQL query, and low_bound and range together constitute the filter predicate. The upper bound value of each attribute is low_bound + range.
[0091] Each attribute refers to each attribute of the database table. The query vector generated by the generator can be understood as the concatenation of the structure vector and the attribute vector.
[0092] The structure vector indicates which tables are used in the query. If there are m tables, it is an m-dimensional vector. If a certain table is used, the corresponding position is filled with 1, otherwise it is filled with 0.
[0093] The attribute vector here corresponds to the query conditions. For example, for attribute a of table A, the value in the corresponding query is written at the corresponding position. For example, when querying 10 < a < 100, the lower bound low_bound is 10 and the range is 90.
[0094] In S3.2, a data selection module is used to select the candidate query sequence to obtain the first query sample X. The specific process is as follows:
[0095] Using the Monte Carlo tree search strategy, path pruning is performed on the candidate queries output by the generator to obtain the query sample Y.
[0096] The obtained query samples satisfy both high cardinality and attribute diversity. Retain the query samples that satisfy both high cardinality and attribute diversity, and the relatively rare queries generated by the generator can be excluded.
[0097] Other steps and parameters are the same as those in any one of the specific embodiments one to four.
[0098] Specific embodiment six: The difference between this embodiment and the specific embodiments one to five is that
[0099] In S3.4, a data quality assessment module is used to evaluate the quality of the first query sample X to obtain the query representativeness score. It is expressed by the formula:
[0100]
[0101] In the formula, represents the i-th predicate in the first query sample X, sel represents the probability of the quantile histogram coverage area, represents the product;
[0102] The first query sample X consists of several predicates. For example, the first query sample X consists of predicate p1 (logical intersection), predicate p2 (logical intersection), and predicate p3, indicating how many data satisfy predicates p1, p2, and p3 at the same time.
[0103] The representativeness score of a query refers to how many data points the generated query covers, i.e., its representativeness. A quantile histogram's coverage area is a statistical data structure used to approximate the distribution of values in a data column.
[0104] First, the data quality assessment module further filters the queries generated by the generator, aiming to select a small subset of queries with the highest combined scores in terms of representativeness and diversity.
[0105] S3.4: Calculate the diversity score based on the discrimination results and historical query samples. The specific process is as follows:
[0106] The cosine similarity between the candidate query and the historical query set in the discrimination results is calculated to obtain the diversity score, which is expressed by the formula:
[0107]
[0108] In the formula, H represents the historical query set. This represents the candidate queries in the discrimination results. Let h represent the h-th historical query sample in the historical query set, and cos represent the cosine similarity.
[0109] The discrimination results include: candidate queries and non-candidate queries;
[0110] Candidate queries are those that the discriminator considers to be genuine queries;
[0111] Non-candidate queries are considered generated queries by the discriminator.
[0112] The generator randomly generates several query vectors (the input for this step is a random variable, not a query). Then, it provides the discriminator with the real query vector and the generated query vector, and sees whether the discriminator can distinguish between the query generated by the generator and the real query. If it can, it means that the generator's generation is not good; if it cannot, it means that the discriminator itself is not effective.
[0113] The other steps and parameters are the same as those in any of the specific implementation methods one to five.
[0114] Specific Implementation Method Seven: The difference between this implementation method and Specific Implementation Methods One through Six is that...
[0115] The loss function in S3.5 is the Wasserstein distance; expressed by the formula:
[0116]
[0117] In the formula, This represents the first weighted hyperparameter. This represents the second weight hyperparameter; This indicates a query for representative scores. Indicates diversity score;
[0118] The other steps and parameters are the same as those in any of the specific implementation methods one to six.
[0119] Specific Implementation Method Eight: The difference between this implementation method and Specific Implementation Methods One to Seven is that...
[0120] The specific process of generating an enhanced financial data training set using a pre-trained financial data augmentation network in step S4 is as follows:
[0121] The generator network in the pre-trained generative adversarial network module generates the second query encoding vector X2. The data selection module selects the candidate query sequence to obtain the second query sample Y. The second query sample Y is used as the training set for augmented financial data.
[0122] Furthermore, when the database is expanded, the present invention can use a real-time data update module to fine-tune the generator network parameters; thereby updating and enhancing the financial data training set, and using the updated and enhanced financial data training set to fine-tune the trained cardinality estimator for the financial database, resulting in a fine-tuned cardinality estimator for the financial database that meets the cardinality estimation requirements for the scenario where the database is expanded.
[0123] The specific process of fine-tuning the generator network parameters using the real-time data update module is as follows:
[0124] A1: Use a generator network to generate the third query encoding vector X3;
[0125] A2: Use the data selection module to select the third query encoding vector X3 to obtain the third query sample Z;
[0126] A3: Input the third query sample Z and the real query sample after the database is added into the discriminator network to obtain the second discrimination result;
[0127] A4: Calculate the gradient norm of the second discrimination result;
[0128] A5: Update the generator network parameters based on the gradient norm calculated by A5;
[0129] In practical use, this invention generates a batch of high-quality queries adapted to the current load at regular intervals to update the model. The incremental generation strategy innovatively integrates meta-learning and gradient-sensitive sampling.
[0130] Inspired by efficient fine-tuning techniques for large model parameters, a two-layer optimization framework is designed: the outer layer optimizes the query generation distribution, and the inner layer optimizes the cardinality estimation model parameters.
[0131] By calculating the gradient norm of the model on the updated sample set, the data regions that most significantly improve the generalization ability of the current model are identified, and the generator is guided to generate boundary condition queries for these regions (similar to the fine-tuning strategy in CardBench benchmark testing).
[0132] The other steps and parameters are the same as those in any of the specific implementation methods one to seven.
[0133] Specific Implementation Method Nine: This implementation method is a computer storage medium that stores at least one instruction, which is loaded and executed by a processor to implement the cardinality estimation method for a financial database.
[0134] It should be understood that the instructions include computer program products, software, or computerized methods corresponding to any method described in this invention; the instructions can be used to program computer systems or other electronic devices. Computer storage media may include readable media on which instructions are stored, and may include, but are not limited to, magnetic storage media, optical storage media; magneto-optical storage media include read-only memory (ROM), random access memory (RAM), erasable programmable memory (e.g., EPROM and EEPROM), and flash memory layers, or other types of media suitable for storing electronic instructions.
[0135] Specific Implementation Method 10: This implementation method is a cardinality estimation device for a financial database. The device includes a processor and a memory. It should be understood that this includes any device including a processor and a memory described in this invention. The device may also include other units or modules that perform display, interaction, processing, control, and other functions through signals or instructions. The memory stores at least one instruction, which is loaded and executed by the processor to implement the cardinality estimation method for a financial database.
[0136] The above description is merely of preferred embodiments of the present invention. It should be understood that the present invention is not limited to the specific embodiments described above. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent substitutions, and improvements made to the above embodiments without departing from the scope of the present invention, based on the technical essence of the present invention, and within the spirit and principles of the present invention, shall still fall within the protection scope of the present invention.
Claims
1. A cardinality estimation method for financial databases, characterized in that, include: Step 1: Construct a cardinality estimator for financial databases; Step 2: Construct a financial data augmentation network; Obtain a trained financial data augmentation network; Step 3: Use the trained financial data augmentation network to generate an augmented financial data training set; Step 4: Use the augmented financial data training set to train the cardinality estimator for the financial database to obtain the trained cardinality estimator for the financial database; Step 5: Obtain the data to be queried, input the data to be queried into the trained cardinality estimator for the financial database to estimate the cardinality, and obtain the cardinality estimation result.
2. The cardinality estimation method for financial databases according to claim 1, characterized in that, In step two, a financial data augmentation network is constructed; a trained financial data augmentation network is obtained; and the trained financial data augmentation network is used to generate an augmented financial data training set. The specific process is as follows: S1: Constructing the data augmentation network; S2: Obtain the financial dataset to be enhanced; the financial dataset to be enhanced includes M historical query samples; M is a positive integer; S3: Train the financial data augmentation network based on the financial dataset to be augmented to obtain a trained financial data augmentation network; S4: Use the trained financial data augmentation network to generate an augmented financial data training set.
3. The cardinality estimation method for financial databases according to claim 2, characterized in that, The data augmentation network in S1 includes: a generative adversarial network module, a data selection module, and a data quality assessment module; the generative adversarial network module includes: a generator network and a discriminator network; the generator network includes: a join network, a low-bound network, and a range network; the join network, low-bound network, range network, and discriminator network are all MLP (Multilayer Perceptron) networks.
4. The cardinality estimation method for financial databases according to claim 3, characterized in that, In step S3, the financial data augmentation network is trained based on the financial dataset to be augmented, resulting in a trained financial data augmentation network. The specific process is as follows: S3.1: A generator network generates a first query encoding vector X1; S3.2: A data selection module selects from the first query encoding vector X1 to obtain a first query sample X; S3.3: The first query sample X and historical query samples are input into a discriminator network to obtain a discrimination result; S3.4: A data quality assessment module evaluates the quality of the first query sample X to obtain a query representativeness score; a diversity score is calculated based on the discrimination result and historical query samples; S3.5: A loss function is calculated based on the query representativeness score and the diversity score. The generative adversarial network module is trained and updated based on the loss function. When the loss function is minimized, the trained generative adversarial network module is obtained.
5. The cardinality estimation method for financial databases according to claim 4, characterized in that, S3.1: Generate the first query encoding vector X1 using a generator network; the specific process is as follows: S3.1.1: Generate random noise; S3.1.2: Input the random noise into the join network, low_bound network, and range network respectively; obtain the first intermediate vector, the second intermediate vector, and the third intermediate vector; S3.1.3: Concatenate the first intermediate vector, the second intermediate vector, and the third intermediate vector to obtain the first query encoding vector X1; In S3.2, the data selection module is used to select the candidate query sequence to obtain the first query sample X; the specific process is as follows: use the Monte Carlo tree search strategy to perform path pruning on the candidate queries output by the generator to obtain the query sample Y.
6. The cardinality estimation method for financial databases according to claim 5, characterized in that, In step S3.4, the data quality assessment module is used to assess the quality of the first query sample X and obtain a query representativeness score; expressed by the formula: In the formula, Let represent the i-th predicate in the first query sample X, and sel represent the probability of the region covered by the quantile histogram. This indicates a product; in S3.4, the diversity score is calculated based on the discrimination results and historical query samples. Specifically, the cosine similarity between the candidate query in the discrimination results and the historical query samples is calculated to obtain the diversity score, expressed by the formula: In the formula, H represents the set of historical query samples. This represents the candidate queries in the discrimination results. Let h represent the h-th historical query sample in the historical query sample set, and cos represent the cosine similarity.
7. The cardinality estimation method for financial databases according to claim 6, characterized in that, The loss function in S3.5 is the Wasserstein distance; expressed by the formula: In the formula, This represents the first weighted hyperparameter. This represents the second weight hyperparameter; This indicates a query for representative scores. This represents the diversity score.
8. The cardinality estimation method for financial databases according to claim 7, characterized in that, The process of generating an enhanced financial data training set using a pre-trained financial data augmentation network in S4 is as follows: the generator network in the pre-trained generative adversarial network module generates a second query encoding vector X2; the data selection module selects candidate query sequences to obtain a second query sample Y; and the second query sample Y is used as the enhanced financial data training set.
9. A computer storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by a processor to implement the cardinality estimation method for a financial database as described in any one of claims 1 to 8.
10. A cardinality estimation device for a financial database, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction, which is loaded and executed by the processor to implement the cardinality estimation method for a financial database as described in any one of claims 1 to 8.