Data table connection method and device, computer equipment and storage medium

By establishing a mapping relationship between the join column and the hash bucket in the hash join, the problem of high memory consumption in the hash join algorithm is solved, and a more efficient data table join is achieved.

CN121579540APending Publication Date: 2026-02-27CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511763951.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing hash join algorithms consume a lot of memory when processing large amounts of data, resulting in severe performance degradation.

Method used

By obtaining the statistics of the join column of the hash table to be joined, and determining that the join column meets the integer range constraint, a mapping relationship is established between the values ​​of each column in the join column and each hash bucket in the target hash table. The target hash table is then constructed, and row data is read from the probe table for join processing, avoiding the comparison of hash values ​​and hash keys.

Benefits of technology

It effectively saves the memory space required for hash connections, reduces the computational cost during the connection process, and improves connection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579540A_ABST
    Figure CN121579540A_ABST
Patent Text Reader

Abstract

The invention relates to a data table connection method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: in response to a selection operation for a Hash connection strategy, obtaining connection column statistical information of a to-be-connected Hash construction table; establishing a mapping relationship between each column value in the connection column and each hash bucket in the target hash table under the condition that the connection column is determined to meet an integer range constraint condition according to the connection column statistical information; the hash bucket is used for storing the meta-progenitor data of the corresponding column value in the target hash table; constructing a target hash table based on the hash construction table and the mapping relation; reading row data from the detection table in sequence, and determining a target hash bucket of the row data in a target hash table according to a target column value corresponding to the row data in the connection column and the mapping relation; and performing connection processing on the target meta-progenitor data and the row data stored in the target hash bucket. By adopting the method, the memory consumption during Hash connection can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technology, and in particular to a data table connection method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the surge in data volume and the increasing complexity of business systems, integrating data scattered across different tables through data table join operations can not only meet the real-time analysis needs of business systems, but also break down data silos and achieve data-driven decision-making.

[0003] Currently, common join methods for data tables include nested loop joins, merge joins, and hash joins. Among these, hash joins are frequently used when handling large amounts of data, primarily to address the issue of numerous random reads in nested loop joins, while also avoiding the high cost of sorting in sorted merge joins. However, current hash join algorithms generally suffer from high memory consumption, and insufficient memory resources can lead to severe performance degradation. Summary of the Invention

[0004] Therefore, it is necessary to provide a data table connection method, apparatus, computer device, computer-readable storage medium, and computer program product that can reduce memory consumption during hash joins, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a data table join method, the method comprising:

[0006] In response to the selection of a hash join strategy, the join column statistics of the hash construction table to be joined are obtained; the hash construction table is used to construct the target hash table, and the join column of the hash construction table is used to establish the association between the hash construction table and the corresponding probe table to be joined;

[0007] Based on the statistical information of the join column, if it is determined that the join column satisfies the integer range constraint, a mapping relationship is established between the column values ​​in the join column and each hash bucket in the target hash table; the hash bucket is used to store the tuple data of the corresponding column values ​​in the target hash table;

[0008] Construct the target hash table based on the hash table and the mapping relationship;

[0009] Read row data sequentially from the probe table, and determine the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the connection column and the mapping relationship;

[0010] The target tuple data stored in the target hash bucket and the row data are joined together.

[0011] In one embodiment, the method further includes:

[0012] If the statistical information of the join column indicates that all column values ​​in the join column are integers and there is a numerical range, then the join column is determined to satisfy the integer range constraint condition.

[0013] In one embodiment, the method further includes:

[0014] When the statistics of the connected column indicate that all column values ​​contained in the connected column are integers and there is a numerical range, the number of column values ​​contained in the connected column is calculated based on the numerical range.

[0015] If the number of column values ​​is less than or equal to a preset threshold, the connected column is determined to satisfy the integer range constraint.

[0016] In one embodiment, establishing the mapping relationship between the values ​​of each column in the join column and each hash bucket in the target hash table includes:

[0017] Based on the numerical range of each column value, determine the bucket identifier construction parameters of the target hash table;

[0018] For each column value, based on the bucket identifier construction parameters and the column value, a bucket identifier for the hash bucket corresponding to the column value is generated;

[0019] Each column value is bound to its corresponding bucket identifier to obtain the mapping relationship between each column value and each hash bucket in the target hash table.

[0020] In one embodiment, determining the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the join column and the mapping relationship includes:

[0021] Based on the target column value corresponding to the row data in the connection column, the mapping relationship is found, and the target bucket identifier that matches the target column value is determined from each bucket identifier;

[0022] The hash bucket that matches the target bucket identifier is determined as the target hash bucket for the row data in the target hash table.

[0023] In one embodiment, the method further includes:

[0024] In response to the hash join planning instructions for the hash construction table and the probe table, and provided that the join column of the hash construction table satisfies the integer range constraint, the mapping cost corresponding to the mapping relationship between each column value in the join column and each hash bucket is calculated.

[0025] Based on the data capacity of the tuple data corresponding to each column value in the connection column, determine the number of partitions in the target hash table and the partition data transfer cost matching the number of partitions;

[0026] The target column value corresponding to each row of data in the probe table is statistically analyzed, and the query cost required to find the mapping relationship is calculated to obtain the connection cost between the hash construction table and the probe table.

[0027] The mapping cost, partition data transfer cost, and connection cost are summed to obtain the hash connection cost of the hash construction table and the probe table;

[0028] Based on the hash join cost, determine whether to trigger the selected operation for the hash join strategy.

[0029] In one embodiment, determining the number of partitions in the target hash table and the partition data transfer cost matching the number of partitions based on the data capacity of the tuple data corresponding to the column values ​​in the join column includes:

[0030] The hash table capacity of the target hash table is obtained by calculating the data capacity of the tuple data corresponding to the values ​​of each column in the join column;

[0031] The number of partitions in the target hash table is obtained by rounding up the ratio of the hash table capacity to the execution memory allocated for the connection execution operator.

[0032] Based on the data transfer cost corresponding to each partition of the target hash table, calculate the partition data transfer cost that matches the number of partitions.

[0033] Secondly, this application also provides a data table connection device, the device comprising:

