Sample index tree construction and approximate calculation method and device for distributed database

By constructing a sample index B-tree through a combination of hierarchical sampling and B-tree indexing, the inefficiency of traditional database indexes in large-scale data processing is solved, achieving efficient index construction and querying, and is suitable for distributed database systems.

CN116991852BActive Publication Date: 2026-01-16HIGHGO SOFTWARE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311022053.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-15
Publication Date
2026-01-16
Estimated Expiration
2043-08-15

AI Technical Summary

Technical Problem

Traditional database indexes suffer from low construction efficiency, degraded query performance, and uneven resource utilization in large-scale data processing. Furthermore, existing block sampling methods fail to effectively integrate with the underlying storage structure, resulting in a lack of correlation between the index and storage, which affects query and retrieval efficiency.

Method used

By employing stratified sampling to construct a sample index B-tree, and combining the B-tree index with the physical distribution of data, a sample index B-tree is constructed through stratified sampling of the database index of the distributed database. This achieves efficient index construction and querying, and the sample index tree matches the actual physical distribution of the data.

Benefits of technology

It improves the efficiency of sample index tree construction and query speed, reduces resource consumption, and achieves efficient data query and retrieval, making it suitable for large-scale data and high-concurrency query scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116991852B_ABST
    Figure CN116991852B_ABST
Patent Text Reader

Abstract

The application provides a sample index tree construction and approximate calculation method and device for a distributed database, and the sample index tree construction method comprises the following steps: A10, acquiring a database index of the distributed database; A20, performing hierarchical sampling on the database index according to a preset rule to construct a sample index B-tree. When the sample index tree is constructed, the sample index tree is constructed by performing hierarchical sampling on the database index of the distributed database, the scanning of all data of the distributed database is not needed, and therefore the construction efficiency of the sample index tree is improved. Moreover, the constructed sample index tree is a B-tree index, the B-tree index adopts an efficient balanced search tree structure, and can quickly support the query and retrieval operation of data. In addition, the data organization mode of the sample index B-tree constructed by hierarchical sampling from the original database index is matched with the physical distribution of actual data, is beneficial to the balance of resources, and ensures the efficient utilization of the index.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of database technology, and particularly relates to a sample index tree construction and approximate calculation method and device for distributed databases. BACKGROUND

[0002] Database indexing is an important component of database systems, used to accelerate data query and retrieval operations. Traditional database indexing is usually based on existing data construction, using B-tree, B+ tree and other data structures to support fast data lookup.

[0003] However, with the increase in data volume and the demand for complex queries, traditional database indexing has some challenges, such as low index construction efficiency, decreased query performance, and uneven resource utilization.

[0004] Distributed database systems are proposed solutions to solve large-scale data storage and query problems. In distributed databases, data is usually distributed across multiple physical nodes, and query plans need to be executed on these nodes to achieve parallel query and distributed data management. To improve the performance of distributed database systems, more efficient index construction and query optimization methods are needed.

[0005] The prior art (Publication No. CN10877670A) proposes an efficient sampling method for targeted queries, which uses a block sampling calculation method to process large data using sampling. The steps of the block sampling calculation method are as follows:

[0006] Data block: The original data is divided into blocks according to a certain block size, each block containing a certain number of data records.

[0007] In-block sampling: Sampling is performed within each data block, selecting a portion of the data records as sample data.

[0008] Sample index construction: Construct a sample index of ordinary tree structure, such as a binary tree or balanced tree, on the sample data.

[0009] Approximate calculation: Based on the sample data and sample index, perform approximate calculation operations.

[0010] The above technical solution requires full table scanning when constructing the sample index, which may result in high computational complexity and resource consumption. In addition, the index of ordinary tree structure is relatively low in efficiency, which may affect the performance of query and retrieval operations. Most importantly, the index is not associated with the underlying storage structure, and cannot achieve efficient addressing and classification. SUMMARY

