Character string data read optimization method based on B + tree and learning index
By adopting a mixed indexing method based on B+ tree and learning index in the database, the reading performance of variable-length string data is optimized, and the problems of high model calculation costs and uneven data distribution in the prior art are solved, and efficient data access and resource utilization are achieved.
Patent Information
- Application Number
- CN202411643060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-11
AI Technical Summary
The prior art is difficult to effectively optimize the reading performance of variable-length string data, especially when the model calculation costs are high and the data distribution is uneven.
A mixed indexing method based on B+ tree and learning index is adopted, through string slicing and integer conversion, a one-dimensional linear regression model is used to predict, and the index type is adaptively selected according to the data scale.
It improves the access speed of string data, solves the performance bottlenecks when processing data in different scales, maximizes the use of the advantages of different index structures, reduces resource waste, and effectively reduces the size of B+ tree nodes.
Smart Images

Figure CN119597976A_ABST
Abstract
Description
[0001] The present invention relates to the field of database storage, and in particular to a string data reading optimization method, and in particular to a string data reading optimization method based on a B+ tree and a learning index. Background Art
[0002] B+ tree is a traditional self-balancing data structure widely used for efficient ordered data storage and range query operations. The internal nodes in the B+ tree are used for navigation, while the leaf nodes store data or references. The search starts from the root node and compares the input key with the node key until a leaf node that holds the data or pointer is found. However, the B+ tree does not consider the distribution of data.
[0003] In recent years, the rapid development of artificial intelligence and machine learning technologies has attracted the attention of the database field. How to use artificial intelligence and machine learning technologies to optimize traditional database technologies has become a hot issue in the current database field. Learning indexes came into being in this environment. Indexes based on machine learning are called learning indexes. Learning indexes use models to learn the cumulative distribution function (CDF) of input keys. Learning indexes usually use recursive model indexes (RMI). In this structure, the upper-level model is used to select the lower-level model, and the last-level model predicts the position of the key. The actual key position is usually very close to the predicted position, and only a small range near the predicted value needs to be searched accurately.
[0004] The current learned index has limited support for variable-length string keys.
[0005] The limitations are caused by higher model computation cost and poor model fit. Compared with integer data, string data has the following characteristics: (1) the length of string data varies, resulting in large differences in data within the same dataset; (2) string data tends to be long, resulting in higher cost of comparison operations; (3) the distribution of string data is usually more uneven than that of integers due to shared prefixes and substrings. This is mainly attributed to the obvious difference in distribution between segments with and without shared prefixes.
[0006] Prediction of integers usually requires only one multiplication and addition, while the computational cost of strings increases with the length of the string, which increases the computational overhead. In addition, the presence of prefixes and substrings can lead to increased model fitting errors for string data. This is because strings with the same prefix usually show low byte variations, while strings without the same prefix tend to have high byte variations.
[0007] When the amount of data in a node is large and follows a linear trend, the learning index has obvious advantages; when the data on the node is small or presents a more complex distribution, the B+ tree can provide better space and time performance. This allows us to consider a hybrid index that combines the learning index and the B+ tree, making full use of the advantages of the two index structures, thereby providing the best performance under different data scales and query requirements. Summary of the invention
[0008] In view of the defects of the prior art, the object of the present invention is to provide a string data reading optimization method based on B+ tree and learning index.
[0009] A string data read optimization method based on a B+ tree and a learning index provided by the present invention includes:
[0010] String slice method: Store an 8-byte string slice in each node of the learning index, convert the string slice into an unsigned long integer, and fill it with null characters if the string slice is shorter than 8 bytes. For the converted integers, we use RMI to build the learning index, and each model in the learning index only stores one slope and intercept.
[0011] Adaptive index selection strategy: When the data scale on the node is large, a learning index is established for the node; for nodes with medium data scale, the index type is determined based on the average error of the linear fitting of the data; when the data scale on the node is extremely small, a B+ tree is selected as the terminal node.
[0012] Constructing a hybrid index method: Use a learned index for the root node and evaluate the data in the next layer of nodes to select the optimal node type (learned index or B+ tree). If the string slice in the learned index node is shorter than 8 bytes, it is padded with null characters.
[0013] B+ tree node partial key method: store partial keys of strings when constructing B+ tree nodes. Start selecting from the last character of the data, and first use a partial key of length 1 to evaluate the difference between strings. If a single character is not enough to distinguish the data, increase the length of the partial key until it is completely distinguished.
[0014] Preferably, the string slicing method comprises the following steps:
[0015] Step A1: Get the first 8 bytes of the string in the root node;
[0016] Step A2: Convert each 8-byte string data into an unsigned long integer by converting the byte value of each character into a digital form and then concatenating the bytes in sequence into an unsigned long integer, keeping the original order of the data;
[0017] Step A3: traverse and identify string slices with a length less than 8 bytes, and fill them with null characters to 8 bytes to ensure uniform length;
[0018] Step A4: Use RMI to build a learning index. The RMI model learns the trend of the input data to output the predicted position. Each RMI model learns the appropriate slope and intercept according to the characteristics of the input data. Each model in the learning index only stores one slope and intercept.
[0019] Step A5: If the next node is still a learning index, continue to split the subsequent substrings by 8 bytes. When only non-repeating string data is left in a node, stop splitting. If the next node is a B+ tree, stop splitting the substrings.
[0020] Preferably, the adaptive index selection strategy step includes:
[0021] Step B1: traverse the current node and calculate the number of data items stored in the node;
[0022] Step B2: setting the number threshold of nodes, including the maximum number threshold and the minimum number threshold;
[0023] Step B3: If the data volume of the current node exceeds the maximum threshold, the node is defined as a learning index node; if the data volume of the current node is less than the minimum threshold, the node is defined as a B+ tree node;
[0024] Step B4: If the data volume of the current node is between the maximum quantity threshold and the minimum quantity threshold, the least square method is used to fit the data and the fitting error is calculated;
[0025] Step B5: Setting the error threshold of the node;
[0026] Step B6: If the average error is less than the error threshold, the node is defined as a learning index node; if the average error is greater than the error threshold, the node is defined as a B+ tree node;
[0027] Step B7: For the learning index node, use the linear model for training;
[0028] Step B8: For the B+ tree node, record the starting position of the substring, and construct a B+ tree using the substring.
[0029] Preferably, the steps of constructing a mixed index method include:
[0030] Step C1: Process the real data set and the synthetic data set, remove the strings longer than 128 bytes, and perform deduplication operations;
[0031] Step C2: Sort the processed data set in lexicographic order using the sort function;
[0032] Step C3: if the amount of data in the root node is less than the set maximum number threshold, the root node is set as a learning index node;
[0033] Step C4: Check whether the data inside the next node is empty;
[0034] Step C5: If the internal data of the node is not empty, register the type of the current node according to the adaptive index selection strategy, mark the node as a learning index node or a B+ tree node, and adjust its processing method according to the type; otherwise, end the index building process;
[0035] Step C6: If the current node data is not empty and the index selection is completed, continue to search for the next node;
[0036] Step C7: register a child node for the next node found, and insert the key-value pair of the parent node into the hash table for indexing;
[0037] Step C8: Recursively execute C3-C7 until all data has been inserted.
[0038] Preferably, the B+ tree node partial key method steps include:
[0039] Step D1: Determine whether the current data set is a synthetic random data set;
[0040] Step D2: If it is a synthetic random data set, first obtain the last character of the data from the tail of the B+ tree node for preliminary judgment;
[0041] Step D3: Compare the tail character with other data in the node to check whether the character can effectively distinguish different data items. If the character can distinguish all data, the selection of the partial key can be determined.
[0042] Step D4: If a single character cannot distinguish all the data in the node, scan the characters forward step by step;
[0043] Step D5: Verify the data discrimination again;
[0044] Step D6: When all data inside the node can be effectively distinguished, the length and content of the partial key are determined.
[0045] A string data read optimization method based on a B+ tree and a learning index provided by the present invention includes:
[0046] String slicing method: split each string into 8-byte slices, convert them into unsigned long integers, fill them with null characters if they are less than 8 bytes, use RMI to build a learning index for the converted integers, and store a slope and intercept for each model;
[0047] Adaptive index selection strategy: When the data scale on a node is large, a learning index is established for the node; for nodes with medium data scale, the index type is determined based on the average error of the linear fit of the data; when the data scale on a node is extremely small, a B+ tree is selected as the terminal node;
[0048] Construct a hybrid index method: use the learned index for the root node and evaluate the data of the next layer of nodes to select the most appropriate node type. If the string slice length in the learned index node is less than 8 bytes, it is padded to 8 bytes with null characters.
[0049] B+ tree node partial key method: When constructing a B+ tree node, select a partial key starting from the last character of the string. First, use a partial key of length 1 to evaluate the difference between strings. If one character is not enough to distinguish the data, gradually increase the length of the partial key until all data can be fully distinguished.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] 1. Improve the access speed of string data. Use a one-dimensional linear regression model for prediction by string slicing and integer conversion. Avoid converting strings into multi-dimensional feature vectors to reduce model calculation overhead. For repeated 8-byte data, SLIN stores it only once in the learning index node, which can reduce the impact of the shared prefix of the previous layer on the distribution of data in the next layer and reduce model errors.
[0052] 2. Solve the performance bottleneck when processing data of different scales. Use learning indexes on nodes with larger data scales to reduce unnecessary search operations through model prediction and improve retrieval efficiency. For medium-sized nodes, select the most appropriate index type by evaluating the linear fitting error of the data to reduce resource consumption while ensuring efficiency. Use B+ trees as terminal nodes on nodes with smaller data scales to ensure the simplicity and efficiency of the query process and reduce unnecessary overhead.
[0053] 3. By evaluating the data of each layer of nodes and selecting the most appropriate index type, the advantages of different index structures are maximized, query efficiency is improved, and resource waste is reduced. When the string slice length is less than 8 bytes, empty characters are filled to ensure the consistency and accuracy of the index structure.
[0054] 4. Effectively reduce the size of B+ tree nodes and improve retrieval efficiency. Gradually increase the length of partial keys to reduce unnecessary comparison operations while ensuring discrimination. Compared with the traditional full key method, this partial key method can significantly reduce the storage space of the index, improve the efficiency of memory usage, and improve the efficiency of key value comparison during query. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is the overall framework diagram of the present invention.
[0056] Figure 2 The figure is a schematic diagram of the steps of constructing a hybrid index according to a specific embodiment of the present invention.
[0057] Figure 3 Schematic diagram of data indexing steps according to a specific embodiment of the present invention. DETAILED DESCRIPTION
[0058] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.
[0059] According to a string data reading optimization method based on B+ tree and learning index provided by the present invention, Figure 1 As shown, including:
[0060] String slicing method: Slice the string in the node by 8 bytes, convert the sliced data into 64-bit binary values according to the ASCII code, and then convert it into an unsigned long integer. If the string slice is shorter than 8 bytes, it is padded with null characters. Use a hash table to store the integer data slices of the parent node and bytes, and the parent node parentNode and the child node childNode are one-to-many mappings. For the converted data, we use RMI to build a learning index, and each model in the learning index only stores one slope and intercept.
[0061] Adaptive index selection strategy: Get the data volume columnData in the current node and filter out the total amount of non-repeated data fanout. When fanout is less than or equal to the maximum number threshold fanoutThreshold, greater than or equal to the minimum number threshold fanoutThresholdmin, and greater than or equal to the error threshold errorThreshold, establish a learning index for the node; otherwise, establish a B+ tree node.
[0062] Construct a hybrid index method: use the learning index for the rootNode and evaluate the data in the next layer of nodes. Use the amount of data columnData and the average error mean_error in the current node in the next node as input parameters to calculate the optimal node type.
[0063] B+ tree node partial key method: receives string array keys, starting byte position startByte and maximum length of partial key length as parameters. Starting from the startByte position of each string, extract the corresponding substring and store these substrings in subKeys. In this process, minLength is continuously updated to determine the shortest length of the substring.
[0064] Specifically, the string slicing method steps include:
[0065] Step A1: Get the first 8 bytes of the string in the root node;
[0066] Step A2: For an 8-byte string, extract the byte value of each character and ensure that the character is converted to an unsigned byte type. The byte value of each character is left-shifted to ensure that it is correctly spliced into the final number. The byte values of these characters will be spliced in order to form an unsigned long integer value, and the original order of the data is maintained.
[0067] Step A3: traverse and identify string slices with a length less than 8 bytes, and fill them with null characters to 8 bytes to ensure uniform length;
[0068] Step A4: Use RMI to build a learning index. The RMI model learns the trend of the input data to output the predicted position. Each RMI model learns the appropriate slope and intercept according to the characteristics of the input data. Each model in the learning index only stores one slope and intercept.
[0069] Step A5: If the next node is still a learning index, continue to split the subsequent substrings by 8 bytes. When only non-repeating string data is left in a node, stop splitting. If the next node is a B+ tree, stop splitting the substrings.
[0070] Specifically, for step A4: for the string data group that has been converted into an unsigned long integer in the node, use the RMI model to build a learning index. RMI is an interpolation method based on a regression model that predicts the location of the data by learning the trend of the data. The training data (8-byte numerical value of the string) is selected as the input, and the RMI model learns the trend of the input data and determines the slope and intercept through linear regression. The goal is to minimize the error between the input data and the predicted value by finding a suitable slope and intercept. The linear regression model of RMI is expressed as follows:
[0071] Y=aX+b
[0072] Among them, a is the slope and b is the intercept. After training, the RMI model can predict each data point and output the predicted position of the data point.
[0073] Specifically, for step A5: get the type of the current node according to parentNode->getType(). When the current node is a learning index, continue to split the data. The splitting operation is performed on 8 bytes, and the next layer of data is processed recursively. The recursion ends when only unique, non-repeating string data is left. This means that each substring used for learning indexing in this node is unique and does not need to be further subdivided. If the current node is a B+ tree index, stop the splitting operation because the B+ tree naturally supports the storage and indexing operations of variable-length strings.
[0074] Specifically, the adaptive index selection strategy is as follows: Figure 2 As shown, including:
[0075] Step B1: traverse the current node and calculate the number of data items stored in the node;
[0076] Step B2: setting the number threshold of nodes, including the maximum number threshold and the minimum number threshold;
[0077] Step B3: If the data volume of the current node exceeds the maximum threshold, the node is defined as a learning index node; if the data volume of the current node is less than the minimum threshold, the node is defined as a B+ tree node;
[0078] Step B4: If the data volume of the current node is between the maximum quantity threshold and the minimum quantity threshold, the least square method is used to fit the data and the fitting error is calculated;
[0079] Step B5: Setting the error threshold of the node;
[0080] Step B6: If the average error is less than the error threshold, the node is defined as a learning index node; if the average error is greater than the error threshold, the node is defined as a B+ tree node;
[0081] Step B7: For the learning index node, use the linear model for training;
[0082] Step B8: For the B+ tree node, record the starting position of the substring, and construct a B+ tree using the substring.
[0083] Specifically, for steps B2 and B5: In step B2, the maximum number threshold fanoutThreshold and the minimum number threshold fanoutThresholdmin are the key to selecting the index type. For nodes with data volumes exceeding fanoutThreshold, a learning index is used. For nodes with data volumes below fanoutThresholdmin, the scale is too small, and a simpler B+ tree is selected as the index. The minimum number threshold should ensure that query efficiency is still guaranteed when the data volume is extremely small. fanoutThreshold and fanoutThresholdmin are determined by setting multiple sets of data for experiments. The experimental results show that the throughput of the search operation is higher when fanoutThreshold=5000 and fanoutThresholdmin=256. In step 5, an error threshold is set to determine whether to use the learning index. The error threshold is determined to be 64 after experiments. If the fitting error is lower than the set error threshold, it means that the data of the node can be well represented by a linear model, and the learning index is selected. If the fitting error is greater than the error threshold, it means that the linear relationship of the data is weak, and the use of the learning index may not bring obvious performance improvement. At this time, a more traditional B+ tree index is selected.
[0084] Specifically, for step B3: When the number of data items in the current node exceeds the fanoutThreshold, it indicates that the data stored in the node is very large, and a simple B+ tree index may not be able to effectively support efficient queries. Choose to use a learning index for modeling. The learning index constructs a linear regression model to efficiently access and predict data and accelerate the query process. When the number of data items in the current node is less than the minimum number threshold, the amount of data in the node is too small, and using a learning index may cause unnecessary overhead and computational complexity. At this time, choose to use the classic index structure, namely the B+ tree index, which can provide better performance than the learning index for small-scale variable-length string data.
[0085] Specifically, for step B4: when the amount of data is between the maximum and minimum thresholds, the data is linearly fitted by the least squares method to evaluate the feasibility of using the learning index. The least squares method fits the data in the node to a straight line and attempts to minimize the sum of squared errors between the fitted model and the actual data. After the calculation is completed, a linear model containing a slope and an intercept is obtained that can approximate the data relationship. After the fitting is completed, the fitting error of the model is calculated. The error calculation formula is as follows:
[0086]
[0087] Among them, y i is the actual data point, It is the predicted value calculated by fitting the model.
[0088] Specifically, the method for constructing a hybrid index includes:
[0089] Step C1: Process the real data set and the synthetic data set, remove the strings longer than 128 bytes, and perform deduplication operations;
[0090] Step C2: Sort the processed data set in lexicographic order using the sort function;
[0091] Step C3: if the amount of data in the root node is less than the set maximum number threshold, the root node is set as a learning index node;
[0092] Step C4: Check whether the data inside the next node is empty;
[0093] Step C5: If the internal data of the node is not empty, register the type of the current node according to the adaptive index selection strategy, mark the node as a learning index node or a B+ tree node, and adjust its processing method according to the type; otherwise, end the index building process;
[0094] Step C6: If the current node data is not empty and the index selection is completed, continue to search for the next node;
[0095] Step C7: register a child node for the next node found, and insert the key-value pair of the parent node into the hash table for indexing;
[0096] Step C8: Recursively execute C3-C7 until all data has been inserted.
[0097] Specifically, for step C5: check whether the data in the node is empty. If not, extract the string slice from the data and record the data slice information of the current index node on the parent node. The index type is dynamically selected based on the two parameters of the data volume fanout and the average error mean_error of the string slice in the node. Compare fanout and mean_error with the set fanoutThreshold, fanoutThresholdmin and errorThreshold to obtain the best node type. If the data in the node is empty, the recursive process terminates and the index construction process ends.
[0098] Specifically, for step C7: for each key-value pair in the parent node, a portion of child nodes will be created and registered with the parent node. Each key-value pair of the parent node is inserted into the hash table, and parentNode->registerChild is used to associate the child node pointer node with the key value of the parent node, ensuring that each child node uniquely corresponds to a key of the parent node. After registration is completed, data is inserted into the child node. This facilitates the query process to quickly locate the corresponding child node through the parent node, achieving efficient data access.
[0099] For details, please refer to the query process after all steps are completed. Figure 3 .
[0100] Specifically, the B+ tree node partial key method includes:
[0101] Step D1: Determine whether the current data set is a synthetic random data set;
[0102] Step D2: If it is a synthetic random data set, first obtain the last character of the data from the tail of the B+ tree node for preliminary judgment;
[0103] Step D3: Compare the tail character with other data in the node to check whether the character can effectively distinguish different data items. If the character can distinguish all data, the selection of the partial key can be determined.
[0104] Step D4: If a single character cannot distinguish all the data in the node, scan the characters forward step by step;
[0105] Step D5: Verify the data discrimination again;
[0106] Step D6: When all data inside the node can be effectively distinguished, the length and content of the partial key are determined.
[0107] A string data read optimization method based on a B+ tree and a learning index provided by the present invention includes:
[0108] String slicing method: In each learning index node, the string is divided into 8-byte slices and converted to unsigned long integers. If a string slice is less than 8 bytes, it is padded with null characters to make up 8 bytes. Based on these converted integer values, a regression model (RMI) is used to build a learning index. Each regression model only stores a pair of slope and intercept for efficient prediction and lookup during the indexing process.
[0109] Adaptive index selection strategy: For nodes with large data scale, choose to build a learning index to speed up the query. In nodes with moderate data scale, dynamically decide which type of index to use based on the average error of the linear fitting model. For nodes with very small data volume, use the traditional B+ tree as the index structure to ensure query performance under small data volume.
[0110] Constructing a hybrid index method: Use the learned index for the root node, and evaluate the data characteristics of the lower-level nodes to select the most suitable index method. For the learned index node, if the string slice length is less than 8 bytes, it will be padded with null characters to ensure the consistency of each index node.
[0111] B+ tree node partial key method: When constructing a B+ tree node, a partial key strategy is used. Starting from the last character of the string, substrings are gradually selected. First, a partial key with a length of 1 is used to determine the difference between different strings. If a single character cannot effectively distinguish the data, the length of the partial key is increased until a partial key that can uniquely identify each string is found, which helps to reduce storage space and improve query efficiency.
[0112] In the description of the present application, it should be understood that the terms "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0113] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A string data reading optimization method based on B+ tree and learning index, characterized in that: include: String slice method: Store an 8-byte string slice in each node of the learning index, convert the string slice into an unsigned long integer, and fill it with null characters if the string slice is shorter than 8 bytes. For the converted integers, we use RMI to build the learning index, and each model in the learning index only stores one slope and intercept. Adaptive index selection strategy: When the data scale on the node is large, a learning index is established for the node; for nodes with medium data scale, the index type is determined based on the average error of the linear fitting of the data; when the data scale on the node is extremely small, a B+ tree is selected as the terminal node. Constructing a hybrid index method: Use a learned index for the root node and evaluate the data in the next layer of nodes to select the optimal node type (learned index or B+ tree). If the string slice in the learned index node is shorter than 8 bytes, it is padded with null characters. B+ tree node partial key method: store partial keys of strings when constructing B+ tree nodes. Start selecting from the last character of the data, and first use a partial key of length 1 to evaluate the difference between strings. If a single character is not enough to distinguish the data, increase the length of the partial key until it is completely distinguished.
2. According to claim 1, a string data reading optimization method based on B+ tree and learning index is characterized in that: String slicing method: Step A1: Get the first 8 bytes of the string in the root node; Step A2: Convert each 8-byte string data into an unsigned long integer by converting the byte value of each character into a digital form and then concatenating the bytes in sequence into an unsigned long integer, keeping the original order of the data; Step A3: traverse and identify string slices with a length less than 8 bytes, and fill them with null characters to 8 bytes to ensure uniform length; Step A4: Use RMI to build a learning index. The RMI model learns the trend of the input data to output the predicted position. Each RMI model learns the appropriate slope and intercept according to the characteristics of the input data. Each model in the learning index only stores one slope and intercept. Step A5: If the next node is still a learning index, continue to split the subsequent substrings by 8 bytes. When only non-repeating string data is left in a node, stop splitting. If the next node is a B+ tree, stop splitting the substrings.
3. The string data reading optimization method based on B+ tree and learning index according to claim 1 is characterized in that: Adaptive index selection strategy: Step B1: traverse the current node and calculate the number of data items stored in the node; Step B2: setting the number threshold of nodes, including the maximum number threshold and the minimum number threshold; Step B3: If the data volume of the current node exceeds the maximum threshold, the node is defined as a learning index node; If the data volume of the current node is less than the minimum threshold, the node is defined as a B+ tree node; Step B4: If the data volume of the current node is between the maximum quantity threshold and the minimum quantity threshold, the least square method is used to fit the data and the fitting error is calculated; Step B5: Setting the error threshold of the node; Step B6: If the average error is less than the error threshold, the node is defined as a learning index node; Otherwise the node is defined as a B+ tree node; Step B7: For the learning index node, use the linear model for training; Step B8: For the B+ tree node, record the starting position of the substring, and construct a B+ tree using the substring.
4. The string data reading optimization method based on B+ tree and learning index according to claim 1 is characterized in that: Constructing mixed index method: Step C1: Process the real data set and the synthetic data set, remove the strings longer than 128 bytes, and perform deduplication operations; Step C2: Sort the processed data set in lexicographic order using the sort function; Step C3: if the amount of data in the root node is less than the set maximum number threshold, the root node is set as a learning index node; Step C4: Check whether the data inside the next node is empty; Step C5: If the internal data of the node is not empty, register the type of the current node according to the adaptive index selection strategy, mark the node as a learning index node or a B+ tree node, and adjust its processing method according to the type; otherwise, end the index building process; Step C6: If the current node data is not empty and the index selection is completed, continue to search for the next node; Step C7: register a child node for the next node found, and insert the key-value pair of the parent node into the hash table for indexing; Step C8: Recursively execute C3-C7 until all data has been inserted.
5. The string data reading optimization method based on B+ tree and learning index according to claim 1 is characterized in that: B+ tree node partial key method: Step D1: Determine whether the current data set is a synthetic random data set; Step D2: If it is a synthetic random data set, first obtain the last character of the data from the tail of the B+ tree node for preliminary judgment; Step D3: Compare the tail character with other data in the node to check whether the character can effectively distinguish different data items. If the character can distinguish all data, the selection of the partial key can be determined. Step D4: If a single character cannot distinguish all the data in the node, scan the characters forward step by step; Step D5: Verify the data discrimination again; Step D6: When all data inside the node can be effectively distinguished, the length and content of the partial key are determined.
Citation Information
Cited By
Sewage purification data processing method
CN120336407A
Data deduplication method and system based on learning type index
CN121434212A