[0034] The selected operation response module is used to respond to the selected operation for the hash join strategy and obtain the join column statistics of the hash construction table to be joined; the hash construction table is used to construct the target hash table, and the join column of the hash construction table is used to establish the association between the hash construction table and the corresponding probe table to be joined;

[0035] The mapping relationship establishment module is used to establish a mapping relationship between each column value in the connection column and each hash bucket in the target hash table, based on the statistical information of the connection column and the determination that the connection column satisfies the integer range constraint condition; the hash bucket is used to store the tuple data of the corresponding column value in the target hash table;

[0036] The hash table construction module is used to construct the target hash table based on the hash construction table and the mapping relationship;

[0037] The target hash bucket determination module is used to read row data sequentially from the probe table, and determine the target hash bucket of the row data in the target hash table according to the target column value corresponding to the row data in the join column and the mapping relationship;

[0038] The connection module is used to perform connection processing on the target tuple data stored in the target hash bucket and the row data.

[0039] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.

[0040] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0041] The aforementioned data table joining method, apparatus, computer equipment, storage medium, and computer program products, when selecting to use a hash join strategy to join data tables, can obtain the join column statistics of the hash construction table to be joined. The join columns of the hash construction table are used to establish the association between the hash construction table and the corresponding probe table to be joined. If, based on the join column statistics, it is determined that the join columns meet the integer range constraint, a mapping relationship between each column value in the join column and each hash bucket in the target hash table can be directly established. The hash buckets of the target hash table are only used to store the tuple data of the corresponding column values ​​in the target hash table. After constructing the target hash table based on the hash construction table and the mapping relationship, row data is read sequentially from the probe table. Based on the target column values ​​corresponding to the row data in the join columns and the mapping relationship, the target hash bucket of the row data in the target hash table is determined. Join processing is then performed on the target tuple data and row data stored in the target hash bucket. The above method has two main advantages. First, during the hash table construction phase, it establishes a mapping between the column values ​​in the join column and the hash buckets in the target hash table. This eliminates the need for hash value and hash key comparisons during the join process. The hash buckets are only used to store the tuple data of the corresponding column values ​​in the target hash table, effectively saving memory space required for hash joins. Second, during the hash join phase, since there is an inherent mapping between column values ​​and hash buckets, there is no need for key-value comparisons to avoid hash collisions. The target hash bucket in the target hash table where the row data is located is directly determined, and all data in the corresponding hash bucket is read. This effectively reduces the computational cost incurred during the join process and improves join efficiency. Attached Figure Description

[0042] Figure 1 This is a diagram illustrating the application environment of a data table join method in one embodiment;

[0043] Figure 2 This is a flowchart illustrating a data table join method in one embodiment;

[0044] Figure 3 This is a schematic diagram illustrating the process of establishing the mapping relationship between the values ​​of each column in the join column and each hash bucket in the target hash table in one embodiment;

[0045] Figure 4 This is a schematic diagram of the internal structure of a hash table under a traditional hash join strategy in one embodiment;

[0046] Figure 5 This is a flowchart illustrating the data table join method in another embodiment;

[0047] Figure 6 This is a schematic diagram of the internal structure of the hash table under the current hash join strategy in one embodiment;

[0048] Figure 7 This is a flowchart illustrating the process of determining the number of partitions in a target hash table based on the data capacity of the tuple data corresponding to the values ​​in each column of the join column, and the partition data transfer cost matching the number of partitions in one embodiment.

[0049] Figure 8 This is a flowchart illustrating the data table join method in another embodiment;

[0050] Figure 9 This is a structural block diagram of a data table connection device in one embodiment;

[0051] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0053] The data table joining method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, the database management system 102 communicates with the server 104 via a network. A data storage system can store the data that the database management system 102 needs to process. The data storage system can be integrated into the database management system 102 or placed on a cloud or other network server. In response to the selection of a hash join strategy, the database management system 102 obtains the join column statistics of the hash construction table to be joined from the server 104. The hash construction table is used to construct the target hash table, and the join columns of the hash construction table are used to establish the association between the hash construction table and the corresponding probe table to be joined. Based on the join column statistics, if the join columns meet the integer range constraint, a mapping relationship is established between the column values ​​in the join columns and the hash buckets in the target hash table. The hash buckets are used to store the tuple data of the corresponding column values ​​in the target hash table. The database management system 102 constructs the target hash table based on the hash construction table and the mapping relationship. Then, it sequentially reads row data from the probe table, determines the target hash bucket in the target hash table based on the target column values ​​corresponding to the row data in the join columns and the mapping relationship, and performs join processing on the target tuple data and row data stored in the target hash bucket.

[0054] The database management system 102 is the core system for managing, storing, and manipulating data. It can efficiently handle tasks such as data storage, data querying, transaction management, and concurrency control through a series of complex algorithms and mechanisms. Understandably, the database management system 102 can be integrated into a management terminal or server 104. The management terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.

[0055] In some embodiments, the database management system 102 includes an executor for performing data table join operations on the data tables to be joined. For example, a hash join operation.

[0056] In one embodiment, such as Figure 2 As shown, a data table join method is provided, which can be applied to... Figure 1 Taking the database management system 102 in the example, the following steps are included:

[0057] S202, in response to the selection of an operation for a hash join strategy, obtain the join column statistics of the hash construction table to be joined.

[0058] The hash join strategy is a specific execution plan selected by the database management system for performing table join operations. The core of the hash join strategy is to first create a hash table in memory for the smaller table, then scan each row sequentially to find a match instantly within this table. Selecting the hash join strategy is a triggering operation, indicating that the hash join strategy has been ultimately chosen as the execution strategy for this query.

[0059] In one embodiment, the selection of a hash connection strategy can be triggered by an administrator based on actual data connection needs. For example, by logging into the database management system and clicking to select the hash connection strategy for the data table to be connected, the selection of the hash connection strategy can be triggered.

[0060] In one embodiment, the selection operation for the hash connection strategy can be automatically triggered by the database management system. For example, when the database management system evaluates various connection strategies and determines that the hash connection strategy requires the lowest connection cost, the selection operation for the hash connection strategy can be automatically triggered.