[0011] The technical problem to be solved by the present application is to improve the accuracy and efficiency of data approximate calculation.

[0012] The sample index tree construction method of the distributed database according to an embodiment of the present application comprises:

[0013] A10, obtaining a database index of a distributed database;

[0014] A20, performing hierarchical sampling on the database index according to a preset rule to construct a sample index B-tree.

[0015] The sample index tree construction method of the distributed database according to an embodiment of the present application, when constructing a sample index tree, performs hierarchical sampling on the database index of the distributed database to realize the construction of the sample index tree, without scanning all data of the distributed database, thereby improving the construction efficiency of the sample index tree. Moreover, the constructed sample index tree is a B-tree index, the B-tree index adopts an efficient balanced search tree structure, and can quickly support data query and retrieval operations. In addition, the data organization mode of the sample index B-tree constructed by hierarchical sampling from the original database index matches the physical distribution of actual data, which is beneficial to the balance of resources and ensures the efficient use of the index.

[0016] According to some embodiments of the present application, in step A10, the obtained database index comprises the structure and node information of the database index.

[0017] In some embodiments of the present application, the database index is a B-tree index, and in step A20, the number of leaf nodes of the constructed sample index B-tree and the database index B-tree is consistent.

[0018] According to some embodiments of the present application, in step A20, when sampling each layer of the database index, the preset rule adopts one of the following:

[0019] Random sampling rule, reservoir sampling rule, sampling according to the characteristics and attributes of data.

[0020] The sample index tree construction device of the distributed database according to an embodiment of the present application comprises:

[0021] An obtaining module is configured to obtain a database index of a distributed database;

[0022] A sample index construction module is configured to perform hierarchical sampling on the database index according to a preset rule to construct a sample index B-tree.

[0023] The sample index tree construction device of the distributed database according to the embodiment of the present application, when constructing the sample index tree, realizes the construction of the sample index tree by stratified sampling of the database index of the distributed database, without scanning all data of the distributed database, and improves the construction efficiency of the sample index tree. Moreover, the constructed sample index tree is a B-tree index, the B-tree index adopts an efficient balanced search tree structure, and can quickly support data query and retrieval operations. In addition, the data organization mode of the sample index B-tree constructed by stratified sampling of the original database index matches the physical distribution of actual data, is beneficial to resource balance, and ensures efficient use of the index.

[0024] According to some embodiments of the present application, the database index acquired by the acquisition module includes acquiring structure and node information of the database index.

[0025] In some embodiments of the present application, the database index is a B-tree index, and the sample index B-tree constructed by the sample index construction module keeps consistent with the proportion of the number of leaf nodes under each node of the database index B-tree.

[0026] According to some embodiments of the present application, when sampling each layer of the database index, the preset rule adopted by the sample index construction module is one of the following:

[0027] Random sampling rule, reservoir sampling rule, sampling according to the characteristics and attributes of data.

[0028] The data approximate calculation method of the distributed database according to the embodiment of the present application comprises:

[0029] S10, constructing a sample index B-tree by using the sample index tree construction method of the distributed database as described above;

[0030] S20, acquiring sample data through the sample index B-tree, and performing approximate calculation based on the sample data.

[0031] The data approximate calculation device of the distributed database according to the embodiment of the present application comprises:

[0032] A sample index tree construction device is configured to construct a sample index B-tree, and the sample index tree construction device adopts the sample index tree construction device of the distributed database as described above;

[0033] A calculation module is configured to acquire sample data through the sample index B-tree, and perform approximate calculation based on the sample data.

[0034] The data approximate calculation method and device of the distributed database according to the embodiment of the present application solve the approximate calculation task of a large-scale data set by combining stratified sampling with a B-tree index, and have the following beneficial effects:

[0035] Improve the representativeness of the sample: stratified sampling is an effective sampling method, and the sample index B-tree constructed based on the database index of the distributed database can select a representative sample from the large-scale data set of the distributed database. By using stratified sampling, the constructed sample index can better represent the distribution of the original data, so as to obtain more accurate results in approximate calculation tasks.

[0036] Strongly associated B-tree index: by constructing the sample index as a B-tree index and strongly associating it with the data physical shards, the specified node can be quickly located for query and calculation operation. This strong association makes the query process more efficient, without traversing all the data, thereby greatly improving the calculation efficiency.

[0037] Efficient approximate calculation: due to the use of stratified sampling and B-tree index, the constructed sample index B-tree can quickly find the starting point of approximate calculation, thereby speeding up the process of approximate calculation. At the same time, through reasonable sampling algorithm, the value of approximate calculation can be more accurate, and the storage space and construction cost of the index are reduced under the premise of meeting the data query demand.

[0038] Balance between calculation accuracy and efficiency: the present application realizes the balance between calculation accuracy and efficiency in the approximate calculation task of large-scale data set. Through reasonable stratified sampling algorithm and B-tree index structure, the calculation efficiency can be improved while maintaining high calculation accuracy, which is suitable for large-scale data and high-concurrency query scenarios. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 The flow chart of the sample index tree construction method for the distributed database according to the embodiment of the present application is shown in the figure;

[0040] Figure 2 The composition schematic diagram of the sample index tree construction device for the distributed database according to the embodiment of the present application is shown in the figure;

[0041] Figure 3 The flow chart of the data approximate calculation method for the distributed database according to the embodiment of the present application is shown in the figure;

[0042] Figure 4 The composition schematic diagram of the data approximate calculation device for the distributed database according to the embodiment of the present application is shown in the figure;

[0043] Figure 5 The original database index structure diagram of the distributed database is shown in the figure;

[0044] Figure 6 The implementation schematic diagram of the database index each layer water pond sampling algorithm according to the embodiment of the present application is shown in the figure;

[0045] Figure 7 This is a schematic diagram illustrating the construction of a sample index tree according to an embodiment of the present invention;

[0046] Figure 8 This is a distributed storage-index topology diagram according to an embodiment of the present invention;

[0047] Figure 9 This is a flowchart illustrating the approximate data calculation process of a distributed database according to an embodiment of the present invention.

[0048] Figure label:

[0049] Data approximation calculation device 1000,

[0050] Sample index tree construction device 100,

[0051] Acquisition module 10, Sample index construction module 20,

[0052] Calculation module 200. Detailed Implementation

[0053] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments.

[0054] The steps described in the specification and the flowcharts in the accompanying drawings of this invention are not necessarily to be strictly followed according to the step numbers; the execution order of the steps can be changed. Furthermore, certain steps can be omitted, multiple steps can be combined into one step, and / or one step can be broken down into multiple steps.

[0055] like Figure 1 As shown, the sample index tree construction method for a distributed database according to an embodiment of the present invention includes:

[0056] A10, retrieves the database index of the distributed database;

[0057] It should be noted that the retrieved database indexes are the original database indexes of the distributed database, such as... Figure 5 As shown, the original database index can be a B-tree index. Of course, the original database index can also be a B+ tree index.

[0058] A20 performs stratified sampling of the database index according to preset rules to construct a sample index B-tree.

[0059] For example, when the database index is a B-tree index or a B+ tree index, the nodes of each layer of the B-tree index or the B+ tree index can be sampled according to a preset rule to construct a sample index B-tree. Of course, a sample index B+ tree can also be constructed. Thus, when the sample index B-tree is constructed, the full table scanning of the distributed database is not required, and the construction of the sample index B-tree can be realized by sampling and layering the original database index of the distributed database, which is efficient and convenient.

