Data query method and storage method of tree data management system and related equipment
By adopting the structure of a tree-like data management system in the database, and using the query mechanism of the root node and the leaf node, the equivalent query is directly conducted on the root node, which solves the problem of low query efficiency of existing databases and realizes more efficient data query.
Patent Information
- Application Number
- CN202411489298.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-25
AI Technical Summary
When querying data, existing databases cause multiple IO operations due to multi-layer queries of index storage structures, which is less efficient.
Using a tree-like data management system, through the structure of the root node and the leaf node, the query index key value is used to directly query equal value in the root node, determine the smallest key-value query interval and the corresponding address data interval, and reduce the number of IO operations.
It improves the efficiency of data query, reduces the number of IO operations, and improves system performance and user experience.
Smart Images

Figure CN119513148A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data management, and in particular to a data query method, a storage method and related equipment for a tree-like data management system. Background Art
[0002] With the rapid development of IoT technology, data generated by a large number of devices needs to be effectively managed and analyzed. As the core component of data storage and query, database plays a vital role in IoT systems. The speed of database query directly affects the performance of IoT systems, user experience, and the accuracy of business decisions.
[0003] In the related art, in order to speed up the query speed of data, a multi-layer index storage structure is generally established for the data table in the database to store the index key value and the storage address of the corresponding data, and in the actual query process of the query data, the query index key value is used to query the index storage structure layer by layer to obtain the storage address information of the query data, so as to obtain the query data at the storage address. However, since IO operations are required when performing equal value queries using the query index key value in each layer of the index storage structure, this method requires multiple IO operations in the process of obtaining the query data, and since the execution time of the IO operation is relatively long, the efficiency of data query in actual applications is low. Summary of the invention
[0004] The embodiments of the present application provide a data query method, a storage method and related devices for a tree-like data management system, which can improve the query efficiency of data query.
[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a data query method of a tree-like data management system, wherein the tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and wherein the root node stores the first index key value of at least one leaf node and the first address of the corresponding data address, wherein the method includes:
[0006] Get the query index key value of the data to be queried;
[0007] Selecting a minimum key value query interval from the root node based on the query index key value, the key value query interval includes a first key value and a second key value, when the first key value is the last index key value in the root node, the second key value is a preset default value, and the index key values in the root node data are sorted from small to large;
[0008] Obtain a first address and a second address corresponding to the first key value and the second key value respectively;
[0009] The data to be queried is searched and located within the address data interval formed by the first first address and the second first address.
[0010] In some embodiments, selecting a minimum key value query interval from the root node based on the query index key value includes:
[0011] Selecting a key value having the smallest difference with the query index key value and being less than or equal to the query index key value from the multiple index key values as the first key value;
[0012] The next index key value of the first key value is selected as the second key value.
[0013] To achieve the above-mentioned purpose, the second aspect of the embodiment of the present application proposes a data storage method of a tree-like data management system, wherein the tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and wherein the root node stores the first index key value of at least one leaf node and the first address of the corresponding data address, wherein the method includes:
[0014] Get the storage index key value of the data to be stored;
[0015] Determine a storage leaf node based on the storage index key value and the plurality of leaf nodes;
[0016] Storing the storage address of the data to be stored and the storage index key value in the storage leaf node;
[0017] The root node is updated according to the first index key value and the corresponding first address of the storage leaf node.
[0018] In some embodiments, determining the storage leaf node based on the storage index key value and the plurality of leaf nodes includes:
[0019] Obtain storage key value ranges of multiple leaf nodes;
[0020] When there is a storage key value range that matches the storage index key value, taking the leaf node corresponding to the matching storage key value range as the storage leaf node;
[0021] When there is no storage key value range that matches the storage index key value, the newly added leaf node is used as the storage leaf node.
[0022] In some embodiments, storing the storage address of the data to be stored and the storage index key value in the storage leaf node includes:
[0023] Select a storage location whose key value has the smallest difference with the storage index key value and is less than or equal to the storage index key value from the multiple storage locations storing the leaf node data as the preceding storage location, and select the storage location after the preceding storage location as the target storage location;
[0024] The storage index key value and the address data of the data to be stored are stored in the target storage location.
[0025] In some embodiments, storing the storage index key value and the address data of the to-be-stored data in the target storage location includes:
[0026] Using the address data corresponding to the preceding storage position as preceding address data;
[0027] Using the subsequent address data of the preceding address data as the storage address data of the data to be stored;
[0028] The storage index key value and the storage address data are stored in the target storage location.
[0029] In some embodiments, the tree-like data management system further includes at least one inner node, in which at least one index key value and a data address corresponding to the index key value are stored, the root node is associated with at least one inner node, and the inner node is associated with at least one leaf node data, and updating the root node according to the first index key value and the corresponding first address of the stored leaf node includes:
[0030] Update the inner node associated with the storage leaf node according to the first index key value of the storage leaf node and the corresponding first address;
[0031] The root node is updated according to the updated first index key value of the internal node and the corresponding first address.
[0032] To achieve the above-mentioned purpose, the third aspect of the embodiment of the present application proposes a data query device of a tree-like data management system, wherein the tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and wherein the root node stores the first index key value of each leaf node and the first address of the corresponding data address, wherein the device includes:
[0033] A first key value acquisition module is used to obtain a query index key value of the data to be queried;
[0034] An interval selection module, configured to select a minimum key value query interval from the root node based on the query index key value, wherein the key value query interval includes a first key value and a second key value, and when the first key value is the last index key value in the root node, the second key value is a preset default value, and the index key values in the root node data are sorted from small to large;
[0035] An address acquisition module, used to acquire a first address and a second address corresponding to the first key value and the second key value respectively;
[0036] A query module is used to query and locate the data to be queried within the address data interval formed by the first first address and the second first address.
[0037] To achieve the above-mentioned purpose, a fourth aspect of an embodiment of the present application proposes a data storage device of a tree-like data management system, wherein the tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and wherein the root node stores the first index key value of each leaf node and the first address of the corresponding data address, wherein the device includes:
[0038] A second key value acquisition module is used to obtain the storage index key value of the data to be stored;
[0039] A leaf node determination module, used to determine a storage leaf node based on the storage index key value and the plurality of leaf nodes;
[0040] A storage module, used for storing the storage address of the data to be stored and the storage index key value into the storage leaf node;
[0041] An update module is used to update the root node according to the first index key value and the corresponding first address of the storage leaf node.
[0042] To achieve the above-mentioned purpose, the fifth aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the data query method of the tree-like data management system described in the first aspect or the data storage method of the tree-like data management system described in the second aspect.
[0043] To achieve the above-mentioned purpose, the sixth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium, and the storage medium stores a computer program. When the computer program is executed by a processor, it implements the data query method of the tree-like data management system described in the first aspect or the data storage method of the tree-like data management system described in the second aspect.
[0044] The data query method, storage method and related equipment of the tree-like data management system proposed in the embodiment of the present application, the tree-like data management system includes a root node and at least one leaf node, the leaf node stores at least one index key value and the data address corresponding to the index key value, the root node stores the first index key value of each leaf node and the corresponding first address of the data address, the method includes: first, obtaining the query index key value of the data to be queried; then, based on the query index key value, selecting the smallest key value query interval from the root node, the key value query interval includes the first key value and the second key value, when the first key value is the last index key value in the root node, the second key value is a preset default value, and the index key values in the root node data are sorted from small to large; next, obtaining the first first address and the second first address corresponding to the first key value and the second key value respectively; finally, querying and locating the data to be queried in the address data interval composed of the first first address and the second first address. The embodiment of the present application utilizes the index key values and corresponding address data that are pre-sorted in ascending order in leaf nodes when storing data, and stores the first index key values of multiple leaf nodes and the corresponding first addresses of data addresses in a root node associated with the multiple leaf nodes. Therefore, in the actual data query process, the query index key value of the data to be queried is used to directly perform an equal value query in the root node, that is, match with multiple stored index key values to obtain the first key value and the second key value corresponding to the smallest key value query interval, and determine the corresponding first first address and second first address. At this time, only one IO operation is required, and then the address and key value corresponding to the storage are continuously stored, so that data query can be performed directly in the address data interval composed of the first first address and the second first address, without the need to perform multiple IO operations in the tree-like data management system, thereby effectively improving the query efficiency of data query.
[0045] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a structural diagram of a B+ tree provided in an embodiment of the present application.
[0047] Figure 2This is a structural diagram of a node storage unit provided in yet another embodiment of the present application.
[0048] Figure 3 This is a structural diagram of a storage unit provided in yet another embodiment of the present application.
[0049] Figure 4 It is a structural diagram of a tree-like data management system provided by another embodiment of the present application.
[0050] Figure 5 This is a flowchart of a data storage method of a tree-like data management system provided by another embodiment of the present application.
[0051] Figure 6 yes Figure 5 Flowchart of step 200 in FIG.
[0052] Figure 7 This is a schematic diagram of a left-handed tree link structure node provided by another embodiment of the present application.
[0053] Figure 8 This is a schematic diagram of a right-hand rotation of a tree link structure node provided by another embodiment of the present application.
[0054] Fig. 9 yes Figure 5 Flowchart of step 300 in FIG.
[0055] Fig.10 yes Fig.10 Flowchart of step 320 in FIG.
[0056] Fig.11 yes Figure 5 Flowchart of step 400 in FIG.
[0057] Fig.12 This is a process framework diagram of network data storage provided by another embodiment of the present application.
[0058] Fig.13 This is a flow chart of a data query method of a tree-like data management system provided by another embodiment of the present application.
[0059] Fig.14 yes Fig.13 Flowchart of step 600 in FIG.
[0060] Fig.15 This is a data query process framework diagram provided by another embodiment of the present application.
[0061] Fig.16 It is a structural diagram of a data query device of a tree-like data management system provided in one embodiment of the present application.
[0062] Fig.17It is a structural schematic diagram of a data storage device of a tree-like data management system provided in one embodiment of the present application.
[0063] Fig.18 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0065] It should be noted that although the functional modules are divided in the device schematic and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart.
[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0067] The development and application of smart home technology has made significant progress in the past few years. By combining environmental sensors, cameras, wireless communication technology and other equipment with the home environment, intelligent management of the home environment has been realized, such as air quality detection in bathroom scenes, fall detection alarms, automatic ventilation of bathroom heaters when using the toilet, automatic temperature control and water release of bathtubs in bathing mode + ambient music control, etc. However, with the development of big data technology, the number of connected devices in smart homes is also increasing. According to statistics, the shipment volume of smart home devices in China will reach about 220 million units in 2023 alone. When smart home devices are connected to the Internet and the massive data generated is written into the database, extremely high requirements are placed on the storage, transmission, processing and application capabilities of the data. For example, when querying data from the database, if the database result feedback cannot be obtained within the required time, it will lead to decreased system performance, increased resource usage, increased system load, and may even cause the system to crash or respond slowly.
[0068] In related technologies, in order to speed up data query, a multi-layer index storage structure is generally established for the data table in the database to store index key values and the storage address of the corresponding data. In the actual process of querying the data, the query index key value is used to query the index storage structure layer by layer to obtain the storage address information of the query data, so as to obtain the query data at the storage address.
[0069] Reference Figure 1, is a schematic diagram of the structure of a B+ tree provided in an embodiment of the present application. Figure 1 As shown in , a B+ tree is a tree data structure that can store data, sort it, and allow for search, sequential reading, insertion, and deletion with a time complexity of O(logN). Each B+ tree includes a root node, multiple inner nodes, and multiple leaf nodes. The root node is associated with multiple inner nodes, and each inner node is associated with multiple leaf nodes. Each storage unit in the root node stores the index key value of the associated inner node (such as Figure 1 1, 28, 66), unit identification (such as Figure 1 P1, P2, P3) and pointers to the associated inner nodes, each storage unit in each inner node stores the index key value of the associated leaf node (such as Figure 1 1, 10, 20 as shown in ), unit identification (such as Figure 1 P4, P5, P6) and pointers to the associated leaf nodes, each storage unit in each leaf node stores the index key value of each stored data (such as Figure 1 1, 8, 9) and storage addresses shown in . In addition, a B+ tree generally includes the following features: (1) The absolute value of the depth difference between the left and right subtrees cannot exceed 1; (2) Except for leaf nodes, the maximum number of storage units that can be stored in each node is determined by 16KB / storage space occupied by each storage unit; (3) Non-leaf nodes do not store data, but only store index key values + child node pointers, and data is only stored in leaf nodes; (4) Adjacent leaf nodes are connected by bidirectional pointers, and the index key values are sorted in increasing order.
[0070] Reference Figure 2 , is a schematic diagram of the structure of a node storage unit provided in an embodiment of the present application. Figure 2 As shown in , the size of a Page is usually 16KB, that is, each node is allocated 16KB of storage space, so Figure 1 Combination Figure 2 To analyze, since the inner node only needs to store the index (i.e., index key value + child node pointer), 16 bytes of space are allocated for each unit of index key value + child node pointer. Then a node can store up to 16KB / 16B=1000 storage units, that is, each node has 1000 child nodes. Figure 2 It can be seen that when the root node stores 1000 storage units, its child nodes (i.e., inner nodes) can store 1000×1000=1000000 storage units. Each inner node can store 10 data entries of 1600 bytes. It can be seen that to store 10 million 1600-byte data tables, the IO times of the entire B+ tree only need 3 times.
[0071] It is understandable that the system loads data from disk to memory once, which is called disk IO. The default size of each loaded data page is 16KB. In addition, compared with reading and writing data in memory, IO operations take longer time.
[0072] In addition, refer to Figure 3 , is a schematic diagram of a storage unit provided in an embodiment of the present application. Figure 3 As shown in, the smallest unit of disk storage data in a computer is a sector, and the size of a sector is 512 bytes, while the smallest unit of a file system (such as XFS / EXT4) is a block, and the size of a block is 4k. The InnoDB storage engine used in the embodiment of the present application also has its own smallest storage unit - page (Page), and the default size of a page is 16K, that is, the fixed-size unit (page: Page) for loading data from disk to memory is 16K.
[0073] Based on Figures 1 to 3 As shown in the figure, when a user queries data in the database, for example, if the index key is 8, by accessing the storage model of the index, when the tree depth is 0, the data will fall in the interval [1,28) after the IO operation; when the tree depth is 1, the data will fall in the interval [1,10) after the IO operation; when the tree depth is 2, the data will fall in the leaf node after the IO operation and read the storage address of the data corresponding to the key 8, that is, data retrieval can be completed through 3 IO operations.
[0074] It can be seen that the average time complexity of the B+ tree is O(logN), that is, when equal value queries are frequent, each equal value query must perform several IO operations on the database to retrieve the target data. Since the execution time of IO operations is long, the efficiency of data query in actual applications is low; in addition, when non-sequentially added data is frequently added, deleted, and modified, more IO operations are required because each data needs to be retrieved separately to confirm the target data address, resulting in a large amount of time required for data execution in high-concurrency scenarios. Taking user experience evaluation as an example, when a smart home family is connected to more smart home devices, the APP will start slowly and refresh data in circles for a long time. If it only relies on server expansion and increased computing power, as the number of smart home devices connected continues to increase, server cost investment will also continue to increase.
[0075] Based on this, in order to improve the query efficiency of data query, the embodiment of the present application utilizes the index key values and corresponding address data that are pre-sorted in leaf nodes in ascending order of numerical values when storing data, and stores the first index key values of multiple leaf nodes and the corresponding first addresses of data addresses in the root node associated with the multiple leaf nodes. Therefore, in the actual data query process, the query index key value of the data to be queried is used to directly perform an equal value query in the root node, that is, match with multiple stored index key values to obtain the first key value and the second key value corresponding to the smallest key value query interval, and determine the corresponding first first address and second first address. At this time, only one IO operation is required, and then the address and key value corresponding to the storage are stored continuously, so that data query can be performed directly in the address data interval composed of the first first address and the second first address, without the need to perform multiple IO operations in the tree-like data management system, thereby effectively improving the query efficiency of data query.
[0076] In order to better describe the data query method and data storage method of the tree-like data management system provided by the present application, the tree-like data management system applied to the data query method and data storage method of the tree-like data management system is first described below.
[0077] Reference Figure 4 , is a schematic diagram of the structure of a tree-like data management system provided in an embodiment of the present application. Figure 4 As shown in, similar to the above-mentioned B+ tree, the tree data management system provided in the embodiment of the present application also includes a root node, multiple internal nodes and multiple leaf nodes, and the root node is associated with multiple internal nodes, and each internal node is associated with multiple leaf nodes.
[0078] and Figure 1 The B+ tree shown is different in that Figure 4 As shown in , the index key value stored in each storage unit of the root node is the first index key value stored in the leaf node associated with the first storage unit in each associated internal node, and each storage unit of the root node unit also stores the starting address of the data address corresponding to the index key value.
[0079] Among them, the inner node and the first leaf node among the associated multiple leaf nodes can be bidirectionally connected, so that the leaf node can upload the first address of the stored first index key value and its corresponding address data to the inner node for storage; each inner node can also be bidirectionally connected to the root node, so that the inner node can upload the first address of the stored first index key value and its corresponding address data to the root node for storage.
[0080] In addition, the leaf nodes are used to store index key values corresponding to multiple pieces of storage data and the address data where the storage data is stored. These index key values are sorted in order from small to large according to the numerical value, and the storage addresses are also continuous; and every two adjacent leaf nodes are interconnected.
[0081] Based on Figure 4 The tree-like data management system shown in the figure further describes the data query method, storage method and related devices of the tree-like data management system provided in the embodiment of the present application. The data query method and storage method of the tree-like data management system provided in the embodiment of the present application can be applied to a server storing a database, or a control processor connected to a database.
[0082] The following first describes in detail the data storage method of the tree-like data management system in the embodiment of the present application. Figure 5 , is an optional flow chart of a data storage method of a tree-like data management system provided in an embodiment of the present application, Figure 5 The method may include but is not limited to steps 100 to 400. It can also be understood that this embodiment Figure 5 The order of step 100 to step 400 is not specifically limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs.
[0083] Step 100: Obtain the storage index key value of the data to be stored.
[0084] The following is a detailed description of step 100.
[0085] In some embodiments, in response to a database administrator creating a data table using the SQL statement Create table, the system will establish a set of index storage engines for the data table, such as "index key value + storage data", and then in response to storage requests for multiple data to be stored, each data to be stored needs to be stored one by one in a specific storage address of the hardware storage device, and its index key value and corresponding storage address are stored in the leaf node of the tree-like data management system to complete the storage process of the data to be stored.
[0086] Step 200: Determine a storage leaf node based on a storage index key value and a plurality of leaf nodes.
[0087] The following is a detailed description of step 200.
[0088] In some embodiments, in order to facilitate the convenience of subsequent data query, the index key values stored in the multiple leaf nodes in the tree data management system are stored in ascending order of numerical value. Therefore, in the storage process of a certain piece of data to be stored, after obtaining the storage index key value of the data to be stored, it is necessary to first determine the storage leaf node where the data to be stored should be stored from the existing multiple leaf nodes or the newly added leaf nodes based on the numerical value of the storage index key value. This will be further described below.
[0089] Reference Figure 6 , determining the storage leaf node based on the storage index key value and multiple leaf nodes, includes the following steps 210 to 230.
[0090] Step 210: Obtain storage key value ranges of multiple leaf nodes.
[0091] Step 220: When there is a storage key value range that matches the storage index key value, the leaf node corresponding to the matching storage key value range is used as the storage leaf node.
[0092] Step 230: When there is no storage key value range that matches the storage index key value, the newly added leaf node is used as the storage leaf node.
[0093] Steps 210 to 230 are described in detail below.
[0094] In some embodiments, in addition to obtaining the storage index key value of the data to be stored, the storage key value range of each existing leaf node is also obtained, and then the storage index key value is matched with multiple storage key value ranges to obtain a suitable storage leaf node.
[0095] It can be understood that the storage key value range of the leaf node can be obtained by obtaining the first index key value and the last index key value stored in each leaf node, and then using the numerical range between these two index key values as the storage key value range, or by pre-dividing the appropriate storage key value range for each leaf node.
[0096] Next, after matching, if it is determined that there is a storage key value range that matches the storage index key value, the leaf node corresponding to the matching storage key value range is used as the storage leaf node. Conversely, when there is no storage key value range that matches the storage index key value, the newly added leaf node is used as the storage leaf node.
[0097] As in Figure 4Taking the tree-like data management system shown in as an example, when the storage index key value is 7, the first leaf node (the storage key value range corresponding to the leaf node is 1 to 9) is used as the storage leaf node for storing the index key value and storage address of the data to be stored; when the storage index key value is 93, there is no matching storage key value range in the existing leaf nodes. At this time, a new leaf node will be added at the back as the storage leaf node for storing the index key value and storage address of the data to be stored.
[0098] Through the above steps 210 to 230, the matching results of the storage index key value and the storage key value range of multiple leaf nodes are used to allocate appropriate storage leaf nodes for the data to be stored, so that the leaf nodes can be sorted in order according to the numerical values of the index key values, so as to facilitate the convenience and efficiency of subsequent data queries.
[0099] In addition, after adding a leaf node, in order to ensure the balance of the tree data management system, the principle of "the absolute value of the depth difference between the left and right subtrees cannot exceed 1" is followed. Figure 7 , is a schematic diagram of a tree link structure node left-handed provided in an embodiment of the present application. Figure 7 As shown in the figure, when the newly added leaf node 3 and the previous two nodes (such as inner node 1 and the previous leaf node 2) are right-right type, the three nodes will be left-rotated to make 2 a new inner node, and then node 1 and node 3 will be used as leaf nodes associated with inner node 2, and the data will be adaptively processed. Figure 8 , is a schematic diagram of a right-handed tree link structure node provided in an embodiment of the present application. Figure 8 As shown in , when the newly added leaf node 5 and the next two nodes (such as the next leaf node 6 and the inner node 7) are of left-left type, a right rotation operation will be performed on the three nodes so that 6 becomes a new inner node. Then, node 5 and node 7 serve as leaf nodes associated with the inner node 6, and the data will be adaptively processed.
[0100] Step 300: Store the storage address and storage index key value of the data to be stored in the storage leaf node.
[0101] The following is a detailed description of step 300.
[0102] In some embodiments, after determining a suitable storage leaf node, it is necessary to further store the storage address and storage index key value of the data to be stored into a suitable storage location in the storage leaf node, as described below.
[0103] Reference Fig. 9 , storing the storage address and storage index key value of the data to be stored in the storage leaf node, including the following steps 310 to 320.
[0104] Step 310: Select a storage location with the smallest difference between the key value and the stored index key value and less than or equal to the stored index key value from multiple storage locations storing leaf node data as the preceding storage location, and select the storage location after the preceding storage location as the target storage location.
[0105] Step 320: Store the storage index key value and the address data of the data to be stored in the target storage location.
[0106] Steps 310 to 320 are described in detail below.
[0107] In some embodiments, after determining a suitable storage leaf node, a storage location with the smallest difference between the key value and the storage index key value and less than or equal to the storage index key value is selected from multiple storage locations storing the leaf node as the pre-order storage location, and then the next storage location after the pre-order storage location is used as the storage address for storing the data to be stored and the storage index key value. At this point, it can be understood that after the target storage location is selected, the index key value on the left side of the target storage location is smaller than the storage index key value of the data to be stored, and the index key value on the right side of the target storage location is larger than the storage index key value of the data to be stored.
[0108] It is understandable that, in general, since each leaf node in the tree data management system generally has a storage unit that is full of data (i.e., index key values and storage addresses of other stored data), such as Figure 4 All the storage locations in the leaf nodes shown in the figure are full of data. At this time, after determining the target storage location for storing the index key value, it is necessary to move the data originally in the target storage location and all the data behind it to the next grid. For example, if the storage index key value is 7, Figure 4 The second storage location in the first leaf node shown in is used as the target storage location, and then the data originally stored in the target storage location and all subsequent storage locations (i.e. Figure 4 The data corresponding to the index key value 8 shown in the figure and all the data behind it) are moved back one grid, thereby ensuring that after the data to be stored is stored, the index key values stored in multiple leaf nodes are still sorted in order from small to large according to the values.
[0109] Next, after determining the target storage location, it is necessary to further determine the address data of the data to be stored, so as to store the storage index key value and address data of the data to be stored in the target storage location, which will be further described below.
[0110] Reference Fig.10 , storing the storage index key value and the address data of the data to be stored in the target storage location, including the following steps 321 to 323.
[0111] Step 321: Use the address data corresponding to the preceding storage position as the preceding address data.
[0112] Step 322: Use the next address data of the previous address data as the storage address data of the data to be stored.
[0113] Step 323: Store the storage index key value and the storage address data in the target storage location.
[0114] Steps 321 to 323 are described in detail below.
[0115] In some embodiments, after determining the target storage location in the storage leaf node and the previous storage location of the target storage location (i.e., the pre-order storage location), in order to ensure that the address data corresponding to the index key value stored in the leaf node is also continuous, the address data corresponding to the index key value corresponding to the pre-order storage location is used as the pre-order address data, and in the storage device, the subsequent address data continuous with the pre-order address data is used as the storage address data of the data to be stored, and then the data to be stored is stored in the storage address data, and the storage index key value and storage address data of the data to be stored are stored in the target storage location of the storage leaf node.
[0116] It is understandable that, under normal circumstances, since there may be other data stored in the storage address data before the data to be stored in the storage device is stored in the storage address data (such as the storage data corresponding to the index key value to the right of the target storage location), it is necessary to move the storage data originally stored in the storage address data backward to the next storage address, and confirm whether the next storage address originally stored data. If so, it is necessary to gradually move the subsequent data backward until they are all stored in the appropriate location, and modify the data address corresponding to the index key value in the leaf node according to the changed data address of these data, so as to ensure that after the data to be stored is stored, the index key values and their corresponding data addresses stored in multiple leaf nodes are still sorted continuously.
[0117] Through the above steps 310 to 320, and steps 321 to 323, the numerical size of the stored index key value is used to select a suitable target storage location from the storage leaf node, and the suitable storage address data is determined according to the target storage location, thereby ensuring that after the data to be stored is stored, the index key values stored in multiple leaf nodes are still sorted in order from small to large according to the numerical value, and the corresponding data addresses are still sorted continuously, thereby effectively improving the convenience and efficiency when performing data query.
[0118] Step 400: Update the root node according to the first index key value and the corresponding first address of the stored leaf node.
[0119] The following is a detailed description of step 400.
[0120] In some embodiments, after the index key value and address data of the data to be stored are stored in the storage leaf node, it is necessary to further update the root node according to the first index key value and the corresponding first address of the storage leaf node, so that in the actual data query process, the index key value stored in the root node and its corresponding first address can be directly used for data query, so as to reduce the number of IO operations and improve the efficiency of data query. This will be further described in detail below.
[0121] Reference Fig.11 , updating the root node according to the first index key value and the corresponding first address of the stored leaf node, including the following steps 410 to 420.
[0122] Step 410: Update the internal node associated with the storage leaf node according to the first index key value and the corresponding first address of the storage leaf node.
[0123] Step 420: Update the root node according to the updated first index key value and the corresponding first address of the internal node.
[0124] Steps 410 to 420 are described in detail below.
[0125] In some embodiments, after the index key value and address data of the data to be stored are stored in the storage leaf node, combined with the following Figure 4 The tree-like data management system shown first uploads the first index key value of the storage leaf node to the associated inner node for storage; and further determines whether the storage leaf node is the first associated leaf node in the associated inner node. If so, it also uploads the first index key value of the storage leaf node and the first address of the corresponding address data to the inner node, and the inner node further uploads the first index key value of the storage leaf node and the first address of the corresponding address data to the root node for storage.
[0126] In addition, it can be understood that if the first index key value and the corresponding first address stored in other leaf nodes change during the process of storing new storage data (such as data to be stored), it is also necessary to update the corresponding leaf nodes and the content stored in the root node, so as to realize that the first index key value and the first address of the corresponding address data stored in the first leaf node associated with each inner node are stored at the root node (such as Figure 4 The index key value 1 shown in the figure corresponds to the first address D1, the index key value 28 corresponds to the first address D2, and so on).
[0127] Reference Fig.12 , is a flow chart of a data storage process provided by an embodiment of the present application. Fig.12As shown in , when storing batches of storage data (i.e., data tables), one record data A (i.e., the data to be stored in the above text) is selected at a time, and then Figure 4 The tree data structure (i.e., tree data management system) shown in the figure determines the storage leaf node corresponding to the record data A and the storage position in the storage leaf node, and stores the index key value and address data of the record data A at the storage position, and then further performs corresponding rotation operations on the tree data structure according to the balance principle that "the absolute value of the depth difference between the left and right subtrees cannot exceed 1" until all the record data in the data table are stored. After that, the index key value and the first address of the address data of the first storage unit in each leaf node are determined, and then each leaf node is further checked to see whether it is the first leaf node associated with the parent node layer (i.e., the inner node). If so, the index key value and the first address of the address data of the first storage unit in the leaf node are uploaded to the root node for storage.
[0128] Based on the tree-like data management system and the data storage method of the tree-like data management system described above, the data query method of the tree-like data management system provided by the present application will be further described below. Fig.13 , which is an optional flow chart of a data query method of a tree-like data management system provided in an embodiment of the present application, Fig.13 The method may include but is not limited to steps 500 to 800. It can also be understood that this embodiment Fig.13 The order of step 500 to step 800 is not specifically limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs.
[0129] Step 500: Obtain the query index key value of the data to be queried.
[0130] Step 600: Select the smallest key value query interval from the root node based on the query index key value.
[0131] Step 700: Obtain a first address and a second address corresponding to a first key value and a second key value respectively.
[0132] Step 800: Query and locate the data to be queried within the address data interval formed by the first address and the second address.
[0133] Steps 500 to 800 are described in detail below.
[0134] In some embodiments, after the data storage method of the tree-like data management system described above, Figure 4In the tree-like data management system shown in , the first index key value and the corresponding first address stored in the first associated leaf node of each inner node stored in the root node are determined. Based on this, after responding to the query request of the data to be queried, the query index key value of the data to be queried will be first determined, and then the minimum key value query interval will be selected from the multiple index key values stored in the root node based on the query index key value. How to select the minimum key value query interval will be further described below.
[0135] Reference Fig.14 , based on the query index key value, selecting the smallest key value query interval from the root node, including the following steps 610 to 620.
[0136] Step 610: Select a key value from among multiple index key values that has the smallest difference with the query index key value and is less than or equal to the query index key value as the first key value.
[0137] Step 620: Select the next index key value of the first key value as the second key value.
[0138] Steps 610 to 620 are described in detail below.
[0139] In some embodiments, a key value having the smallest difference with the query index key value and being less than or equal to the query index key value is selected from the multiple index key values stored in the root node as the first key value, and the next index key value of the first key value is selected from the multiple index key values as the second key value; in the example Figure 4 In the tree data management system shown, when the query index key value is 20, the first key value is 1 and the second key value is 28; when the query index key value is 29, the corresponding first key value is 28 and the second key value is 66. Then the key value interval composed of the first key value and the second key value is the smallest key value query interval.
[0140] In addition, since the first key value determined based on the query index key value may be the last index key value among multiple index key values of the root node, the second key value is a preset default value (such as the system default maximum value, etc.).
[0141] Next, the first address corresponding to the first key value is determined from the data stored in the root node as the first first address, and the first address corresponding to the second key value is determined as the second first address, and then the first address data corresponding to the first first address and the second address data corresponding to the second first address are determined, and then the data to be queried is searched and located within the address data interval formed by the first first address and the second first address.
[0142] Reference Fig.15 , is a flow chart of a data query provided by an embodiment of the present application. Fig.15As shown in , through the technical solution of the present application, after the user initiates data retrieval, the system locates the storage unit specified in the root directory of the index storage structure according to the index key value corresponding to record A, and obtains the data D1 storing the first address of the leaf node data in the storage unit. In addition, according to the index key value corresponding to record A, the system locates the next storage unit of the storage unit specified in the root directory of the index storage structure, and obtains the data D2 storing the first address of the leaf node data in the storage unit. The target data can be retrieved in the address range of D1 and D2.
[0143] Although in Figure 4 The root node in the tree-like data management system shown in FIG loses a small portion of storage space to store the data first address of the leaf node (for example, Figure 4 The root node shown is relative to Figure 1 In the B+ tree solution, the number of storage units that can be stored in the root node is reduced from 1000 to 900, and the total number of records that can be stored is increased from 10,000,000 to 9,000,000), which is equivalent to losing 1 / 10 of the storage space, but reducing the number of IO operations by 1 (the time consumed by IO operations accounts for a large proportion of the entire data retrieval, from Figure 1 From the B+ tree shown in the figure, it can be understood that the time for the entire data retrieval is approximately equal to the time consumed by three IO operations), that is, after using the present application solution, the time for the user to initiate data retrieval is reduced by one IO operation, that is, the query time is reduced by one third, thereby greatly improving the query efficiency of data query during the data query process.
[0144] Through the solution provided by this application, with the support of 5G technology, the interaction between the cloud and smart device terminals of today's smart home system is very frequent: data embedding, real-time reporting of device status, heartbeat detection, etc., make the database generate a large amount of data every day. When users execute query requests, they need to filter out target data from massive data. The beneficial effect of the solution of the present invention is that through the proposal of new ideas, the idea of exchanging space for time, and by consuming a small part of storage space, the system has a great improvement in data processing performance. For example, in the smart home system, after the user opens the smart home APP, the user's basic information and device basic information are pulled on the homepage. Assuming that the cloud responds It takes 1 second to access the database in response to the user's request to obtain the final data, and the request and return network transmission consumes a total of 0.1 seconds. The user waits for 1.1 seconds for the entire process of pulling the user's basic information and the basic device information on the homepage. When the new solution of the present invention is used, the time consumed for accessing the database after responding to the user's request on the cloud can be reduced by 1 / 3. Therefore, it only takes about 0.66 seconds to wait for the database to obtain the final data after the cloud responds to the user's request. In addition, the request and return network transmission consumes a total of 0.1 seconds. The new solution only takes 0.76 seconds to wait for the entire process of pulling the user's basic information and the basic device information on the user's homepage.
[0145] Therefore, by using the data storage method and data query method provided by the embodiments of the present application, in a scenario of high concurrent data access, when a user initiates a range query, the target data can be obtained by calculating the boundary value of the query range; and when a user initiates an equal value query, the target data can be obtained faster because the number of times the system executes IO is reduced; and when adding, deleting, and modifying data in a data table, the execution efficiency is higher because the time spent locating the target address of the data is shorter; in addition, the query time of the database is reduced, the database performance can be improved, and a larger access concurrency can be supported.
[0146] The present application also provides a data query device for a tree-like data management system, which can implement the data query method for the tree-like data management system. Fig.16 , the device 1600 comprises:
[0147] The first key value acquisition module 1610 is used to obtain the query index key value of the data to be queried;
[0148] An interval selection module 1620 is used to select a minimum key value query interval from a root node based on a query index key value, where the key value query interval includes a first key value and a second key value, when the first key value is the last index key value in the root node, the second key value is a preset default value, and the index key values in the root node data are sorted from small to large;
[0149] The address acquisition module 1630 is used to acquire a first address and a second address corresponding to the first key value and the second key value respectively;
[0150] The query module 1640 is used to query and locate the data to be queried within the address data interval formed by the first address and the second address.
[0151] In some embodiments, the interval selection module 1620 is further used to:
[0152] Selecting a key value with the smallest difference from the query index key value and less than or equal to the query index key value from the multiple index key values as the first key value;
[0153] Select the next index key value of the first key value as the second key value.
[0154] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, the specific implementation method of the data query device of the tree-like data management system is basically the same as the specific implementation method of the data query method of the above-mentioned tree-like data management system, and will not be repeated here.
[0155] The present application also provides a data storage device of a tree-like data management system, which can implement the data storage method of the tree-like data management system. Fig.17 , the device 1700 comprises:
[0156] The second key value acquisition module 1710 is used to obtain the storage index key value of the data to be stored;
[0157] A leaf node determination module 1720, configured to determine a storage leaf node based on a storage index key value and a plurality of leaf nodes;
[0158] The storage module 1730 is used to store the storage address and storage index key value of the data to be stored in the storage leaf node;
[0159] The updating module 1740 is used to update the root node according to the first index key value and the corresponding first address of the stored leaf node.
[0160] In some embodiments, the leaf node determination module 1720 is further configured to:
[0161] Get the storage key value range of multiple leaf nodes;
[0162] When there is a storage key value range that matches the storage index key value, the leaf node corresponding to the matching storage key value range is used as the storage leaf node;
[0163] When there is no storage key value range that matches the storage index key value, the newly added leaf node is used as the storage leaf node.
[0164] In some embodiments, the storage module 1730 is further configured to:
[0165] Select a storage location whose key value has the smallest difference with the storage index key value and is less than or equal to the query index key value from multiple storage locations storing leaf node data as the pre-order storage location, and select the storage location after the pre-order storage location as the target storage location;
[0166] The storage index key value and the address data of the data to be stored are stored in the target storage location.
[0167] In some embodiments, the storage module 1730 is further configured to:
[0168] Using the address data corresponding to the preceding storage position as the preceding address data;
[0169] Using the next address data of the preceding address data as the storage address data of the data to be stored;
[0170] The storage index key value and storage address data are stored in the target storage location.
[0171] In some embodiments, the update module 1740 is further configured to:
[0172] Update the internal node associated with the storage leaf node according to the first index key value and the corresponding first address of the storage leaf node;
[0173] Update the root node according to the updated first index key value of the inner node and the corresponding first address.
[0174] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, the specific implementation of the data storage device of the tree-like data management system is basically consistent with the specific implementation of the data storage method of the above-mentioned tree-like data management system, and will not be repeated here.
[0175] The present application also provides an electronic device, including:
[0176] at least one memory;
[0177] at least one processor;
[0178] at least one program;
[0179] The program is stored in the memory, and the processor executes the at least one program to implement the data query method of the tree data management system implemented in the present application. The electronic device can be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a car computer, etc.
[0180] See also Fig.18 , Fig.18 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0181] The processor 1801 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0182] The memory 1802 can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device or RAM (Random Access Memory). The memory 1802 can store operating systems and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1802, and the processor 1801 calls and executes the data query method or data storage method of the tree-like data management system of the embodiment of this application;
[0183] Input / output interface 1803, used to implement information input and output;
[0184] The communication interface 1804 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0185] A bus 1805 that transmits information between the various components of the device (e.g., the processor 1801, the memory 1802, the input / output interface 1803, and the communication interface 1804);
[0186] The processor 1801 , the memory 1802 , the input / output interface 1803 and the communication interface 1804 are connected to each other in communication within the device via the bus 1805 .
[0187] An embodiment of the present application further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the data query method or data storage method of the above-mentioned tree-like data management system is implemented.
[0188] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0189] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0190] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0191] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0192] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0193] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0194] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0195] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0196] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0197] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0198] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0199] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A data query method for a tree-like data management system, characterized in that: The tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and the root node stores the first index key value of at least one leaf node and the first address of the corresponding data address, and the method includes: Get the query index key value of the data to be queried; Selecting a minimum key value query interval from the root node based on the query index key value, the key value query interval includes a first key value and a second key value, when the first key value is the last index key value in the root node, the second key value is a preset default value, and the index key values in the root node data are sorted from small to large; Obtain a first address and a second address corresponding to the first key value and the second key value respectively; The data to be queried is searched and located within the address data interval formed by the first first address and the second first address.
2. The data query method of the tree-like data management system according to claim 1, characterized in that: The selecting a minimum key value query interval from the root node based on the query index key value includes: Selecting a key value having the smallest difference with the query index key value and being less than or equal to the query index key value from the multiple index key values as the first key value; The next index key value of the first key value is selected as the second key value.
3. A data storage method for a tree-like data management system, characterized in that: The tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and the root node stores the first index key value of at least one leaf node and the first address of the corresponding data address, and the method includes: Get the storage index key value of the data to be stored; Determine a storage leaf node based on the storage index key value and the plurality of leaf nodes; Storing the storage address of the data to be stored and the storage index key value in the storage leaf node; The root node is updated according to the first index key value and the corresponding first address of the storage leaf node.
4. The data storage method of the tree-like data management system according to claim 3, characterized in that: The step of determining a storage leaf node based on the storage index key value and the plurality of leaf nodes comprises: Obtain storage key value ranges of multiple leaf nodes; When there is a storage key value range that matches the storage index key value, taking the leaf node corresponding to the matching storage key value range as the storage leaf node; When there is no storage key value range that matches the storage index key value, the newly added leaf node is used as the storage leaf node.
5. The data storage method of the tree-like data management system according to claim 3, characterized in that: The storing the storage address of the data to be stored and the storage index key value into the storage leaf node includes: Select a storage location whose key value has the smallest difference with the storage index key value and is less than or equal to the storage index key value from the multiple storage locations storing the leaf node data as the preceding storage location, and select the storage location after the preceding storage location as the target storage location; The storage index key value and the address data of the data to be stored are stored in the target storage location.
6. The data storage method of the tree-like data management system according to claim 5, characterized in that: The storing the storage index key value and the address data of the data to be stored in the target storage location includes: Using the address data corresponding to the preceding storage position as preceding address data; Using the subsequent address data of the preceding address data as the storage address data of the data to be stored; The storage index key value and the storage address data are stored in the target storage location.
7. The data storage method of the tree-like data management system according to claim 3, characterized in that: The tree-like data management system further includes at least one inner node, wherein at least one index key value and a data address corresponding to the index key value are stored in the inner node, the root node is associated with at least one inner node, and the inner node is associated with at least one leaf node data, and the updating of the root node according to the first index key value and the corresponding first address of the stored leaf node includes: Update the inner node associated with the storage leaf node according to the first index key value of the storage leaf node and the corresponding first address; The root node is updated according to the updated first index key value of the internal node and the corresponding first address.
8. A data query device for a tree-like data management system, characterized in that: The tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and the root node stores the first index key value of each leaf node and the first address of the corresponding data address, wherein the device includes: A first key value acquisition module is used to obtain a query index key value of the data to be queried; An interval selection module, configured to select a minimum key value query interval from the root node based on the query index key value, wherein the key value query interval includes a first key value and a second key value, and when the first key value is the last index key value in the root node, the second key value is a preset default value, and the index key values in the root node data are sorted from small to large; An address acquisition module, used to acquire a first address and a second address corresponding to the first key value and the second key value respectively; A query module is used to query and locate the data to be queried within the address data interval formed by the first first address and the second first address.
9. A data storage device for a tree-like data management system, characterized in that: The tree-like data management system includes a root node and at least one leaf node, wherein the leaf node stores at least one index key value and a data address corresponding to the index key value, and the root node stores the first index key value of each leaf node and the first address of the corresponding data address, wherein the device includes: A second key value acquisition module is used to obtain the storage index key value of the data to be stored; A leaf node determination module, used to determine a storage leaf node based on the storage index key value and the plurality of leaf nodes; A storage module, used for storing the storage address of the data to be stored and the storage index key value into the storage leaf node; An update module is used to update the root node according to the first index key value and the corresponding first address of the storage leaf node.
10. An electronic device, characterized in that: It comprises a memory and a processor, the memory stores a computer program, and the processor implements the data query method of the tree data management system described in any one of claims 1 to 2, or implements the data storage method of the tree data management system described in any one of claims 3 to 7 when executing the computer program.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the data query method of the tree-like data management system according to any one of claims 1 to 2, or implements the data storage method of the tree-like data management system according to any one of claims 3 to 7.