[0061] In this context, the hash table is the target table selected from the two tables to be joined to build the in-memory hash table. Understandably, the hash table is typically the smaller of the two tables to minimize memory consumption during hash table construction.

[0062] In one embodiment, the database management system also includes an optimizer that can determine a hash construction table for building the target hash table based on the statistics of the two tables to be joined, while the other table is a probe table corresponding to the hash construction table.

[0063] The join column is used to establish the association between the hash construction table and the corresponding probe table to be joined. The calculation of the hash join and the subsequent matching search are based on the values ​​of each column in the join column. The data distribution and characteristics of the join column directly determine the efficiency of the hash join.

[0064] Taking the hash table as the customer table and the probe table as the order table as an example, the column corresponding to the customer identifier that exists in both the customer table and the order table is the join column.

[0065] Join column statistics are a series of metadata extracted from the statistics of the hash-built table, matching the join column. Join column statistics may include cardinality, value distribution, data type, data range, etc.

[0066] In one embodiment, the database management system can extract statistical information matching the column identifier information from the statistical information of the hash-constructed table based on the column identifier information of the join column to obtain the join column statistical information.

[0067] Specifically, in response to the selection of a hash join strategy, the database management system can obtain the join column statistics of the hash construction table to be joined. The hash construction table is used to construct the target hash table, and the join column of the hash construction table is used to establish the association between the hash construction table and its corresponding probe table to be joined.

[0068] S204. Based on the statistical information of the join column, and after determining that the join column meets the integer range constraint, establish the mapping relationship between the values ​​of each column in the join column and each hash bucket in the target hash table.

[0069] The target hash table is a data structure created in memory during the hash join to store the data for the constructed table. The target hash table can consist of a fixed number of hash buckets. Each hash bucket stores tuple data corresponding to the column values ​​in the target hash table. Tuple data represents each row of data in the hash constructed table, containing the values ​​of multiple related fields.

[0070] The integer range constraint is a preset condition used to determine whether a mapping relationship can be directly established between the values ​​of each column in the join column and the hash buckets in the target hash table. If the join column meets the integer range constraint, it means that the data type of the join column is an integer and the value range is finite, and the column values ​​can be directly used to build a mapping relationship between the join column and the hash buckets. If the join column does not meet the integer range constraint, it means that the data type of the join column is not an integer, or the value range of the join column is not finite, and the column values ​​cannot be directly used to build a mapping relationship between the join column and the hash buckets.

[0071] Specifically, the database management system can determine the type and range of values ​​of each column in the join column based on the statistical information of the join column. If the join column satisfies the integer range constraint based on the type and range of values ​​of each column in the join column, the database management system can directly build a corresponding hash bucket for each column value and establish a mapping relationship between each column value in the join column and each hash bucket in the target hash table.

[0072] In one embodiment, the database management system can determine the column value as the bucket identifier of the hash bucket corresponding to the column value, and construct a mapping relationship between each column value and each hash bucket based on the bucket identifier.

[0073] S206, Construct the target hash table based on the hash table and the mapping relationship.

[0074] Specifically, the executor in the database management system can create multiple empty hash buckets equal to the number of column values ​​in the join columns. Then, it reads each hash row data from the hash construction table, determines the corresponding column value in the join columns for each hash row data, and, based on the mapping relationship, determines the empty hash bucket that matches the corresponding column value of the row data. Each hash row data is then stored in the corresponding empty hash bucket, completing the construction of the target hash table.

[0075] Understandably, each hash bucket stores a linked list containing the corresponding tuple data and a pointer to the next tuple data.

[0076] S208: Read row data sequentially from the probe table, and determine the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the join column and the mapping relationship.

[0077] In a hash join, the probe table is a data table used to scan and match the target hash table between two tables to be joined. The probe table is the opposite of the hash construction table and is usually a data table with a large amount of data.

[0078] Specifically, the executor of the database management system can read row data sequentially from the probe table, determine the target column value corresponding to the row data in the join column, find the mapping relationship based on the target column value, and determine the hash bucket that matches the target column value as the target hash bucket of the row data in the target hash table.

[0079] S210 performs join processing on the target tuple data and row data stored in the target hash bucket.

[0080] The target tuple data stored in the target hash bucket is the hash construction table record stored in the target hash bucket.

[0081] Specifically, since each column value in the join column corresponds one-to-one with each hash bucket, there will be no hash collisions in the hash join process. There is no need to calculate the hash value and bucket identifier, nor is it necessary to perform hash value or hash key comparison operations. The database management system can directly read the target tuple data stored in the target hash bucket and combine it with the row data of the probe table to complete the hash join of the two data tables.

[0082] In the above embodiments, when selecting a hash join strategy to join data tables, the join column statistics of the hash construction table to be joined can be obtained. The join columns of the hash construction table are used to establish the association between the hash construction table and the corresponding probe table to be joined. If, based on the join column statistics, it is determined that the join columns meet the integer range constraint, a mapping relationship can be directly established between each column value in the join columns and each hash bucket in the target hash table. The hash buckets in the target hash table are only used to store the tuple data of the corresponding column values ​​in the target hash table. After constructing the target hash table based on the hash construction table and the mapping relationship, row data is read sequentially from the probe table. Based on the target column values ​​corresponding to the row data in the join columns and the mapping relationship, the target hash bucket in the target hash table is determined. Join processing is then performed on the target tuple data and row data stored in the target hash bucket. This method, on the one hand, eliminates the need for join comparisons using hash values ​​and hash keys by establishing a mapping relationship between each column value in the join columns and each hash bucket in the target hash table during the hash table construction stage. The hash buckets are only used to store the tuple data of the corresponding column values ​​in the target hash table, effectively saving the memory space required for hash joins. On the other hand, during the hash join phase, since there is a mapping relationship between column values ​​and hash buckets, there is no need to perform key-value comparison to avoid hash collisions. The target hash bucket in the target hash table can be determined directly, and all data in the corresponding hash bucket can be read. This can effectively reduce the computational cost consumed during the join process and improve join efficiency.

[0083] In one embodiment, the data table join method further includes: determining that the join column satisfies the integer range constraint condition when the join column statistics indicate that the values ​​of each column contained in the join column are all integers and there is a numerical range.