[0060] According to the sample index tree construction method of the distributed database provided in the embodiments of the present application, when the sample index tree is constructed, the sample index tree is constructed by layering and sampling the database index of the distributed database, the scanning of all data of the distributed database is not required, and the construction efficiency of the sample index tree is improved. Moreover, the constructed sample index tree is a B-tree index, the B-tree index adopts an efficient balanced search tree structure, and can quickly support the query and retrieval operations of data. In addition, the data organization mode of the sample index B-tree constructed by layering and sampling the original database index matches the physical distribution of actual data, is beneficial to the balance of resources, and ensures the efficient utilization of the index.

[0061] According to some embodiments of the present application, in step A10, the obtained database index includes the structure and node information of the obtained database index. It should be noted that the node information of the obtained database index can be the node information of all nodes of the database index, or only the node information of the extracted nodes, and the node information can include the index key value and the physical storage address of the node.

[0062] In some embodiments of the present application, the database index is a B-tree index, and in step A20, the number of leaf nodes of the constructed sample index B-tree is consistent with the number of leaf nodes of the database index B-tree. For example, when the second layer of the database index B-tree is three nodes, and the number of leaf nodes under the three nodes is 6, 6 and 2 respectively, the number of leaf nodes of the constructed sample index B-tree can be 3, 3 and 1, so as to keep the proportion of the number of leaf nodes consistent. Thus, the constructed sample index B-tree can be matched with the physical storage resources of the distributed database, and the calculation of each physical storage resource is balanced and efficient.

[0063] According to some embodiments of the present application, in step A20, when each layer of the database index is sampled, the preset rule adopts one of the following: a random sampling rule, a water reservoir sampling rule, and sampling according to the characteristics and attributes of data.

[0064] For example, when each layer of the database index is sampled, a random extraction method can be used to determine the nodes extracted from each layer. Figure 6As shown, the water pond sampling method can also be used to determine the nodes extracted in each layer; of course, the nodes extracted in each layer can also be determined according to the characteristics, attributes and the like of the data stored in the distributed database.

[0065] As shown in the figure, Figure 2 The sample index tree construction device 100 of the distributed database according to an embodiment of the present application comprises an acquisition module 10 and a sample index construction module 20.

[0066] The acquisition module 10 is configured to acquire a database index of the distributed database.

[0067] The sample index construction module 20 is configured to perform hierarchical sampling on the database index according to a preset rule, and construct a sample index B-tree.

[0068] The sample index tree construction device 100 of the distributed database according to an embodiment of the present application, when constructing a sample index tree, performs hierarchical sampling on a database index of the distributed database, thereby realizing the construction of the sample index tree, without the need to scan all data of the distributed database, thereby improving the construction efficiency of the sample index tree. Moreover, the constructed sample index tree is a B-tree index, the B-tree index adopts an efficient balanced search tree structure, and can quickly support data query and retrieval operations. In addition, the data organization mode of the sample index B-tree constructed by hierarchical sampling from the original database index matches the physical distribution of the actual data, which is conducive to the balance of resources and ensures the efficient use of the index.

[0069] According to some embodiments of the present application, the database index acquired by the acquisition module 10 comprises the structure and node information of the database index. It should be noted that the node information of the database index acquired by the acquisition module 10 can be the node information of all nodes of the database index, or only the node information of the extracted nodes, and the node information can include the index key value and the physical storage address of the node.

[0070] In some embodiments of the present application, the database index is a B-tree index, and the sample index B-tree constructed by the sample index construction module 20 has a consistent ratio of the number of leaf nodes to the sample index B-tree. For example, when the second layer of the database index B-tree has three nodes, and the number of leaf nodes under the three nodes is 6, 6 and 2 respectively, the number of leaf nodes corresponding to the sample index B-tree constructed by the sample index construction module 20 can be 3, 3 and 1, so as to keep the ratio of the number of leaf nodes consistent. Thus, the constructed sample index B-tree can match the physical storage resources of the distributed database, so that the calculation of each physical storage resource is balanced and efficient.

[0071] According to some embodiments of the present application, when sampling each layer of the database index, the sample index construction module 20 adopts the following one as the preset rule:

[0072] Random sampling rule, water pond sampling rule, sampling according to the characteristics and attributes of the data.

[0073] For example, the sample index construction module 20 can determine the nodes extracted at each layer in a random manner when sampling the layers of the database index; as shown in Figure 6 the nodes extracted at each layer can also be determined by using the water pond sampling method; of course, the nodes extracted at each layer can also be determined according to the characteristics and attributes of the data stored by the distributed database.

[0074] As shown in Figure 3 the data approximate calculation method of the distributed database according to the embodiment of the application comprises:

[0075] S10, the sample index B-tree is constructed by using the sample index tree construction method of the distributed database as described above, and specifically comprises:

[0076] A10, obtaining the database index of the distributed database;

[0077] A20, the database index is sampled according to a preset rule to construct a sample index B-tree.

[0078] S20, obtaining sample data through the sample index B-tree, and performing approximate calculation 1000 based on the sample data.

[0079] As shown in Figure 4 the data approximate calculation device 1000 of the distributed database according to the embodiment of the application comprises: a sample index tree construction device 100 and a calculation module 200.

[0080] The sample index tree construction device 100 is used to construct a sample index B-tree, and the sample index tree construction device 100 adopts the sample index tree construction device 100 of the distributed database as described above. The calculation module 200 is used to obtain sample data through the sample index B-tree, and perform approximate calculation 1000 based on the sample data.

[0081] The data approximate calculation method and device of the distributed database according to the embodiment of the application combine hierarchical sampling with B-tree index, solve the approximate calculation task of large-scale data sets, and have the following beneficial effects:

[0082] Improve the representativeness of the sample: hierarchical sampling is an effective sampling method, and the sample index B-tree constructed based on the database index of the distributed database can select representative samples from the large-scale data set of the distributed database. By using hierarchical sampling, the sample index constructed can better represent the distribution of the original data, so that more accurate results can be obtained in the approximate calculation task.

[0083] Strongly associated B-tree index: By constructing the sample index as a B-tree index and strongly associating it with the data physical shards, the specified node can be quickly located for query and calculation operations. This strong association makes the query process more efficient, without traversing all the data, thereby greatly improving the calculation efficiency.

[0084] Efficient approximate calculation: Due to the use of hierarchical sampling and B-tree index, the constructed sample index B-tree can quickly find the starting point of approximate calculation, thereby speeding up the process of approximate calculation. At the same time, through a reasonable sampling algorithm, the value of approximate calculation can be more accurate, and the storage space and construction cost of the index are reduced under the premise of meeting the data query demand.

[0085] Balancing between calculation accuracy and efficiency: The present application achieves a balance between calculation accuracy and efficiency in the approximate calculation task of large-scale data sets. Through a reasonable hierarchical sampling algorithm and B-tree index structure, the calculation efficiency can be improved while maintaining high calculation accuracy, which is suitable for large-scale data and high-concurrency query scenarios.

[0086] In addition, as shown in Figure 9 , when constructing the sample index B-tree, the user can also provide the system with a large-scale data set, and the system processes the large-scale data set. Then, the user requests data layering, and the system performs data layering processing. Then, the user requests hierarchical sampling, and the system performs hierarchical sampling processing. Finally, the user requests to construct the sample index B-tree, and the system completes the construction of the sample index B-tree.

[0087] When performing approximate calculation, the user initiates an approximate calculation request, and the system obtains sample data based on the sample index B-tree to perform approximate calculation and returns the approximate calculation result.

[0088] The present application will be described in detail below with reference to the accompanying drawings. It should be understood that the following description is only exemplary and should not be construed as a specific limitation of the present application.

[0089] The present application constructs a sample index B-tree by hierarchical sampling of existing database indexes, and realizes approximate calculation of big data based on the constructed sample index B-tree. The present application can effectively reduce the calculation complexity and resource consumption, and improve the calculation efficiency and query speed. At the same time, due to the characteristics of the sample index B-tree, efficient data query and retrieval can be supported, and real-time performance and operation response speed can be improved. Therefore, the present application provides an innovative method that can solve the problems of high calculation complexity and resource consumption in distributed database big data processing. The specific technical means adopted by the present application includes:

[0090] 1. Hierarchical sampling to construct sample index: hierarchical sampling is used to construct the index. Hierarchical sampling can greatly reduce the size of the index, improve the index construction efficiency and query performance.

[0091] 2、B-tree index data organization: the B-tree used to build the sample index adopts an efficient balanced search tree structure, which can quickly support data query and retrieval operations. The data organization mode of the B-tree index matches the physical distribution of the actual data, ensuring efficient use of the index, as shown in Figure 7 and Figure 8 .

[0092] 3、Deep integration of data warehouse architecture: the sample index B-tree is deeply integrated with the data warehouse architecture, making the index better adapt to the storage and query requirements of the data warehouse. By combining the characteristics of the data warehouse, the design and use of the index can be further optimized.

[0093] 4、Distributed storage foundation: the sample index B-tree as the foundation of the index can be distributed and managed across multiple nodes. This improves the scalability and fault tolerance of the system, and adapts to large-scale data and high-concurrency query scenarios. The B-tree index is strongly associated with data physical sharding, and the B-tree index construction is closely combined with data physical sharding, making the index structure better match the physical storage location of the actual data, thereby optimizing query performance.

[0094] 5、Distributed query plan optimization: the present application uses the sample index B-tree to generate a more uniform distributed query plan, fully utilizing the parallel processing capability of the distributed system to improve query performance and response speed.

[0095] 6、Efficient resource utilization and approximate calculation accuracy: due to the use of sampling technology, the index stores information about part of the data, not all of it. Through a reasonable hierarchical sampling algorithm, resources at each node are efficiently utilized, while the approximate calculation value is more accurate, and the storage space and construction cost of the index are reduced while meeting data query requirements.

[0096] 7、Result output: output the results of approximate calculation to users or other systems for subsequent processing or display.

[0097] The present application has the following beneficial effects:

[0098] Firstly, the present application adopts a hierarchical sampling technology to build a sample index, solving the shortcomings of traditional database indexes. Traditional database indexes usually require indexing all data, resulting in a large index size, low index construction efficiency, and possibly unsatisfactory query performance. The present application uses hierarchical sampling to index only part of the data, greatly reducing the size of the index, thereby improving index construction efficiency and query performance. Thus, the present application solves the problem of efficient index construction and query in large-scale data sets.

[0099] Secondly, the present application deeply integrates B-tree index with data warehouse architecture, and constructs a strong association between B-tree index and data physical shards. In this way, the index structure better matches the physical storage location of the actual data, optimizing query performance and solving the problem of how to implement efficient index management under the data warehouse architecture.

[0100] Thirdly, the present application generates a more uniform distributed query plan through sample index B-tree, fully utilizes the parallel processing capability of distributed systems, and improves query performance and response speed. At the same time, through the distributed storage foundation, it can perform distributed storage and management across multiple nodes, improving the scalability and fault tolerance of the system. Thus, the present application solves the problem of how to balance the processing of data in each node in a distributed database system, optimizes the query plan and response capability.

[0101] In summary, the technical scheme of the present application constructs sample index B-tree through hierarchical sampling, strongly associates with data warehouse architecture and distributed storage, and optimizes distributed query plan, solving the performance bottleneck and challenges existing in traditional database index and distributed database system. It improves the efficiency of index construction, query performance, data management and distributed query plan optimization, and is suitable for large-scale data and high-concurrency query scenarios, with significant advantages.

[0102] The following is a specific application example of the present application:

[0103] Suppose there is a large-scale e-commerce platform containing millions of product data, and it wants to analyze the sales trend of products and make approximate predictions based on sales data. This task requires a large amount of data calculation, but a completely accurate calculation may be very time-consuming and resource-intensive.

[0104] In this case, the present application can be used for approximate calculation. First, use the existing database index to construct a sample index B-tree. Then, through hierarchical sampling of product data, the data is divided into multiple levels. In each level, a portion of the product sample is selected and added to the sample index B-tree.

[0105] Next, the sample index B-tree can be used for approximate query and calculation. By quickly locating and obtaining product sample data in the sample index B-tree, approximate calculation of sales trends can be performed. For example, the overall sales trend can be estimated by counting the selected product sample data, and future sales can be predicted.

[0106] This approximate calculation method can greatly reduce the computational complexity and resource consumption, improve the calculation efficiency and query speed. At the same time, due to the high efficiency of the sample index B-tree, the approximate calculation result can be quickly obtained, speeding up the speed of data analysis and decision-making.

[0107] In summary, the application can apply the approximate calculation method in large-scale data processing, such as the sales trend analysis of an e-commerce platform. In this way, the calculation efficiency can be improved, the resource consumption can be reduced, and meaningful results can be obtained within a reasonable accuracy range, meeting the needs of actual applications.

[0108] Through the description of the specific embodiments, the technical means and effects adopted by the application to achieve the predetermined purposes can be more deeply and specifically understood. However, the accompanying drawings are only provided for reference and illustration, and are not used to limit the application.

Claims

1. A method for constructing a sample index tree of a distributed database, characterized in that, The method comprises the following steps: A10, obtaining a database index of a distributed database; A20, stratified sampling the database index according to a preset rule to construct a sample index B-tree. 2.The method of claim 1, wherein, In step A10, the obtained database index comprises obtaining structure and node information of the database index. 3.The method of claim 1, wherein, The database index is a B-tree index, and in step A20, the sample index B-tree is constructed to keep consistent with the proportion of the number of leaf nodes of the database index B-tree. 4.The method of claim 1, wherein, In step A20, when sampling each layer of the database index, the preset rule adopts one of the following rules: random sampling rule, water pond sampling rule, sampling according to the characteristics and attributes of data.

5. A sample index tree construction device for a distributed database, characterized in that, The method comprises the following steps: An obtaining module is configured to obtain a database index of a distributed database; A sample index construction module is configured to stratified sample the database index according to a preset rule to construct a sample index B-tree.

6. The apparatus for constructing a sample index tree of a distributed database according to claim 5, wherein, The database index obtained by the obtaining module comprises obtaining structure and node information of the database index.

7. The apparatus for constructing a sample index tree of a distributed database according to claim 5, wherein, The database index is a B-tree index, and the sample index construction module constructs the sample index B-tree to keep consistent with the proportion of the number of leaf nodes of the database index B-tree.

8. The apparatus for constructing a sample index tree of a distributed database according to claim 5, wherein, When sampling each layer of the database index, the preset rule adopted by the sample index construction module is one of the following rules: random sampling rule, water pond sampling rule, sampling according to the characteristics and attributes of data.

9. A method for data approximation computation of a distributed database, characterized by, The method comprises the following steps: S10, constructing a sample index B-tree by using the sample index tree construction method of the distributed database according to any one of claims 1-4; S20, obtaining sample data through the sample index B-tree, and performing approximate calculation based on the sample data. 10.A data approximate computing apparatus of a distributed database, characterized in that, The method comprises the following steps: A sample index tree construction device is configured to construct a sample index B-tree, and the sample index tree construction device adopts the sample index tree construction device of the distributed database according to any one of claims 6-8; A calculation module is configured to obtain sample data through the sample index B-tree, and perform approximate calculation based on the sample data.

Citation Information

Patent Citations

  • Learning-based index recommendation and evaluation method

    CN115408386A

  • Just-in-time analytics on large file systems

    US20120166478A1