[0084] In this context, column values ​​are the specific data values ​​stored in the joined columns. The statistical information of the joined columns indicates that all column values ​​are integers; therefore, the column value type can be considered to be integer. For example, the column value type of the joined columns could be date.

[0085] The existence of a numerical range for each column value is a value range confirmation action. Only when all column values ​​are integers and have a defined range can a corresponding hash bucket be assigned to each column value. This establishes a mapping relationship between each column value and each hash bucket in the target hash table, achieving the effect of eliminating the need to calculate hash values ​​and compare hash keys during the join process, thus reducing the memory required for hash bucket storage. If the column values ​​are not integers or do not have a numerical range, this deterministic direct mapping relationship cannot be established, and it is necessary to revert to the traditional hash join method. This is because when the distribution of column values ​​is unpredictable, a hash function must be used to map inputs of arbitrary length to hash buckets within a fixed range. Hash collisions are also unavoidable, as different column values ​​may produce the same hash value. The system must compare the actual join key values ​​row by row after finding the target hash bucket to ensure an exact match.

[0086] Specifically, the database management system can analyze the statistics of the join columns to determine whether all values ​​in the join columns conform to the characteristics of an integer data type. If they do, it can further determine whether the maximum and minimum values ​​of the join columns can be obtained from the join column statistics. If they can be explicitly obtained, it is determined that all column values ​​in the join column are integers and that a numerical range exists, thus satisfying the integer range constraint condition.

[0087] In one embodiment, if any value in the join column does not conform to the characteristics of an integer data type, or if the maximum and minimum values ​​of the join column cannot be clearly obtained from the join column statistics, then it can be determined that the join column does not meet the integer range constraint.

[0088] In the above embodiments, the connection column is determined to satisfy the integer range constraint only when the connection column satisfies both the integer type and the defined value range by analyzing the statistical information of the connection column. This can effectively improve the accuracy of the integer range constraint judgment and provide an accurate decision basis for whether to execute the traditional hash connection method or the hash connection method based on the mapping relationship.

[0089] In another embodiment, the data table join method further includes: when the join column statistics indicate that all column values ​​in the join column are integers and a numerical range exists, calculating the number of column values ​​in the join column based on the numerical range. If the number of column values ​​is less than or equal to a preset threshold, determining that the join column satisfies the integer range constraint.

[0090] The preset quantity threshold is a preset judgment parameter used to determine whether the joined columns meet the integer range constraint. The specific value of the preset quantity threshold can be determined according to the actual configuration of the database and hardware resources. For example, the preset quantity threshold can be set to 2 million.

[0091] Understandably, if the number of column values ​​is less than or equal to the preset threshold, it means that directly establishing the mapping relationship between each column value and each hash bucket results in an acceptable memory overhead. If the number of column values ​​is greater than the preset threshold, it means that directly establishing the mapping relationship between each column value and each hash bucket may pose a risk of memory explosion. Using traditional hash joins is more efficient. Therefore, it can be determined that the join column does not meet the integer range constraint.

[0092] Specifically, after analyzing the statistical information of the join column and determining that all column values ​​in the join column are integers and have a numerical range, the database management system continues to calculate the number of column values ​​in the join column based on the numerical range of the join column, and compares the number of column values ​​with a preset number threshold. If the number of column values ​​is less than or equal to the preset number threshold, it is determined that the join column meets the integer range constraint condition.

[0093] In the above embodiments, when it is determined that all column values ​​in the connection column are integers and there is a numerical range, a preset quantity threshold is further called to compare with the number of column values ​​in the connection column. The connection column is judged to meet the integer range constraint through a three-layer verification mechanism, which can ensure that the final decision can meet the requirements of high-efficiency connection performance and guarantee the stability of system connection.

[0094] In one embodiment, such as Figure 3 As shown, the mapping relationship between the values ​​in each column of the connection establishment column in S202 and each hash bucket in the target hash table includes:

[0095] S302, determine the bucket identifier construction parameters of the target hash table based on the numerical range to which each column value belongs.

[0096] The range of values ​​in each column is the value range of the connected column, which is the interval between the values ​​in each column. The value range can include an upper limit and a lower limit. For example, if the maximum value of each value in the connected column is 1999 and the minimum value is 1000, then the value range is [1000, 1999], where 1000 is the lower limit and 1999 is the upper limit.

[0097] The bucket identifier is an identifier parameter used to uniquely mark a hash bucket; it can be a unique number or index of the hash bucket. The bucket identifier construction parameter is a calculated factor used to generate unique identifiers for hash buckets, defining how the identifiers of each bucket in the target hash table are derived from the column values ​​of the join column.

[0098] Specifically, the database management system can determine the bucket identifier construction parameters of the target hash table based on the numerical range to which each column value belongs.

[0099] In one embodiment, the database management system may determine the upper limit of the numerical range as the bucket identifier construction parameter of the target hash table.

[0100] In one embodiment, the database management system can determine the lower limit of the range of values ​​as the bucket identifier construction parameter of the target hash table.

[0101] S304, for each column value, construct parameters and column value based on the bucket identifier, and generate the bucket identifier of the hash bucket corresponding to the column value.

[0102] Specifically, for each column value, the database management system can construct parameters and column values ​​based on the bucket identifier, and generate the bucket identifier of the hash bucket corresponding to the column value.

[0103] In one embodiment, the bucket identifier construction parameter can be the upper limit of the numerical range, max, and the bucket identifier can be the difference between the upper limit of the range and the corresponding column value, i.e., bucket identifier = max - column value.

[0104] In one embodiment, the bucket identifier construction parameter can be the lower limit of the numerical range, min, and the bucket identifier can be the difference between the corresponding column value and the lower limit of the range, i.e., bucket identifier = column value - min.

[0105] S306, bind each column value to its corresponding bucket identifier to obtain the mapping relationship between each column value and each hash bucket in the target hash table.

[0106] Specifically, after the database management system generates corresponding bucket identifiers for each column value by constructing parameters using bucket identifiers, it can bind each column value to its corresponding bucket identifier to obtain the mapping relationship between each column value and each hash bucket in the target hash table. Understandably, when generating corresponding hash buckets for each column value, the database management system will configure the appropriate bucket identifier for each hash bucket based on the mapping relationship.

[0107] In the above embodiments, for each column value, parameters are constructed by using the unique bucket identifier corresponding to the connected column, and the column value generates a bucket identifier for the hash bucket corresponding to the column value. Then, each column value is bound to its corresponding bucket identifier. This allows each column value to be assigned a specific storage location, forming a complete query relationship between column value and storage location. This effectively improves the efficiency and accuracy of subsequent data storage and data retrieval based on the mapping relationship.

[0108] In one embodiment, S208, determining the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the join column and the mapping relationship includes: finding the mapping relationship based on the target column value corresponding to the row data in the join column, and determining the target bucket identifier that matches the target column value from each bucket identifier. The hash bucket that matches the target bucket identifier is determined as the target hash bucket of the row data in the target hash table.

[0109] Specifically, after the data management system reads the travel data from the probe table, it can determine the target column value corresponding to the row data from the connection column. Then, based on the target column value, it searches for the mapping relationship and determines the hash bucket identifier that matches the target column value as the target bucket identifier. Then, based on the target bucket identifier, it determines the target hash bucket of the row data in the target hash table from each hash bucket.

[0110] In the above embodiments, by looking up the mapping relationship through the target column value corresponding to the row data, the target hash bucket corresponding to the row data can be quickly determined without calculating the hash value of the row data, which can effectively improve the efficiency and accuracy of hash bucket location.

[0111] In current data table join scenarios, the choice of join strategy mainly uses a cost model. This model calculates the cost of each join path for different join strategies and join orders based on the size, indexes, and order of the tables on both sides of the join, and then selects the path with the lowest cost to generate a query plan.

[0112] Traditional data join methods generally consist of two phases: a plan generation phase and an executor phase. The plan generation phase generates a join plan for the two tables. First, it obtains statistical information for each table, such as their size, number of rows, and number of pages, to calculate the cost of a table scan. Then, based on the scan costs of the two tables involved in the join, it calculates the execution cost for different join types and join orders. Join strategies for the two tables can include hash join, merge join, and nested loop join. The join order can be that the two tables are inner and outer tables respectively, thus offering two join orders to choose from. In the plan generation phase, for both sides involving ordinary table scans, the cost model needs to calculate and compare the costs of six join paths, selecting the path with the lowest cost.

[0113] When calculating the cost of a hash join strategy, it is usually divided into two parts: the hash table creation part and the hash table join execution process.

[0114] In traditional join strategies, creating a hash table typically involves calculating the hash table size, hash table partitions, hash table partition data transfer costs, and the hash values ​​of all tuples. The hash table size calculation needs to consider the size of the tuples stored in each hash bucket and the size of the hash keys. The hash table size, in turn, affects the number of partitions, which in turn affects the calculation of hash table partition data transfer costs.

[0115] In one embodiment, the hash table size calculation formula in a traditional join strategy is: (hash key + tuple data) × column value. The internal structure of the hash table can be as follows: Figure 4 As shown, each hash bucket in a hash table needs to store the hash value, hash key information, and tuple data corresponding to each row of data.

[0116] In the execution of hash table joins, the traditional join strategy requires first establishing a hash table. Specifically, the data management system can calculate the number of hash buckets based on the hash table's memory quota, hash value, hash key, and the size of the tuple data. Then, it reads the tuple data, calculates the hash value, and calculates the bucket identifier. The hash value, hash key, and tuple data are all stored on a single node corresponding to the bucket identifier. Data not in that partition is written to a temporary file. Then, the hash join is executed. Specifically, the data management system can read data from the probe table, calculate the hash value and bucket identifier, read the data from the hash bucket corresponding to the bucket identifier, and compare the hash value stored in the hash bucket with the hash value calculated from the data in the probe table. If the hash values ​​match, the hash keys are compared. If the hash keys also match, the tuple data in that hash bucket is returned, completing the data join. This process is repeated, traversing the entire bucket list to join the two data tables.

[0117] To reduce the connection path cost corresponding to the hash connection strategy during the connection planning process, in one embodiment, such as Figure 5 As shown, the data table join method may also include the following steps:

[0118] S502, in response to the hash join planning instruction for the hash construction table and the probe table, calculates the mapping cost corresponding to the mapping relationship between each column value in the generated join column and each hash bucket, provided that the join column of the hash construction table satisfies the integer range constraint.

[0119] The hash join planning instruction is a signal used to instruct the planning of hash join paths for the hash construction table and the probe table. The hash join planning instruction can be directly triggered by the administrator for the hash construction table and the probe table.

[0120] The mapping cost, which corresponds to the mapping relationship between each column value in the join column and each hash bucket, refers to the resource cost required to generate the mapping relationship between each column value in the join column and each hash bucket.

[0121] In one embodiment, the mapping cost can consist of the bucket identifier generation cost, bucket identifier configuration cost, and binding cost for each hash bucket. Specifically, the database management system can calculate the bucket identifier generation cost, bucket identifier configuration cost, and binding cost for each hash bucket, and then sum these costs to obtain the mapping cost corresponding to the mapping relationship between each column value in the generated join column and each hash bucket.

[0122] Specifically, the database management system can respond to hash join planning instructions for the hash construction table and probe table, obtain statistical information of the hash construction table, extract join column statistics from the hash construction table statistics, determine whether the join column meets the integer range constraint based on the join column statistics, and calculate the mapping cost corresponding to the mapping relationship between each column value in the join column and each hash bucket if the join column meets the integer range constraint.

[0123] Understandably, the specific process for determining whether the join columns meet the data range constraints has been recorded in the previous text and will not be repeated here.

[0124] S504: Based on the data capacity of the tuple data corresponding to the values ​​in each column of the join column, determine the number of partitions in the target hash table and the partition data transfer cost matching the number of partitions.

[0125] The data capacity of a tuple refers to the storage space occupied by the tuple data corresponding to each column value.

[0126] The number of partitions in the target hash table refers to the number of independent sub-regions into which the target hash table is divided. By dividing the target hash table into regions, the size of a single partition can be controlled to adapt to the memory limitations of the database. At the same time, each partition can support parallel processing, which can effectively improve data processing efficiency.

[0127] Partition data transfer cost refers to the resource cost required to move and reorganize data during the partitioning process. Partition data transfer cost mainly consists of the resource overhead of reading and writing disks, i.e., I / O cost.

[0128] Specifically, the database management system can determine the data capacity of the tuple data corresponding to each column value based on the statistical information of the hash table, determine the number of partitions that need to be partitioned in the target hash table based on the data capacity, and then determine the partition data transfer cost that matches the number of partitions based on the data transfer cost of a single partition and the number of partitions.

[0129] In one embodiment, the internal structure of the hash table can be as follows: Figure 6 As shown, each hash bucket in the hash table stores only tuple data and not hash values, hash keys, or other related data. For scenarios with small tuples, this can save more than half of the memory space, allowing more rows to be stored within the memory quota of hash joins. This reduces the number of partitions and the corresponding partition data transfer costs.

[0130] S506, calculate the target column value corresponding to each row of data in the probe table, the query cost required to find the mapping relationship, and obtain the connection cost between the hash construction table and the probe table.

[0131] The query cost required to find the mapping relationship for the target column value corresponding to each row of data in the probe table refers to the resource cost required to extract the target column value corresponding to each row of data in the probe table from the join column, and to query the mapping relationship once based on the target column value.

[0132] Specifically, the database management system can first determine the target column value corresponding to each row of data in the probe table extracted from the join column, as well as the resource cost required for a single query of the mapping relationship based on the target column value. Then, based on the number of column values ​​and the resource cost required for a single query of the mapping relationship, the query cost required to determine the corresponding target hash bucket for all rows of data in the probe table is calculated. Since there is no need to perform hash value calculation, hash value comparison, or hash key comparison during the join process, it is only necessary to determine the corresponding target hash bucket for each row of data in the probe table, and directly extract the tuple data from the target hash bucket. Therefore, the query cost required to determine the corresponding target hash bucket for all rows of data in the probe table is approximately equal to the join cost between the hash construction table and the probe table.

[0133] S508 performs a summation process on the mapping cost, partition data transfer cost, and connection cost to obtain the hash connection cost of the hash construction table and the probe table.

[0134] Specifically, after obtaining the mapping cost, partition data transfer cost, and connection cost, the database management system can sum these three costs to obtain the hash connection cost for hash table construction and probe table.

[0135] S510 determines whether to trigger the selected operation for the hash join strategy based on the hash join cost.

[0136] Specifically, after obtaining the hash join cost of the hash construction table and the probe table, the database management system can determine whether to trigger the selected operation for the hash join strategy based on the hash join cost.

[0137] In one embodiment, the database management system can compare the hash connection cost with a preset cost threshold, and determine to trigger a selected operation for the hash connection strategy if the hash connection cost is less than or equal to the preset cost threshold.

[0138] In one embodiment, after obtaining the hash connection cost, the database management system can compare the hash connection cost with the connection costs corresponding to other connection strategies. For example, it can compare the hash connection cost with the nested loop connection cost corresponding to the nested loop connection strategy and the merge connection cost corresponding to the merge connection strategy. If the hash connection cost is less than the connection cost corresponding to other connection strategies, it can determine to trigger the selection operation for the hash connection strategy.

[0139] Compared to the connection path cost method used by traditional hash join strategies, the hash join cost calculation method in this implementation firstly eliminates the calculation cost of hash values ​​and the calculation cost of bucket identifiers based on hash values. Secondly, during execution, it also eliminates the calculation of hash value and hash bucket changes. After finding the corresponding hash bucket, since there are no hash collisions, all tuple data can be read and returned directly without having to compare hash keys to avoid hash collisions. This also reduces the calculation cost, greatly increases the likelihood of the hash join strategy being selected, and improves the efficiency of data table joins.

[0140] In one embodiment, such as Figure 7 As shown in S504, based on the data capacity of the tuple data corresponding to the values ​​in each column of the join column, the number of partitions in the target hash table is determined, along with the partition data transfer cost matching the number of partitions, including:

[0141] S702, calculate the data capacity of the tuple data corresponding to the values ​​in each column of the join column, and obtain the hash table capacity of the target hash table.

[0142] The hash table capacity refers to the total memory size occupied by the constructed target hash table. Specifically, it can include the storage capacity of tuple data, the storage capacity of the hash bucket index structure, and the storage capacity required for pointers.

[0143] Specifically, after obtaining the data capacity of the tuple data corresponding to each column value, the database management system can perform statistics on the data capacity of each tuple data to obtain the hash table capacity of the target hash table.

[0144] S704: Round up the ratio of the hash table capacity to the execution memory allocated for the connection execution operator to obtain the number of partitions of the target hash table.

[0145] The join execution sub-operator refers to a component in the database query engine specifically designed to perform join operations. It primarily manages the execution of join algorithms, allocates and utilizes computational resources, and generates join results. Execution memory is the dedicated memory space allocated by the database management system for the join execution operator.

[0146] The rounding up process refers to the operation of rounding the decimal number to positive infinity. By rounding up the ratio of the hash table capacity to the execution memory of the connection execution operator, it can be ensured that the number of partitions can accommodate all the data.

[0147] Specifically, the database management system can calculate the ratio of the hash table capacity to the execution memory of the connection execution operator, and then round the ratio up to obtain the number of partitions of the target hash table.

[0148] S706, calculate the partition data transfer cost matching the number of partitions based on the data transfer cost corresponding to each partition of the target hash table.

[0149] Table partitioning refers to the independent sub-regions obtained by dividing the target hash table into regions.

[0150] Specifically, the database management system can calculate the partition data transfer cost matching the number of partitions based on the data transfer cost corresponding to each partition of the target hash table.

[0151] In the above embodiments, by calculating the ratio of hash table capacity to execution memory and rounding the ratio up, the accurate number of partitions of the target hash table can be obtained. Based on the number of partitions and the data transmission cost corresponding to each partition, the partition data transmission cost can be calculated, which can improve the accuracy of partition data transmission cost calculation and provide an accurate data foundation for subsequent calculation of hash connection cost.

[0152] In one embodiment, such as Figure 8 As shown, a data table connection method is provided, which may specifically include a plan generation phase and an executor phase.

[0153] The execution of the plan generation phase can be performed by the optimizer in the database management system, and may specifically include the following steps:

[0154] S801, in response to a hash join planning instruction for the hash construction table and probe table, obtains statistics for the hash construction table.

[0155] S802, when the statistical information of the connected column indicates that all column values ​​contained in the connected column are integers and there is a numerical range, calculate the number of column values ​​contained in the connected column based on the numerical range.

[0156] S803, when the number of column values ​​is less than or equal to a preset threshold, calculate the mapping cost corresponding to the mapping relationship between each column value in the generated connected column and each hash bucket.

[0157] S804 calculates the data capacity of the tuple data corresponding to the values ​​in each column of the join column, and obtains the hash table capacity of the target hash table.

[0158] S805 rounds up the ratio of the hash table capacity to the execution memory allocated for the connection execution operator to obtain the number of partitions of the target hash table.

[0159] S806: Calculate the partition data transfer cost matching the number of partitions based on the data transfer cost corresponding to each partition of the target hash table.

[0160] S807, calculate the target column value corresponding to each row of data in the probe table, the query cost required to find the mapping relationship, and obtain the connection cost between the hash construction table and the probe table.

[0161] S808 performs a summation process on the mapping cost, partition data transfer cost, and connection cost to obtain the hash connection cost of the hash construction table and the probe table.

[0162] The execution phase, which can be performed by an executor in the database management system, may specifically include the following steps:

[0163] S809, when the cost of hash connections is lower than the cost of other connections, determine the bucket identifier construction parameters of the target hash table based on the numerical range of each column value.

[0164] S810: For each column value, construct parameters and column value based on the bucket identifier, and generate the bucket identifier of the hash bucket corresponding to the column value.

[0165] S811, bind each column value to its corresponding bucket identifier to obtain the mapping relationship between each column value and each hash bucket in the target hash table.

[0166] S812 constructs the target hash table based on hash construction table and mapping relationship.

[0167] S813 reads row data sequentially from the probe table.

[0168] S814: For each row of data, look up the mapping relationship based on the target column value corresponding to the row data in the join column, and determine the target bucket identifier that matches the target column value from each bucket identifier.

[0169] S815, determine the hash bucket that matches the target bucket identifier as the target hash bucket for the row data in the target hash table.

[0170] S816 performs join processing on the target tuple data and row data stored in the target hash bucket.

[0171] The above data table join method uses join column statistics to generate a hash join path that leverages these statistics. Compared to ordinary hash join paths, this method is less costly and more likely to achieve the optimal query plan. During hash table construction, tuples are directly mapped to buckets, reducing hash value calculations. Only the tuple content needs to be stored in the bucket's memory; hash values ​​and keys are not required. The absence of hash collisions results in a shorter average length for each bucket's linked list, a higher bucket fill rate, and reduced performance overhead from random memory accesses. After reading the tuple data from the probe table, the corresponding bucket is found directly based on the column values, further reducing hash value calculations. When reading data within a bucket, all data in the linked list is read and returned, eliminating the need for hash value and key comparisons.

[0172] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0173] Based on the same inventive concept, this application also provides a data table connection apparatus for implementing the data table connection method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data table connection apparatus embodiments provided below can be found in the limitations of the data table connection method described above, and will not be repeated here.

[0174] In one embodiment, such as Figure 9 As shown, a data table connection device 900 is provided, including: a selection operation response module 901, a mapping relationship establishment module 902, a hash table construction module 903, a target hash bucket determination module 904, and a connection module 905, wherein:

[0175] The selected operation response module 901 is used to respond to the selected operation for the hash join strategy and obtain the join column statistics of the hash construction table to be joined; the hash construction table is used to construct the target hash table, and the join column of the hash construction table is used to establish the association between the hash construction table and the corresponding probe table to be joined.

[0176] The mapping relationship establishment module 902 is used to establish a mapping relationship between each column value in the connection column and each hash bucket in the target hash table, based on the statistical information of the connection column and the determination that the connection column meets the integer range constraint. The hash bucket is used to store the tuple data of the corresponding column value in the target hash table.

[0177] Hash table construction module 903 is used to construct a target hash table based on a hash construction table and mapping relationships.

[0178] The target hash bucket determination module 904 is used to read row data sequentially from the probe table and determine the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the join column and the mapping relationship.

[0179] The connection module 905 is used to perform connection processing on the target tuple data and row data stored in the target hash bucket.

[0180] In one embodiment, the data table connection device 900 further includes:

[0181] The condition judgment module is used to determine whether the join column satisfies the integer range constraint condition when the statistical information of the join column indicates that all column values ​​contained in the join column are integers and there is a numerical range.

[0182] In one embodiment, the data table connection device 900 further includes:

[0183] The column value count calculation module is used to calculate the number of column values ​​contained in the connected column based on the numerical range when the statistical information of the connected column indicates that all column values ​​contained in the connected column are integers and there is a numerical range.

[0184] The condition judgment module is used to determine whether the connected columns meet the integer range constraint condition when the number of column values ​​is less than or equal to a preset number threshold.

[0185] In one embodiment, the mapping relationship establishment module 902 is used to: determine the bucket identifier construction parameters of the target hash table according to the numerical range to which each column value belongs; for each column value, generate the bucket identifier of the hash bucket corresponding to the column value based on the bucket identifier construction parameters and the column value; bind each column value with its corresponding bucket identifier to obtain the mapping relationship between each column value and each hash bucket in the target hash table.

[0186] In one embodiment, the target hash bucket determination module 904 is used to: find the mapping relationship based on the target column value corresponding to the row data in the join column, determine the target bucket identifier that matches the target column value from each bucket identifier, and determine the hash bucket that matches the target bucket identifier as the target hash bucket of the row data in the target hash table.

[0187] In one embodiment, the data table connection device 900 further includes:

[0188] The hash join planning instruction response module is used to respond to hash join planning instructions for hash construction tables and probe tables. Under the condition that the join columns of the hash construction table meet the integer range constraint, it calculates the mapping cost corresponding to the mapping relationship between each column value in the join column and each hash bucket.

[0189] The partition data transfer cost calculation module is used to determine the number of partitions in the target hash table and the partition data transfer cost matching the number of partitions based on the data capacity of the tuple data corresponding to the values ​​in each column of the join column.

[0190] The connection cost calculation module is used to calculate the target column value corresponding to each row of data in the probe table, find the query cost required to find the mapping relationship, and obtain the connection cost between the hash construction table and the probe table.

[0191] The summation module is used to sum the mapping cost, partition data transfer cost, and connection cost to obtain the hash connection cost of the hash construction table and the probe table.

[0192] The selected operation triggering module is used to determine whether to trigger a selected operation for the hash join strategy based on the hash join cost.

[0193] In one embodiment, the partition data transfer cost calculation module is used to: calculate the data capacity of the tuple data corresponding to each column value in the join column to obtain the hash table capacity of the target hash table; round up the ratio of the hash table capacity to the execution memory allocated for the join execution operator to obtain the number of partitions in the target hash table; and calculate the partition data transfer cost matching the number of partitions based on the data transfer cost corresponding to each partition of the target hash table.

[0194] Each module in the aforementioned data table connection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0195] In one embodiment, a computer device is provided, which may be a server integrating a database management system, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data related to a data table join method. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a data table join method.

[0196] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0197] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the specific implementation steps of the data table join method described above.

[0198] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the specific implementation steps of the above-described data table join method.

[0199] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the specific implementation steps of the data table join method described above.

[0200] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the acquisition, storage, processing, and transmission of the data all comply with relevant laws and regulations.

[0201] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0202] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0203] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for joining data tables, characterized in that, The method includes: In response to the selection of a hash join strategy, the join column statistics of the hash construction table to be joined are obtained; the hash construction table is used to construct the target hash table, and the join column of the hash construction table is used to establish the association between the hash construction table and the corresponding probe table to be joined; Based on the statistical information of the join column, if it is determined that the join column satisfies the integer range constraint, a mapping relationship is established between the column values ​​in the join column and each hash bucket in the target hash table; the hash bucket is used to store the tuple data of the corresponding column values ​​in the target hash table; Construct the target hash table based on the hash table and the mapping relationship; Read row data sequentially from the probe table, and determine the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the connection column and the mapping relationship; The target tuple data stored in the target hash bucket and the row data are joined together.

2. The method according to claim 1, characterized in that, The method further includes: If the statistical information of the join column indicates that all column values ​​in the join column are integers and there is a numerical range, then the join column is determined to satisfy the integer range constraint condition.

3. The method according to claim 1, characterized in that, The method further includes: When the statistics of the connected column indicate that all column values ​​contained in the connected column are integers and there is a numerical range, the number of column values ​​contained in the connected column is calculated based on the numerical range. If the number of column values ​​is less than or equal to a preset threshold, the connected column is determined to satisfy the integer range constraint.

4. The method according to claim 1, characterized in that, Establishing the mapping relationship between the values ​​of each column in the join column and each hash bucket in the target hash table includes: Based on the numerical range of each column value, determine the bucket identifier construction parameters of the target hash table; For each column value, based on the bucket identifier construction parameters and the column value, a bucket identifier for the hash bucket corresponding to the column value is generated; Each column value is bound to its corresponding bucket identifier to obtain the mapping relationship between each column value and each hash bucket in the target hash table.

5. The method according to claim 4, characterized in that, Determining the target hash bucket of the row data in the target hash table based on the target column value corresponding to the row data in the join column and the mapping relationship includes: Based on the target column value corresponding to the row data in the connection column, the mapping relationship is found, and the target bucket identifier that matches the target column value is determined from each bucket identifier; The hash bucket that matches the target bucket identifier is determined as the target hash bucket for the row data in the target hash table.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: In response to the hash join planning instructions for the hash construction table and the probe table, and provided that the join column of the hash construction table satisfies the integer range constraint, the mapping cost corresponding to the mapping relationship between each column value in the join column and each hash bucket is calculated. Based on the data capacity of the tuple data corresponding to each column value in the connection column, determine the number of partitions in the target hash table and the partition data transfer cost matching the number of partitions; The target column value corresponding to each row of data in the probe table is statistically analyzed, and the query cost required to find the mapping relationship is calculated to obtain the connection cost between the hash construction table and the probe table. The mapping cost, partition data transfer cost, and connection cost are summed to obtain the hash connection cost of the hash construction table and the probe table; Based on the hash join cost, determine whether to trigger the selected operation for the hash join strategy.

7. The method according to claim 6, characterized in that, The step of determining the number of partitions in the target hash table based on the data capacity of the tuple data corresponding to each column value in the join column, and the partition data transfer cost matching the number of partitions, includes: The hash table capacity of the target hash table is obtained by calculating the data capacity of the tuple data corresponding to the values ​​of each column in the join column; The number of partitions in the target hash table is obtained by rounding up the ratio of the hash table capacity to the execution memory allocated for the connection execution operator. Based on the data transfer cost corresponding to each partition of the target hash table, calculate the partition data transfer cost that matches the number of partitions.

8. A data table connection device, characterized in that, The device includes: The selected operation response module is used to respond to the selected operation for the hash join strategy and obtain the join column statistics of the hash construction table to be joined; the hash construction table is used to construct the target hash table, and the join column of the hash construction table is used to establish the association between the hash construction table and the corresponding probe table to be joined; The mapping relationship establishment module is used to establish a mapping relationship between each column value in the connection column and each hash bucket in the target hash table, based on the statistical information of the connection column and the determination that the connection column satisfies the integer range constraint condition; the hash bucket is used to store the tuple data of the corresponding column value in the target hash table; The hash table construction module is used to construct the target hash table based on the hash construction table and the mapping relationship; The target hash bucket determination module is used to read row data sequentially from the probe table, and determine the target hash bucket of the row data in the target hash table according to the target column value corresponding to the row data in the join column and the mapping relationship; The connection module is used to perform connection processing on the target tuple data stored in the target hash bucket and the row data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.