Data reading method and related apparatus

By scanning the self-balancing tree on the server side to obtain sharding boundary information, the problem of low data reading efficiency in existing technologies is solved, enabling fast and parallel data sharding reading, thus improving user experience and efficiency.

WO2026066210A1PCT designated stage Publication Date: 2026-04-02HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

In existing technologies, when using the offset+limit partitioning method, the fragment quality is relatively long, the actual amount of data to be read is large, resulting in low data reading efficiency.

Method used

By scanning the self-balancing tree of the target data on the server side, the sharding boundary information is obtained. The balance marked in the self-balancing tree is used to quickly determine the sharding boundary of the target data, and P shards are read in parallel, reducing the consumption of resources.

Benefits of technology

It improves data reading efficiency, meets users' personalized needs, reduces development costs, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025099049_02042026_PF_FP_ABST
    Figure CN2025099049_02042026_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data storage, and disclosed are a data reading method and a related apparatus. The method comprises: a server receives from a client a first processing request for instructing to acquire shard boundary information of target data, and returns the shard boundary information of the target data to the client in response to the first processing request and by scanning a target self-balancing tree corresponding to the target data; and the server receives from the client a second processing request for instructing to acquire P shards of the target data, and returns the P shards of the target data to the client in the form of shards in response to the second processing request. The shard boundary information of the target data comprises values of identifiers of the target data stored in a root node or child nodes of a root node of the target self-balancing tree. Values of identifiers of target data stored in a root node or child nodes of a root node are used as shard boundary information, thereby accelerating determination of the shard boundary information, and improving the efficiency of performing data reading on P shards of the target data.
Need to check novelty before this filing date? Find Prior Art

Description

Data reading method and related apparatus

[0001] The present application claims priority from the Chinese patent application No. 202411388120.3 filed on September 30, 2024, and entitled "A data reading method and related apparatus", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0002] The present application relates to the field of data storage, and in particular to a data reading method and related apparatus. BACKGROUND

[0003] Data management refers to the process of organizing and maintaining data, which often includes data query, synchronization, etc. Taking data query as an example, when querying a large amount of data from a data storage system, in order to improve the query efficiency of the data, the data is usually divided into multiple shards, and multiple threads are used to query the multiple shards in parallel. In the prior art, the data is divided into multiple shards and the data shards are queried by setting the number of rows to be skipped (indicated by the "offset" parameter) and the number of rows to be read (indicated by the "limit" parameter) in the structured query language (SQL) statement. However, using the "offset+limit" division method also requires reading the data in the rows before the offset position, and when dividing the data into shards, the amount of data actually read is large and the reading efficiency is low. SUMMARY

[0004] The present application provides a data reading method and related apparatus to solve the problem of low data reading efficiency caused by the increase in the amount of data actually read due to the long quality of shards obtained when using the offset+limit division method.

[0005] In a first aspect, the present application provides a data reading method, which can be applied to a computer system or a computing device supporting the computer system to implement the data reading method. For example, the computer system can be a data management system, and the computing device can be a storage device or a server. In one possible example, the data management system stores the identifiers of data in the form of a self-balancing tree, and includes a server and a client. The data reading method provided by the present embodiment is executed by the server, and includes: receiving, by the server, a first processing request from the client for indicating obtaining the shard boundary information of target data; in response to the first processing request, scanning, by the server, a target self-balancing tree corresponding to the target data, and returning, by the server, the shard boundary information of the target data to the client; and receiving, by the server, a second processing request from the client for indicating obtaining P shards of the target data, and in response to the second processing request, returning, by the server, the P shards of the target data to the client in the form of shards. The data includes target data, the self-balancing tree includes a target self-balancing tree, the shard boundary information of the target data includes the value of the identifier of the target data stored in the root node or the child node of the root node of the target self-balancing tree, the boundaries of the P shards of the target data are determined based on the shard boundary information of the target data, and P is a positive integer.

[0006] In the present application, the server scans the target self-balancing tree corresponding to the target data, and then takes the value of the identifier of the target data stored in the root node or the child node of the root node obtained by scanning as the shard boundary information, thereby accelerating the speed of determining the shard boundary information of the target data, and improving the efficiency of reading the P shards of the target data determined based on the shard boundary information of the target data. In addition, since the identifiers are stored in the form of a self-balancing tree, the values of the identifiers stored between the nodes in the self-balancing tree are balanced, that is, the values of the identifiers in the target data indicate that the sub-data of the target data is also balanced, and thus the server can further improve the efficiency of reading data when reading and returning the P shards of the target data in parallel.

[0007] In one possible case, the boundaries of the P shards include part or all of the values of the identifiers of the target data included in the shard boundary information.

[0008] In one possible case, the first processing request is a SQL statement.

[0009] In one possible case, the second processing request is a SQL statement.

[0010] In one possible case, the SQL statement includes a specified field, which is used to define the number of shards of the target data.

[0011] In a possible example, the specified field is a syntax field of the SQL statement.

[0012] In another possible example, the specified field is a comment field of the SQL statement.

[0013] In the present application, by taking the specified field as a comment field of the SQL statement, the SQL statement including the specified field can be directly parsed by the client and forwarded to the server by the client, thereby reducing the modification of the SQL parser of the client and reducing the development cost.

[0014] For example, the specified field can be SPLIT_CHUNK.

[0015] In a possible example, the specified field is used to define the number of shards required by the user in the target data.

[0016] In a possible case, the first processing request carries a shard value, which is used to indicate the number of shards of the target data. The number of shards indicated by the number of target data identifiers included in the shard boundary information of the target data is greater than or equal to the shard value.

[0017] In the present application, by defining the shard value for indicating the number of shards of the target data in the first processing request, the server returns the shard boundary information meeting the shard value requirement, which meets the individual needs of the user and improves the user experience.

[0018] In a possible example, if the number of shards indicated by the number of all target data identifiers stored in the root node or the child nodes of the root node of the target self-balancing tree is greater than the shard value, the server takes part of the values of the aforementioned target data identifiers as the shard boundary information. The number of shards indicated by the number of target data identifiers included in the aforementioned shard boundary information is equal to the shard value.

[0019] In another possible example, if the number of shards indicated by the number of all target data identifiers stored in the root node or the child nodes of the root node of the target self-balancing tree is equal to the shard value, the server takes all the values of the aforementioned target data identifiers as the shard boundary information.

[0020] In yet another possible example, if the number of shards indicated by the number of all target data identifiers stored in the root node or the child nodes of the root node of the target self-balancing tree is greater than the shard value, the server takes all the values of the aforementioned target data identifiers as the shard boundary information.

[0021] In a possible implementation, the server returns the shard boundary information of the target data to the client by scanning the target self-balancing tree corresponding to the target data, including: the server acquires the identifiers of the target data stored in the root node of the target self-balancing tree. If the number of the identifiers of the target data stored in the root node indicates a number of shards that is less than the number of shards of the target data, the server acquires the values of the identifiers of the target data stored in the child nodes of the root node, and returns the values of the identifiers of the target data stored in the child nodes of the root node to the client as the shard boundary information of the target data. The number of the identifiers of the target data stored in the child nodes of the root node indicates a number of shards that is greater than or equal to the number of shards of the target data. If the number of the identifiers of the target data stored in the root node indicates a number of shards that is greater than or equal to the number of shards of the target data, the server returns the values of the identifiers of the target data stored in the root node to the client as the shard boundary information of the target data.

[0022] In this application, the server scans the target self-balancing tree layer by layer by scanning the root node first and then scanning the child nodes of the root node, until the number of shards indicated by the identifiers of the target data stored in the root node or the child nodes of the root node is greater than or equal to the number of shards of the target data, which ensures that the nodes are accessed according to the hierarchical structure of the target self-balancing tree, and thus the order of the identifiers obtained by scanning is maintained, that is, the identifiers in the shard boundary information returned to the client are arranged in order, improving the user experience. In addition, the server scans the target self-balancing tree layer by layer, and stops scanning when a layer that meets the condition (the number of shards indicated by the identifiers of the target data stored in the root node or the child nodes of the root node is greater than or equal to the number of shards of the target data) is scanned, avoiding global scanning of the target self-balancing tree, thereby reducing the consumption of resources of the server.

[0023] In a possible case, the child nodes of the root node can be the first layer child nodes (first child nodes), the second layer child nodes (second child nodes), and so on, until the number of shards indicated by the identifiers of the target data stored in the Nth layer child nodes (Nth child nodes) is greater than or equal to the number of shards of the target data, and the Nth child nodes are the child nodes of the root node. In other words, the server scans the target self-balancing tree layer by layer, and stops scanning when the Nth child nodes are scanned.

[0024] In a possible case, the identifier of the data is the primary key or index of the data.

[0025] In a possible case, the self-balancing tree is any one of the following: a B+ tree, a B- tree, a B* tree, or a self-balancing binary tree.

[0026] In a possible implementation, the data reading method further includes: the client sends a first processing request to the server, and receives the shard boundary information of the target data returned by the server. The client determines the boundaries of the P shards of the target data according to the shard boundary information of the target data, and then sends a second processing request to the server, and receives the P shards of the target data returned by the server.

[0027] In the present application, through the interaction between the client and the server, the client obtains the shard boundary information of the target data, and then sends a second processing request to the server according to the boundaries of the P shards determined by the shard boundary information of the target data. The client obtains the P shards of the target data returned by the server, thereby realizing that the client quickly obtains the P shards of the target data according to the shard boundary information of the target data returned by the server, and improving the efficiency of reading data.

[0028] In a possible case, the client displays the P shards of the target data on a front end connected to the client, for example, the client displays the P shards in pages on the front end, and each page displays the sub-data corresponding to one shard, thereby realizing data query.

[0029] In another possible case, the client exports the P shards of the target data, for example, exports in the form of excel, and each sub-table in an excel file includes the sub-data corresponding to one shard, thereby realizing data export.

[0030] In yet another possible case, the client sends the P shards of the target data to other servers, thereby realizing data copying, data migration, and data synchronization.

[0031] In a second aspect, the present application provides a data reading apparatus. The data reading apparatus is applied to a computer system or a computing device supporting the computer system to implement a data reading method, for example, the computer system can be a data management system, and the computing device is a storage device or a server. The data reading apparatus includes various modules for executing the data reading method in the first aspect or any possible implementation manner of the first aspect. The data reading apparatus includes:

[0032] The first receiving module is configured to receive a first processing request from a client, wherein the first processing request is used to indicate to obtain shard boundary information of target data, and the data includes the target data.

[0033] The scanning module is configured to scan the target self-balancing tree corresponding to the target data in response to the first processing request, and return the shard boundary information of the target data to the client. The server stores the data identifier in the form of a self-balancing tree, and the self-balancing tree includes the target self-balancing tree. The shard boundary information of the target data includes the value of the target data identifier stored in the root node or the child node of the root node of the target self-balancing tree.

[0034] The second receiving module is configured to receive a second processing request from the client. The second processing request is used to indicate that P shards of the target data are to be obtained, and the boundaries of the P shards of the target data are determined based on the shard boundary information of the target data. P is a positive integer.

[0035] The returning module is configured to return the P shards of the target data to the client in the form of shards in response to the second processing request.

[0036] In a possible scenario, the first processing request is a structured query language (SQL) statement.

[0037] In a possible scenario, the SQL statement includes a specified field, the specified field is used to define the number of shards of the target data, and the specified field is a syntax field of the SQL statement or a comment field of the SQL statement.

[0038] In a possible scenario, the first processing request carries a shard value, the shard value is used to indicate the number of shards of the target data, and the number of shards indicated by the number of target data identifiers included in the shard boundary information of the target data is greater than or equal to the shard value.

[0039] In a possible implementation, the scanning module is specifically configured to obtain the target data identifiers stored in the root node of the target self-balancing tree. If the number of shards indicated by the number of target data identifiers stored in the root node is less than the number of shards of the target data, the scanning module is configured to obtain the values of the target data identifiers stored in the child node of the root node, and return the values of the target data identifiers stored in the child node of the root node to the client as the shard boundary information of the target data. The number of target data identifiers stored in the child node of the root node indicates a number of shards that is greater than or equal to the number of shards of the target data. If the number of shards indicated by the number of target data identifiers stored in the root node is greater than or equal to the number of shards of the target data, the scanning module is configured to return the values of the target data identifiers stored in the root node to the client as the shard boundary information of the target data.

[0040] In a possible scenario, the data identifier is a primary key or an index of the data.

[0041] In a possible scenario, the self-balancing tree is any one of the following: a B+ tree, a B- tree, a B* tree, or a self-balancing binary tree.

[0042] In a possible implementation, the apparatus further includes a transceiver. The transceiver is configured to send the first processing request to the server and receive the shard boundary information of the target data returned by the server; determine the boundaries of the P shards of the target data according to the shard boundary information of the target data; and send the second processing request to the server and receive the P shards of the target data returned by the server.

[0043] For more detailed implementation of the data reading apparatus, refer to the description of the first aspect or any implementation of the first aspect, and the content of the following specific embodiments, which are not described here.

[0044] In a third aspect, the present application provides a data management system. The data management system includes devices for executing the data reading method in the first aspect or any optional implementation of the first aspect. The data management system stores the identifier of the data, and the storage form of the identifier of the data in the data management system is a self-balancing tree. The data management system includes a server and a client.

[0045] The server is configured to receive the first processing request from the client, where the first processing request is used to indicate to obtain the shard boundary information of the target data, and the data includes the target data.

[0046] The server is configured to respond to the first processing request by scanning the target self-balancing tree corresponding to the target data, and return the shard boundary information of the target data to the client, where the self-balancing tree includes the target self-balancing tree, and the shard boundary information of the target data includes the value of the identifier of the target data stored in the root node or the child node of the root node of the target self-balancing tree.

[0047] The server is configured to receive the second processing request from the client, where the second processing request is used to indicate to obtain the P shards of the target data, and the boundaries of the P shards of the target data are determined based on the shard boundary information of the target data, and P is a positive integer.

[0048] The server is configured to respond to the second processing request by returning the P shards of the target data to the client in the form of shards.

[0049] In a possible implementation, the client is configured to send the first processing request to the server and receive the shard boundary information of the target data returned by the server. The client is configured to determine the boundaries of the P shards of the target data according to the shard boundary information of the target data, and then send the second processing request to the server and receive the P shards of the target data returned by the server.

[0050] For more details of the data management system, refer to the description of the first aspect or any of the implementation manners of the first aspect, and the content of the following specific embodiments, which will not be repeated here.

[0051] In a fourth aspect, the present application provides a computing device. The computing device comprises a memory and a processor, the memory is configured to store instructions; the processor executes the instructions to implement the method in the first aspect or any of the possible implementation manners of the first aspect. The computing device shown in the present aspect can be the server in the first aspect.

[0052] In a fifth aspect, the present application provides a computer readable storage medium. The storage medium stores a computer program or instructions, when the computer program or instructions are executed by a computing device, the method in the first aspect or any of the optional implementation manners of the first aspect is implemented.

[0053] In a sixth aspect, the present application provides a computer program product. The computer program product comprises a computer program or instructions, when the computer program or instructions are executed by a computing device, the method in the first aspect or any of the optional implementation manners of the first aspect is implemented.

[0054] The beneficial effects of the second aspect to the sixth aspect above can refer to the description of the first aspect or any of the implementation manners of the first aspect, which will not be repeated here. On the basis of the implementation manners of the above aspects provided by the present application, further combinations can be made to provide more implementation manners. BRIEF DESCRIPTION OF DRAWINGS

[0055] Fig. 1 is a structural schematic diagram of a data management system provided by the present application;

[0056] Fig. 2 is a schematic diagram of a scenario provided by the present application;

[0057] Fig. 3 is a flow schematic diagram of a data reading method provided by the present application;

[0058] Fig. 4 is a structural schematic diagram of a self-balancing tree provided by the present application;

[0059] Fig. 5 is a flow schematic diagram of a shard boundary information acquisition method provided by the present application;

[0060] Fig. 6 is a structural schematic diagram of a data reading device provided by the present application;

[0061] Fig. 7 is a structural schematic diagram of a data reading device provided by the present application;

[0062] Fig. 8 is a structural schematic diagram of a computing device provided by the present application;

[0063] Fig. 9 is a structural schematic diagram of a computing device cluster provided by the present application;

[0064] FIG. 10 is a schematic diagram of a connection between computing devices provided by the present application. DETAILED DESCRIPTION

[0065] To solve the problem of low efficiency of reading data from a data storage system, the present application provides a data reading method. The data reading method is applied to a data management system, the data management system stores an identifier of data, the identifier of data is stored in the form of a self-balancing tree in the data management system, and the data management system includes a server and a client. The data reading method includes: the server receives a first processing request from the client for indicating to obtain the shard boundary information of target data, and then responds to the first processing request by scanning a target self-balancing tree corresponding to the target data, and returns the shard boundary information of the target data to the client. In addition, the server receives a second processing request from the client for indicating to obtain P shards of the target data, and then responds to the second processing request by returning the P shards of the target data to the client in the form of shards. Wherein, the data includes the target data, the self-balancing tree includes the target self-balancing tree, the shard boundary information of the target data includes: the value of the identifier of the target data stored in the root node or the child node of the root node of the target self-balancing tree, and the boundary of the P shards of the target data is determined based on the shard boundary information of the target data, and P is a positive integer.

[0066] In the present application, the server scans the target self-balancing tree corresponding to the target data, and then takes the value of the identifier of the target data stored in the root node or the child node of the root node obtained by scanning as the shard boundary information, which accelerates the speed of determining the shard boundary information of the target data, and thus improves the efficiency of reading the P shards of the target data determined based on the shard boundary information of the target data. In addition, since the identifier is stored in the form of a self-balancing tree, the values of the identifiers stored between the nodes in the self-balancing tree are balanced, that is, the values of each group of identifiers (a group of identifiers corresponds to the boundary of a shard) in the target data also indicate that the sub-data of the target data is balanced, and thus when the server reads and returns the P shards of the target data in parallel, the efficiency of reading data can be further improved.

[0067] The terms used in the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. The technical terms related to the present application are introduced as follows.

[0068] B-Tree, a self-balancing search tree, the storage area corresponding to the B-Tree stores an ordered set of Keys. The B-Tree is composed of multiple index nodes, which can be divided into at least two layers (e.g., the B-Tree includes a root node of the first layer, a first child node of the second layer, and a second child node of the third layer), and each index node stores multiple Keys. When querying data in the B-Tree, based on a given Key, a binary search is performed layer by layer from the topmost index node of the B-Tree until the bottommost index node or an index node that meets the condition is queried. For the aforementioned condition that meets the condition, see the following description of the relationship between the number of identifications of target data and the number of shards of target data, which is not repeated here.

[0069] B+Tree, the difference between the B+Tree and the B-Tree is that in the B+Tree, all Keys are stored only in the bottommost index node, and the intermediate index nodes only store Keys for indexing.

[0070] B*Tree, the difference between the B*Tree and the B+Tree is that in the B*Tree, the index nodes at the same layer increase the pointers to other index nodes.

[0071] Self-balancing binary tree, a binary tree that automatically adjusts itself to maintain the balance of the tree after each insertion or deletion operation. The definition of balance is usually to ensure that the height of the tree remains at a logarithmic level, so that the time complexity of basic operations such as insertion, deletion, and lookup remains at the O(logn) level. Common self-balancing binary trees include AVL trees (adelson-velsky and landis trees), splay trees, and red-black trees.

[0072] Index node, a physical storage unit of data, a B+Tree and a B-Tree are composed of multiple index nodes, such as the root node, the first child node, the second child node, etc. described above. The index node is also called an index block or an index page, and its size is fixed, usually 8KB or 16KB.

[0073] The application scenarios of the above data reading method are described below with reference to the accompanying drawings. As shown in FIG. 1, FIG. 1 is a structural schematic diagram of a data management system provided by the present application. The data management system includes a client 110 and a server 120. In the framework shown in FIG. 1, a user accesses data through an application program. The computer running these application programs can be referred to as a "client" or a "host". The client 110 can be a physical machine or a virtual device. The physical machine includes but is not limited to a desktop computer, a server, a notebook computer, and a mobile device; and the virtual device includes but is not limited to a virtual machine (VM) and a container. The data management system can also be referred to as a data storage system.

[0074] In a possible embodiment, the data management system is a database system, and the client 110 and the server 120 are respectively a client and a server of the database system. With the application of cloud computing technology, the database system can further be a cloud database system created based on infrastructure on the cloud, where the server 120 is a cluster of computing devices in which a database instance is deployed, and the cluster of computing devices includes at least one computing device, each of which can be any one of a physical server, a virtual machine (VM), an elastic cloud server (ECS), or a container.

[0075] In a possible example, the client 110 accesses the server 120 through a network to access data, for example, the network can include a switch 130.

[0076] In another possible example, the client 110 can also communicate with the server 120 through a wired connection, for example, a universal serial bus (USB) or a peripheral component interconnect express (PCIe) bus, etc.

[0077] The server 120 shown in FIG. 1 can be a centralized storage system. The centralized storage system has the feature of having a unified entrance through which all data from external devices pass, and this entrance is an engine 121 of the centralized storage system. The engine 121 is the most core component in the centralized storage system, and many high-level functions of the storage system are implemented therein. In a possible example, the server 120 can include one or more storage devices, and each storage device can include the engine 121 and a hard disk frame 122 described below.

[0078] As shown in FIG. 1, the engine 121 can have one or more controllers. FIG. 1 illustrates an example in which the engine 121 includes one controller. In one possible example, if the engine 121 has multiple controllers, any two controllers can have a mirror channel to implement a backup function for each other, so as to avoid a hardware failure leading to an unavailability of the entire server 120. It should be understood that if the engine 121 includes multiple controllers, the engine 121 can also be referred to as an array controller of the server 120.

[0079] The engine 121 also includes a front-end interface 1211 and a back-end interface 1214. The front-end interface 1211 is configured to communicate with the client 110, so as to provide a data access service for the client 110. The back-end interface 1214 is configured to communicate with the hard disk, so as to expand the capacity of the server 120. Through the back-end interface 1214, the engine 121 can be connected to more hard disks, so as to form a very large storage resource pool.

[0080] In hardware, as shown in FIG. 1, the controller includes at least a processor 1212 and a memory 1213. The processor 1212 is a central processing unit (CPU) configured to process a processing request from outside the server 120 (the client 110 or another server) and process a processing request generated inside the server 120. For example, when the processor 1212 receives a first processing request or a second processing request sent by the client 110 through the front-end interface 1211, the processor 1212 temporarily stores data corresponding to the second processing request in the memory 1213. The processor 1212 reads data from at least one of the mechanical hard disk 1221, the mechanical hard disk 1222, the solid state drive (SSD) 1223, or another hard disk 1224 and temporarily stores the data in the memory 1213. When the total amount of data in the memory 1213 reaches a certain threshold, the processor 1212 sends the data stored in the memory 1213 to the client 110 through the front-end interface 1211.

[0081] The memory 1213 refers to an internal memory that exchanges data directly with the processor. It can read and write data at any time and has a very fast speed, and is used as a temporary data storage for the operating system or other programs running at the moment. The memory includes at least two types of memories, for example, the memory can be a random access memory or a read only memory (ROM). For example, the random access memory is a dynamic random access memory (DRAM) or a storage class memory (SCM). The DRAM is a semiconductor memory, which, like most random access memories (RAM), is a type of volatile memory device. However, the DRAM and the SCM are only exemplary in this embodiment, and the memory can also include other random access memories, such as static random access memories (SRAM) and the like. As for the read only memory, for example, it can be a programmable read only memory (PROM), an erasable programmable read only memory (EPROM), and the like.

[0082] In addition, the memory 1213 can also be a dual in-line memory module or a dual in-line memory module (DIMM), that is, a module composed of DRAM, and can also be an SSD. In practical applications, multiple memories 1213 and memories 1213 of different types can be configured in the controller. The number and type of the memory 1213 are not limited in this embodiment. In addition, the memory 1213 can be configured to have a power retention function. The power retention function refers to that when the system is powered off and then powered on again, the data stored in the memory 1213 will not be lost. The memory with the power retention function is called a non-volatile memory.

[0083] The memory 1213 stores software programs, and the processor 1212 runs the software programs in the memory 1213 to achieve the slicing boundary information of the obtained data, or reads the sub-data included in the slice.

[0084] As shown in FIG. 1, in the system, the engine 121 can not have a hard disk slot, and the hard disk needs to be placed in the hard disk frame 122, and the back-end interface 1214 communicates with the hard disk frame 122. The back-end interface 1214 exists in the engine 121 in the form of an adapter card, and two or more back-end interfaces 1214 can be used simultaneously on one engine 121 to connect multiple hard disk frames. Alternatively, the adapter card can also be integrated on the mainboard, at which time the adapter card can communicate with the processor 1212 through the PCIe bus.

[0085] It should be noted that only one engine 121 is shown in FIG. 1, but in actual application, two or more engines 121 can be included in the storage system, and redundancy or load balancing is performed between the multiple engines 121.

[0086] The hard disk frame 122 includes a control unit 1225 and several hard disks. The control unit 1225 can have various forms. In one case, the hard disk frame 122 belongs to a smart disk frame as shown in FIG. 1, and the control unit 1225 includes a CPU and a memory. The CPU is used to perform address conversion and read and write data operations. The memory is used to temporarily store data to be written to the hard disk or data read from the hard disk to be sent to the controller. In another case, the control unit 1225 is a programmable electronic component, such as a data processing unit (DPU). The DPU has the versatility and programmability of the CPU, but is more specialized and can efficiently operate on network packets, storage requests, or analysis requests. The DPU is distinguished from the CPU by a greater degree of parallelism (a large number of requests need to be processed). Optionally, the DPU here can also be replaced by a graphics processing unit (GPU), an embedded neural-network processing unit (NPU), etc. In general, the number of control units 1225 can be one, two, or more. The functions of the control unit 1225 can be offloaded to the network card 1226. In other words, in this implementation, the hard disk frame 122 does not have a control unit 1225 inside, but the network card 1226 is used to complete data read and write, data analysis (such as determining the data slice boundary information), and other computing functions. At this time, the network card 1226 is a smart network card. It can contain a CPU and a memory. The CPU is used to perform data analysis and read and write data operations. The memory is used to temporarily store data to be written to the hard disk or data read from the hard disk to be sent to the controller. It can also be a programmable electronic component, such as a DPU. There is no ownership relationship between the network card 1226 and the hard disks in the hard disk frame 122, and the network card 1226 can access any hard disk in the hard disk frame 122 (such as the mechanical hard disk 1221, the mechanical hard disk 1222, the solid state hard disk 1223, and other hard disks 1224 shown in FIG. 1), so it is relatively convenient to expand the hard disk when the storage space is insufficient.

[0087] According to the type of communication protocol between the engine 121 and the hard disk frame 122, the hard disk frame 122 can be a serially connected small computer system interface (SAS) hard disk frame, an NVMe (Non-Volatile Memory express) hard disk frame, and other types of hard disk frames. The SAS hard disk frame adopts the SAS3.0 protocol, and each frame supports 25 SAS hard disks. The engine 121 is connected with the hard disk frame 122 through a built-in SAS interface or a SAS interface module. The NVMe hard disk frame is more like a complete computer system, and the NVMe hard disk is inserted into the NVMe hard disk frame. The NVMe hard disk frame is connected with the engine 121 through an RDMA port.

[0088] In an optional implementation, the server 120 is a centralized storage system with disk control, and the server 120 does not have the hard disk frame 122 described above, and the engine 121 is used to manage a plurality of hard disks connected through hard disk slots. The function of the hard disk slot can be implemented by the back-end interface 1214.

[0089] In another optional implementation, the server 120 shown in FIG. 1 is a distributed storage system, which includes a computing device cluster and a storage device cluster. The computing device cluster includes one or more computing devices, and each computing device can communicate with each other. The computing device can be a physical computing device, such as a server, a desktop computer, or a controller of a storage array, etc. In hardware, the computing device can include a processor, a memory, and a network card, etc. The processor is a CPU, which is used to process a processing request from outside the computing device, or a processing request generated inside the computing device. For example, when the processor receives a query data request sent by a user, it reads data from a storage device and temporarily saves the data in the memory. When the total amount of data in the memory reaches a certain threshold, the processor sends the data stored in the memory to the device on the user side. In addition, the processor is also used for data processing or calculation, such as metadata management, data shard boundary information acquisition, data compression, decompression, virtual storage space, and address conversion, etc. In an example, any computing device can access any storage device in the storage device cluster through a network. The storage device cluster includes a plurality of storage devices. A storage device includes one or more controllers, a network card, and a plurality of hard disks, and the network card is used for communication with the computing device.

[0090] For example, the server 120 stores the identifier of the data, and the storage form of the data identifier in the server 120 is a self-balancing tree.

[0091] In a possible example, the self-balancing tree can be any one of the following: a B+ tree, a B-tree, a B* tree, and a self-balancing binary tree.

[0092] For example, the identifier of the data can be an index.

[0093] In the case where the identifier of the data is an index, the index node at the bottom layer of the self-balancing tree can store the identifier of the data, such as a primary key, a storage address of the data, a position of the data in a table, and the like.

[0094] For another example, the identifier of the data can also be a primary key.

[0095] In the case where the identifier of the data is a primary key, the index node at the bottom layer of the self-balancing tree can directly store the data.

[0096] The following will be exemplarily described in the scenario where the server 120 performs data reading. As shown in FIG. 2, FIG. 2 is a schematic diagram of a scenario provided in the present application.

[0097] In a first possible scenario, as shown in a of FIG. 2, the server 120 performs data query or data export. For example, the server 120 receives a processing request sent by the client 110, and performs sharded query or sharded export on the data.

[0098] In a second possible scenario, as shown in b of FIG. 2, the server 120 backs up / copies the data stored therein. For example, the server 120 responds to a processing request sent by the client 110, and returns P shards to the client 110 in a sharded form, so that the client 110 backs up / copies the P shards to other servers. Alternatively, the server 120 backs up / copies the data shards to other servers through the client 110 at a regular time.

[0099] In a possible case, the server 120 backs up / copies the data shards to other servers, so that the other servers can still provide storage services when the server 120 fails.

[0100] In another possible case, the server 120 is configured to provide transactional services, and other servers are configured to provide analytical services, so that the other servers can provide analytical services according to the data after backing up the data shards in the server 120 to other data management services.

[0101] In a third possible scenario, as shown in c of FIG. 2, the service end 120 migrates or synchronizes the data stored by the service end 120. For example, the service end 120 receives a processing request initiated by the client 110 (for example, the client 110 is deployed with a data management tool (such as a data migration tool / data synchronization tool)), and then the service end 120 returns P shards to the client 110 in response to the processing request, so that the client 110 sends the P shards to other service ends, thereby realizing migration or synchronization of the data in the service end 120 to other service ends.

[0102] In a possible case, the service end 120 and the other service ends belong to different storage service providers, and the data migration or synchronization across service providers can be realized through the data management tool (data migration tool / data synchronization tool) deployed on the client 110.

[0103] The following describes a data reading method suitable for the scenario shown in FIG. 2. As shown in FIG. 3, FIG. 3 is a flowchart of a data reading method provided by the present application. The method shown in FIG. 3 can be applied to the data management system shown in FIG. 1, and the content shown in the embodiment is described by taking the service end 120 as an example. The service end 120 stores an identifier of data, and the identifier of the data is stored in the service end 120 in the form of a self-balancing tree. Please refer to FIG. 3, the data reading method provided by the present application includes the following steps S310-S340.

[0104] S310, the service end 120 receives a first processing request from the client 110.

[0105] The first processing request is used to indicate to obtain the shard boundary information of target data. The target data is the data in the service end 120, and specifically, the data stored in the service end 120 includes one or more shards, and a shard includes a group of sub-data in the target data.

[0106] In a possible case, the first processing request is a SQL statement a. The SQL statement a is used to indicate to obtain the shard boundary information of the target data in the service end 120.

[0107] In a possible example, the target data is a target data table in a plurality of data tables stored in the service end 120.

[0108] In a possible example, the SQL statement a includes a specified field, which is used to define the number of shards of the target data, that is, the number of shards required by the user for the target data.

[0109] For example, the specified field is “SPLIT_CHUNK”.

[0110] In a possible example, the SQL statement a further includes a split value, which is used to indicate the number of splits of the target data.

[0111] For example, the split value is chunk_num.

[0112] For the SQL statement a, two possible examples are shown as follows.

[0113] Example 1: The specified field is a syntax field of the SQL statement a, and the specified field and the split value are located in the body part of the SQL statement. For example, the SQL statement a is "SELECT col0, col1, …, colk FROM table WHERE SPLIT_CHUNK(chunk_num)", where "col0, col1, …, colk" is used to indicate the identity of the target data. When the identity of the data is the primary key of the data, "col0, col1, …, colk" is the column identity of the primary key.

[0114] The SQL statement a of the present mode needs to be supported by the client 110 and the server 120, that is, the SQL statement parser deployed in the server 120 can recognize the newly added syntax field "SPLIT_CHUNK(chunk_num)", and the client 110 supports sending the SQL statement including the syntax field "SPLIT_CHUNK(chunk_num)" to the server 120.

[0115] Example 2: The specified field is a comment field of the SQL statement a, and the specified field and the split value are located in the comment (hint) part of the SQL statement, such as "SELECT col0, col1, …, colk FROM table / *SPLIT_CHUNK(chunk_num)* / . The " / *……* / " is the comment part in the SQL statement.

[0116] The SQL statement a of the present mode needs to be supported by the server 120, and the client can not be modified and supports the existing SQL syntax. After the client 110 sends the SQL statement carrying the above-mentioned comment field to the server 120, the server 120 can recognize the comment field and parse the meaning thereof.

[0117] In some other possible embodiments, the first processing request can also be in a form other than the SQL statement, but also carries the split value used to indicate the number of splits of the target data, which is not limited in the present application.

[0118] In a possible implementation, the server 120 receives the first processing request from the client 110, including that a SQL client is deployed in the client 110, the SQL client can receive a SQL statement a input by a user, and then send the SQL statement a to the server 120 in which a database is deployed.

[0119] For example, the SQL client provides an interface for interacting with the database, allowing the user to perform operations such as executing a SQL query, managing the database, and processing data. The SQL client can include RazorSQL, SQuirreL SQL, SQLyog, and the like.

[0120] In another possible implementation, a business application is deployed in the client 110, the business application receives a keyword input by a user, the client 110 parses an identity label of target data according to the keyword, and then generates the SQL statement a according to the identity label of the target data and a number of shards of the target data required, and sends the SQL statement a to the server 120.

[0121] For example, the keyword includes one or more of the following: a name of the target data, an identity document (ID), a shard value, a name or ID of sub-data in the target data, and the like. Typically, the identity label of the target data can be a table ID.

[0122] In yet another possible implementation, the server 120 receives the first processing request from the client 110, including that the server 120 receives the first processing request from a data management tool deployed on the client 110.

[0123] In a possible example, the data management tool can be a data migration tool or a data synchronization tool, or the like.

[0124] In a possible example, the server 120 obtains the first processing request sent by the data management tool, including that the data management tool generates the SQL statement a according to an identity label of target data input by a user and a number of shards of the target data required, and sends the SQL statement a to the server 120.

[0125] S320, the server 120 returns, to the client 110, shard boundary information of the target data by scanning a target self-balancing tree corresponding to the target data in response to the first processing request.

[0126] The shard boundary information of the target data includes a value of an identity of the target data stored in a root node or a child node of the root node of the target self-balancing tree. At least one self-balancing tree stored in the server 120 includes the target self-balancing tree.

[0127] In a possible scenario, each data table stored in the server 120 corresponds to a self-balancing tree, and a root node or a child node of the root node in the self-balancing tree is used to store an identifier, i.e., a primary key or an index, of the data. Further, after receiving the first processing request, the server 120 determines a target self-balancing tree corresponding to the target data from at least one self-balancing tree, where the target self-balancing tree is a self-balancing tree storing an identifier of the target data.

[0128] As shown in FIG. 4, FIG. 4 is a structural diagram of a self-balancing tree provided in this application. The self-balancing tree shown in FIG. 4 is a B+Tree, which includes three layers: a root node in the first layer, a first child node in the second layer, and a second child node in the third layer.

[0129] In a possible scenario, if the identifiers stored in the root node and the first child node are indexes, the data stored in the second child node is a primary key of the data table. The server 120 can determine a column or a row of data in the data table according to the primary key.

[0130] In another possible scenario, if the identifiers stored in the root node and the first child node are primary keys, the data stored in the second child node is actual data in the data table, such as a column or a row of data in the data table corresponding to the primary key.

[0131] It is worth noting that the self-balancing tree provided in FIG. 4 is only taken as an example of a B+Tree including three layers, and in other embodiments of this application, the self-balancing tree can include more or fewer layers, or the self-balancing tree can be a B-Tree, a B*Tree, a self-balancing binary tree, and the like, which are not described herein.

[0132] In the embodiments of this application, when the server 120 returns the shard boundary information of the target data to the client 110 according to the first processing request, the number of shards indicated by the number of identifiers of the target data in the returned shard boundary information should be greater than or equal to the shard value in the first processing request.

[0133] In a possible implementation, the server 120 returns the shard boundary information of the target data to the client in response to the first processing request by scanning the target self-balancing tree corresponding to the target data, including: the server 120 scans the target self-balancing tree corresponding to the data table stored by the server 120, and takes the value of the identifier of the target data stored in the root node or the child node of the root node in the target self-balancing tree as the shard boundary information.

[0134] For example, the server 120 scans the target self-balancing tree from top to bottom and layer by layer. If the number of shards indicated by the number of target data identifiers stored in the root node is greater than or equal to the number of shards of the target data, only the values of the target data identifiers stored in the root node are read, and the values of the target data identifiers in the root node are returned to the client 110 as the shard boundary information of the target data.

[0135] If the number of shards indicated by the number of target data identifiers stored in the root node is less than the number of shards of the target data, the target data identifiers in the first child node are further read until the number of shards indicated by the number of target data identifiers in the nth child node is greater than or equal to the number of shards of the target data. Then, the values of the target data identifiers in the nth child node are returned to the client 110 as the shard boundary information of the target data. Therefore, the nth child node is the child node of the root node in the shard boundary information returned by the server 120 to the client 110, and n is a positive integer.

[0136] In a possible example, the number of shards indicated by the number of target data identifiers is the number of target data identifiers + 1. For example, in FIG. 4, three identifiers 14, 20, and 25 are stored in the root node. By taking the values of the three identifiers as the boundary lines, the target data can be divided into four shards S1-S4, where the shard S1 includes target data with primary key values / index values in the range (-∞, 14), the shard S2 includes target data with primary key values / index values in the range [14, 20), the shard S3 includes target data with primary key values / index values in the range [20, 25), and the shard S4 includes target data with primary key values / index values in the range [25, +∞). That is, the number of shards indicated by the number of target data identifiers stored in the root node in FIG. 4 is 4.

[0137] The following describes two possible examples by taking the scanning of the target data identifiers stored in the root node by the server 120 as an example.

[0138] In example 1, if the number of shards indicated by the number of target data identifiers stored in the root node is greater than the number of shards of the target data, the shard boundary information of the target data returned by the server 120 to the client 110 includes the values of all or part of the target data identifiers stored in the root node of the target self-balancing tree.

[0139] For example, the server 120 returns all the values of the identifiers of the target data in the root node as the slice boundary information of the target data. In this implementation, the client can further select some of the values of the identifiers in the slice boundary information as the slice boundary to determine the number of slices equal to the number of slices required by the user after receiving the slice boundary information. For example, the target self-balancing tree in FIG. 4, when the number of slices of the target data required by the user in the first processing request is 3, since the number of slices indicated by the number of identifiers stored in the root node of the target self-balancing tree is 4, which exceeds the number of slices required by the user, the server 120 can return all the three identifiers 14, 20, and 25 in the root node as the slice boundary information to the client 110. The client 110 further selects the values of the two identifiers 14 and 25 to divide the target data into three data slices (-∞, 14], [14, 25), and [25, +∞) after receiving the slice boundary information.

[0140] For another example, the server 120 selects some of the values of the identifiers of the target data from all the values of the identifiers of the target data in the root node as the slice boundary information of the target data based on the number of slices of the target data required by the user. Further, the slice boundary information of the target data includes the number of slices indicated by the number of identifiers of the target data equal to the number of slices of the target data. For example, the target self-balancing tree in FIG. 4, when the number of slices of the target data required by the user in the first processing request is 3, since the number of slices indicated by the number of identifiers stored in the root node of the target self-balancing tree is 4, which exceeds the number of slices required by the user, the server 120 can select two identifiers in the root node as the slice boundary information returned to the client 110, for example, the returned slice boundary information includes 14 and 20, or includes 14 and 25, or includes 20 and 25.

[0141] It is worth noting that the content of selecting some of the values of the identifiers of the target data from all the values of the identifiers of the target data in the above example 1 is not limited to specific selection means.

[0142] Example 2, if the number of slices indicated by the number of identifiers of the target data stored in the root node is equal to the number of slices of the target data, the server 120 returns all the values of the identifiers of the target data in the root node as the slice boundary information of the target data.

[0143] It is worth noting that the above examples are only described by taking the case that the number of fragments indicated by the number of target data identifiers stored in the root node is greater than or equal to the number of target data fragments. In other embodiments, there can be a case that the number of fragments indicated by the number of target data identifiers stored in the nth child node is greater than or equal to the number of target data fragments. For the content of taking the value of the target data identifier stored in the nth child node as the target data fragment boundary information, reference can be made to the description of the above two examples, and details are not described herein.

[0144] S330, the server 120 receives the second processing request from the client 110.

[0145] The second processing request is used to indicate obtaining P target data fragments, and the boundaries of the P target data fragments are determined based on the target data fragment boundary information, and P is a positive integer.

[0146] In a possible example, the second processing request is the SQL statement b.

[0147] In a possible implementation, the server 120 receives the second processing request from the client 110, including: the server 120 receives the SQL statement b from the SQL client or the business application deployed in the client 110.

[0148] For example, the SQL client in the client 110 receives the SQL statement b input by the user, and then forwards the SQL statement b to the server 120.

[0149] For another example, the business application in the client 110 receives a keyword input by the user, and then generates the SQL statement b according to the keyword, and sends the SQL statement b to the server 120. The keyword can be the target data fragment boundary information or the boundary of the P fragments.

[0150] In other possible embodiments, when the user wants to obtain target data by fragments, the user inputs an interactive instruction indicating the information required for obtaining the target data by fragments to the client 110. Then, the client 110 responds to the interactive instruction, and first sends the first processing request to the server 120 according to the interactive instruction, and after receiving the fragment boundary information returned by the server 120, continues to send the second processing request to the server 120 according to the interactive instruction.

[0151] In another possible implementation, the server 120 receives the second processing request from the client 110, including: the server 120 receives the SQL statement b sent by the data management tool deployed in the client 110.

[0152] Two possible examples are provided below in relation to the relationship between the boundaries of the P shards of the target data and the shard boundary information of the target data.

[0153] Example 1, the number of shards indicated by the number of target data identifiers included in the shard boundary information of the target data is greater than the P shards of the target data required in the second processing request, the boundaries of the P shards of the target data include part of the values of the target data identifiers included in the shard boundary information.

[0154] In other words, after the client 110 obtains the shard boundary information of the target data, the client 110 filters or fuses the values of the target data identifiers included in the shard boundary information of the target data, thereby obtaining the boundaries of the P shards, and generates the SQL statement b according to the boundaries of the P shards.

[0155] For example, the shard boundary information of the target data includes 14, 20, and 25. The client 110 filters or fuses 14, 20, and 25 to obtain the boundaries of the three shards, which include 14 and 25, in order to meet the user's requirement for the number of shards of the target data (i.e., P is 3). The ranges of the three shards are (-∞, 14], [14, 25), and [25, +∞), respectively.

[0156] For another example, after the client 110 receives the shard boundary information of the target data, the client 110 displays the shard boundary information of the target data on the front end connected to the client 110, and receives the boundaries of the P shards input by the user, in the form of 14 and 25 or (-∞, 14], [14, 25), and [25, +∞). Alternatively, the client 110 receives the SQL statement b input by the user, which contains the boundaries of the P shards.

[0157] Example 2, the number of shards indicated by the number of target data identifiers included in the shard boundary information of the target data is equal to the number of shards of the target data, and the boundaries of the P shards of the target data include all the values of the target data identifiers included in the shard boundary information.

[0158] In other words, after the client 110 obtains the shard boundary information of the target data, the client 110 takes the values of the target data identifiers included in the shard boundary information of the target data as the boundaries of the P shards, and generates the second processing request according to the boundaries of the P shards.

[0159] For example, the slice boundary information of the target data includes: 14, 20, 25, and the client 110 takes the slice boundary information of the target data as the boundaries of four slices to meet the user's requirement for the number of slices of the target data (i.e., P is 4), and the four slice boundaries include: 14, 20, 25. The ranges of the four slices are (-∞, 14], [14, 20), [20, 25), and [25, +∞), respectively.

[0160] For another example, after the client 110 receives the slice boundary information of the target data, the client 110 displays the slice boundary information of the target data on the front end connected to the client 110 and receives the user's input of the boundaries of four slices, such as: 14, 20, 25 or (-∞, 14], [14, 20), [20, 25), and [25, +∞). Alternatively, the client 110 receives the user's input of the SQL statement b, which contains the boundaries of four slices.

[0161] It should be noted that in this application, the number of slices P in the second processing request and the number of slices indicated by the first processing request can be the same or different, and this application does not make any limitation on this. In actual application, after receiving the slice boundary information returned by the server 120, the client 110 can determine the number of slices P required in the second processing request in order to balance the data volume of each slice and consider the number of concurrent threads of its own business, so that the data is finally returned in P slices.

[0162] S340, the server 120 returns P slices of the target data to the client 110 in the form of slices in response to the second processing request.

[0163] In the case where the second processing request is the SQL statement b, the server 120 executes the SQL statement b to perform a data reading operation on the sub-data included in the P slices of the at least one slice of the target data, and returns the P slices of the target data to the client 110 in the form of slices.

[0164] In one possible example, the server 120 reads the sub-data included in each of the P slices of the target data from the hard disk to the memory in the form of slices.

[0165] For example, the second processing request can include multiple SQL statements b, and one SQL statement b corresponds to obtaining the sub-data included in one slice, and then the server 120 executes multiple SQL statements b in parallel to simultaneously obtain the sub-data included in multiple slices, and returns the P slices of the target data to the client 110 in the form of slices, thereby improving the efficiency of the server 120 in reading data and the efficiency of the client 110 in obtaining slices.

[0166] For example, in the data query scenario, the SQL statement b is a query statement. For example, the query statement can be: SELECT * FROM table WHERE row[i]<=pk<row[i+1]. Wherein, row[i], row[i+1] are used to indicate the boundary of the shard, row[i] is the minimum boundary in the shard, and row[i+1] is the maximum boundary of the shard, and the boundary is the value of the primary key / index.

[0167] The server 120 can query the data in the target data table (table) whose primary key is between row[i] and row[i+1] according to the query statement, and send it to the client 110.

[0168] For example, the server 120 reads the data in the target data table in the hard disk whose primary key is between row[i] and row[i+1] into the memory. When the total amount of data in the memory reaches a certain threshold, or when the data in the target data table whose primary key is between row[i] and row[i+1] is all read into the memory, the server 120 sends the data stored in the memory to the client 110.

[0169] In one possible example, the second processing request includes the boundaries of P shards, that is, the server 120 receives multiple query statements. The multiple query statements are processed by multiple threads in the server 120, one thread processes one query statement, so as to realize multi-thread parallel query of different shards in the target data table and improve the query efficiency.

[0170] It is worth noting that the difference between the data export scenario and the data query scenario is that in the data export scenario, the server 120 exports the data obtained by querying. For example, the server 120 exports the data obtained by querying as an excel file, that is, the client receives an excel file, and the content shown in a sub-table in the excel file is the sub-data included in a shard.

[0171] It is worth noting that the content shown in FIG. 3 is a description in the data query scenario. In the data copying, data migration, data synchronization, and other scenarios, further processing will be performed on the basis of the content shown in FIG. 3, such as the client 110 performing data processing operations (such as forwarding) on the P shards of the target data.

[0172] The following describes the content of the data copying and data migration scenarios in detail.

[0173] In the data copy scenario, the SQL statement b is a copy statement. For example, the copy statement can be: INSERT INTO Employees_Copy; SELECT * FROM table WHERE row[i]<=pk<row[i+1], where Employees_Copy is a table for storing the copied data.

[0174] The server 120 can query the data whose primary keys are between row[i] and row[i+1] in the target data table according to the copy statement, and copy the data to Employees_Copy. The structure of Employees_Copy is consistent with that of the target data table.

[0175] For example, the server 120 reads the data whose primary keys are between row[i] and row[i+1] in the target data table in the hard disk to the memory. When the total amount of data in the memory reaches a certain threshold, or when the data whose primary keys are between row[i] and row[i+1] in the target data table are all read to the memory, the server 120 further copies the data stored in the memory to Employees_Copy.

[0176] In one possible case, the target data table and Employees_Copy can be on the same server.

[0177] In another possible case, the target data table and Employees_Copy are not on the same server. In this case, the table name (Employees_Copy, table) of the copy statement can also be added with the server or database where the table is located. For example, the copy statement is: INSERT INTO a_db.Employees_Copy; SELECT * FROM b_db.table WHERE row[i]<=pk<row[i+1], where a_db represents the database where Employees_Copy is located, and b_db represents the database where table is located.

[0178] In the case where the data table and Employees_Copy are not on the same server 120, the shards of the target data table can be forwarded by the client 110, that is, the client 110 forwards the P shards of the target data in parallel to the server where Employees_Copy is located after receiving the P shards of the target data.

[0179] It is worth noting that the data backup scenario, the data synchronization scenario and the data copy scenario are basically the same. For the content of the data backup scenario, please refer to the content of the above data copy scenario, which will not be repeated here.

[0180] In the data migration scenario, the SQL statement b is a migration statement. For example, the migration statement can be INSERT INTO Employees_Archive; SELECT * FROM table WHERE row[i]<=pk<row[i+1] ; DELETE FROM table WHERE row[i]<=pk<row[i+1], where Employees_Archive is a table for storing the migrated data.

[0181] The server 120 can query the data in the target data table with the primary keys between row[i] and row[i+1] according to the copy statement, and migrate the data to Employees_Archive. After the data migration is completed, the data in the table with the primary keys between row[i] and row[i+1] is deleted.

[0182] For example, the server 120 reads the data in the target data table with the primary keys between row[i] and row[i+1] in the hard disk to the memory. When the total amount of data in the memory reaches a certain threshold, or when the data with the primary keys between row[i] and row[i+1] in the target data table are all read to the memory, the data stored in the memory is migrated to the client 110. Then, the client 110 migrates the data with the primary keys between row[i] and row[i+1] in the target data table to the server where Employees_Archive is located. After the data migration is completed, the data with the primary keys between row[i] and row[i+1] in the target data table is deleted.

[0183] For the content of S320, a possible embodiment is provided as follows. As shown in FIG. 5, FIG. 5 is a flowchart of a method for obtaining the shard boundary information provided in the present application. The first processing request carries the flag of the target data, which can be the target data table. The content shown in FIG. 5 includes the following steps S510-S530.

[0184] S510, the server 120 determines the target self-balancing tree corresponding to the flag of the target data from the mapping relationship between the flag of the target data and the self-balancing tree.

[0185] The server 120 maintains the mapping relationship. The flag of the target data can be the table name or id of the target data table.

[0186] For example, the SQL statement corresponding to the first processing request is: SELECT col0, col1, …, colk FROM table WHERE SPLIT_CHUNK(chunk_num), where table is the mark of the target data.

[0187] In a possible implementation, the server 120 determines the mark of the target data corresponding to the target self-balancing tree from the mapping relationship.

[0188] In S520, the server 120 acquires the value of the target data identifier stored in the root node or the child node of the target self-balancing tree.

[0189] In a possible implementation, the server 120 scans the target self-balancing tree from top to bottom until the number of target data identifiers stored in the root node or the child node (the first child node, the second child node, …, the nth child node) indicates the number of shards is greater than or equal to the shard value in the first processing request, and then the server 120 acquires the value of the target data identifier stored in the root node or the child node.

[0190] In a possible example, the server 120 acquires the target data identifier stored in the root node of the target self-balancing tree. As shown in FIG. 4, the server 120 acquires the target data identifiers 14, 20, and 25 stored in the root node.

[0191] If the shard value is 5, the number of shards indicated by the number of target data identifiers stored in the root node (for example, 4) is less than the number of shards of the target data required by the user, and then the server 120 acquires the value of the target data identifier stored in the child node.

[0192] For example, the number of shards indicated by the number of target data identifiers stored in the first child node is greater than or equal to the number of shards of the target data required by the user.

[0193] For example, the number of shards indicated by the number of target data identifiers stored in the first child node is equal to the number of shards of the target data required by the user. As shown in FIG. 4, since the data in each node of the target self-balancing tree is arranged in sequence, the server 120 can start from the leftmost index node of the first child node, read the target data identifiers in the index nodes in sequence, and read the target data identifiers until the number of read target data identifiers is shard value-1, so as to read the value of the target data identifier. For example, the server 120 reads the values of the target data identifiers 5, 8, 14, and 17.

[0194] For example, the number of identifiers of the target data obtained by the server 120 from the first child node indicates a number of shards that is greater than the number of shards of the target data required by the user. The server 120 directly reads the values of the identifiers of the target data stored in all the index nodes in the first child node.

[0195] The number of shards indicated by the number of identifiers of the target data is equal to the number of identifiers of the target data plus 1.

[0196] If the shard value is 3, the number of shards indicated by the number of identifiers of the target data stored in the root node is greater than or equal to the number of shards of the target data required by the user, and the server 120 only needs to scan the root node to obtain the values of the identifiers of the target data stored in the root node.

[0197] For example, the number of shards indicated by the number of identifiers of the target data obtained by the server 120 from the root node is equal to the number of shards of the target data required by the user. As shown in FIG. 4, since the data in each node in the target self-balancing tree is arranged in sequence, the server 120 can sequentially read the identifiers of the target data in the root node from the leftmost side until the number of identifiers of the target data read is equal to the shard value minus 1, thereby achieving reading the values of the identifiers of the target data. For example, the server 120 reads the values of the identifiers of the target data as 14 and 20.

[0198] For example, the number of shards indicated by the number of identifiers of the target data obtained by the server 120 from the root node is equal to the number of shards of the target data required by the user. As shown in FIG. 4, since the data in each node in the target self-balancing tree is arranged in sequence, the server 120 can sequentially read the identifiers of the target data in the root node from the leftmost side until the number of identifiers of the target data read is equal to the shard value minus 1, thereby achieving reading the values of the identifiers of the target data. For example, the server 120 reads the values of the identifiers of the target data as 14 and 20.

[0199] It should be noted that the above only takes the example of the server 120 reading the identifiers of the target data from the leftmost side of the root node or the first child node, and in other embodiments of the present application, the server 120 can also read the identifiers of the target data from the rightmost side or a random position of the root node or the first child node, which is not described herein.

[0200] S530, the server 120 returns the read identifiers of the target data to the client 110 as the shard boundary information.

[0201] In one possible example, if the number of shards indicated by the number of identifiers of the target data read is equal to the number of shards of the target data, the server 120 returns all the identifiers of the target data as the shard boundary information to the client 110.

[0202] In another possible example, if the number of the read target data identifiers indicates a number of shards that is greater than the number of shards of the target data, the server 120 returns all of the target data identifiers as the shard boundary information to the client 110.

[0203] In yet another possible example, if the number of the read target data identifiers indicates a number of shards that is greater than the number of shards of the target data, the server 120 returns part of the target data identifiers as the shard boundary information to the client 110. Thus, the number of shards indicated by the target data identifiers included in the shard boundary information is equal to the number of shards of the target data.

[0204] It is worth noting that the above description is only an example of a two-layer structure in the target self-balancing tree. In other embodiments of the present application, the target self-balancing tree can also include more layers of structures (such as the three-layer structure in FIG. 4). If the number of target data identifiers stored in the first child node is still less than the number of shards of the target data required by the user, the server 120 can also read the values of the target data identifiers stored in the next layer of nodes (the second child node) of the first child node. For the content of the values of the target data identifiers stored in the second child node read by the server 120, reference can be made to the description of the values of the target data identifiers stored in the first child node read by the server 120, which will not be repeated here.

[0205] Therefore, in the process of scanning the target self-balancing tree layer by layer, if the number of shards indicated by the target data identifiers stored in the nth child node is greater than or equal to the number of shards of the target data required by the user for the first time, the nth child node is a child node of the root node.

[0206] In view of the above description of FIG. 3, a complete embodiment is provided as follows. The complete embodiment includes the following steps ①-⑥.

[0207] Step ①: The server 120 receives the first processing request sent by the client 110.

[0208] The first processing request can be a SQL statement a, which carries the identifier of the target data table and the shard number value.

[0209] In a possible example, the SQL statement a further includes one or more primary keys or indexes in the target data table.

[0210] For the details of step ①, reference can be made to the content shown in S310 of FIG. 3, which will not be repeated here.

[0211] Step 2: The parser and the optimizer in the server 120 process the SQL statement a in turn, and send the processed SQL statement a to the executor in the server 120.

[0212] For the content of processing the SQL statement a by the parser and the optimizer in turn, refer to the conventional technical means in the art, which is not described herein.

[0213] Step 3: The executor in the server 120 scans the target self-balancing tree corresponding to the target data table from top to bottom in response to the processed SQL statement a, until the number of the obtained identifiers of the target data indicates the number of the shards is greater than or equal to the number of the shards of the target data required by the user (i.e., the shard value), and obtains the shard boundary information.

[0214] Step 4: The server 120 sends the shard boundary information to the client 110.

[0215] Step 5: The server 120 receives the second processing request sent by the client 110.

[0216] Step 6: The server 120 returns the P shards of the target data to the client 110 in the form of shards in response to the second processing request.

[0217] For the detailed content of steps 3-6, refer to the description of FIG. 5, which is not described herein.

[0218] It is worth noting that the above is described by taking a complete data table as an example. In a possible case, the server 120 can also shard a partition table, which is a partition of the above data table, i.e., a subset of the above data table on the partition table. For example, the SQL statement for sharding the partition table can be: SELECT col0, col1,.., colk FROM table PARTITION(p_20240620) WHERE SPLIT_CHUNK(chunk_num), wherein table PARTITION(p_20240620) represents the identifier of the partition table, such as p_20240620. The content of processing the above SQL statement by the server 120 can refer to the content shown in FIGS. 3-5, which is not described herein.

[0219] In other embodiments of the present application, the first processing request is a SQL statement c. The SQL statement c is used to instruct the server 120 to obtain the shard boundary information in the system table or the temporary table.

[0220] System tables are tables inside the server 120 that store system-level metadata and configuration information. These tables typically contain data about database structures, objects, permissions, statistics, data's sharding boundary information, etc. Temporary tables are tables in the server 120 that are used to store temporary data. Temporary tables can be used to represent data's sharding boundary information, especially when these information needs to be dynamically calculated or temporarily stored. For example, the server 120 periodically (e.g., every 1 hour) scans the self-balancing tree corresponding to a data table, obtains the values of the target data's identifiers stored in the root node and / or the child nodes of the root node in the self-balancing tree, and stores the values of the target data's identifiers in the system tables or the temporary tables.

[0221] Further, the server 120 obtains the values of the target data's identifiers from the system tables or the temporary tables through the SQL statement c, and returns the values of the target data's identifiers as the sharding boundary information to the client 110.

[0222] For the subsequent content of the present embodiment, reference can be made to the description of S330 and S340 in FIG. 3, which will not be repeated here.

[0223] It can be understood that, in order to implement the functions in the above embodiments, the server includes hardware structures and / or software modules corresponding to each function. Those skilled in the art should easily realize that, in combination with the units and method steps of the examples described in the embodiments disclosed in the present application, the present application can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution. In the foregoing, the data reading method provided by the present embodiment is described in detail in combination with FIG. 3 to FIG. 5. In the following, the data reading apparatus provided by the present embodiment will be described in combination with FIG. 6.

[0224] FIG. 6 is a structural schematic diagram of a data reading apparatus according to an embodiment of the present application. The data reading apparatus can be used to implement the functions of the server 120 in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments. In the present embodiment, the data reading apparatus 600 can be a module (e.g., a chip) of the server 120.

[0225] As shown in FIG. 6, the data reading apparatus 600 includes a first receiving module 610, a scanning module 620, a second receiving module 630, and a returning module 640. The data reading apparatus 600 is used to implement the functions of the server 120 in the method embodiments shown in FIG. 3 and FIG. 5. In one possible example, the data reading apparatus 600 is used to implement the specific process of the above data reading method, which includes the following processes:

[0226] The first receiving module 610 is configured to receive a first processing request from a client, where the first processing request is used to indicate to obtain shard boundary information of target data, and the data includes the target data.

[0227] The scanning module 620 is configured to scan a target self-balancing tree corresponding to the target data in response to the first processing request, and return the shard boundary information of the target data to the client, where the server stores an identifier of the data, and the identifier of the data is stored in the server in the form of a self-balancing tree, the self-balancing tree includes the target self-balancing tree, and the shard boundary information of the target data includes a value of the identifier of the target data stored in a root node or a child node of the root node of the target self-balancing tree.

[0228] The second receiving module 630 is configured to receive a second processing request from the client, where the second processing request is used to indicate to obtain P shards of the target data, and boundaries of the P shards of the target data are determined based on the shard boundary information of the target data, P is a positive integer.

[0229] The returning module 640 is configured to return the P shards of the target data to the client in the form of shards in response to the second processing request.

[0230] To further implement the functions in the method embodiments shown in FIG. 3 and FIG. 5, the present application further provides a data reading apparatus, as shown in FIG. 7, which is a structural schematic diagram two of a data reading apparatus provided by the present application. The data reading apparatus 600 further includes a transceiving module 650.

[0231] The transceiving module 650 is configured to send a first processing request to a server, receive shard boundary information of target data returned by the server, determine boundaries of P shards of the target data according to the shard boundary information of the target data, and send a second processing request to the server and receive the P shards of the target data returned by the server.

[0232] It should be noted that in other embodiments, the first receiving module 610 can be configured to perform any step in the data reading method, the scanning module 620 can be configured to perform any step in the data reading method, the second receiving module 630 can be configured to perform any step in the data reading method, and the returning module 640 can be configured to perform any step in the data reading method. The steps implemented by the first receiving module 610, the scanning module 620, the second receiving module 630, and the returning module 640 can be specified as needed, and the entire function of the data reading apparatus 600 can be implemented by the first receiving module 610, the scanning module 620, the second receiving module 630, and the returning module 640 respectively implementing different steps in the data reading method.

[0233] It is worth noting that the server 120 according to the embodiments of the present application can correspond to the data reading device 600 in the embodiments of the present application, and can correspond to the corresponding subject performing the methods of FIG. 3 and FIG. 5 according to the embodiments of the present application, and the operations and / or functions of each module in the data reading device 600 are respectively for realizing the corresponding processes of each method in the embodiments of FIG. 3 and FIG. 5, and for the sake of brevity, will not be repeated here.

[0234] When the data reading device 600 implements the data reading method shown in any of the preceding figures by software, the data reading device 600 and each unit thereof can also be a software module. The software module is called by the processor to realize the above-mentioned data reading method. The processor can be a CPU, an ASIC implementation, or a programmable logic device (PLD), and the above-mentioned PLD can be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0235] For more detailed description of the data reading device 600, please refer to the relevant description in the embodiments shown in the preceding figures, which will not be repeated here. It can be understood that the data reading device 600 shown in the preceding figures is only an example provided by the present embodiment, and the data reading device 600 can include more or fewer units according to different use scenarios, which is not limited by the present application.

[0236] When the data reading device 600 is implemented by hardware, the hardware can be implemented by a processor or a chip. The chip includes an interface circuit and a control circuit. The interface circuit is used to receive a processing request from other devices outside the processor and transmit it to the control circuit, or send data (such as fragment boundary information, fragments of target data) from the control circuit to other devices outside the processor.

[0237] The control circuit and the interface circuit are used to implement the method of any possible implementation manner in the above-mentioned embodiments through a logic circuit or an execution code instruction. The beneficial effects can be referred to the description of any aspect of the above-mentioned embodiments, which will not be repeated here.

[0238] It can be understood that the processor in the embodiments of the present application can be a CPU, NPU or GPU, and can also be other general-purpose processors, digital signal processors (DSP), ASICs, FPGAs or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor.

[0239] In addition, the data reading apparatus 600 shown in FIGS. 6 and 7 can also be implemented by a server, such as the server 120 shown in FIG. 1, or a data management system including the server 120, etc.

[0240] The method steps in the embodiments of the present application can also be implemented by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in a RAM, a flash memory, a ROM, a PROM, an EPROM, an electrically EPROM (EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor, so that the processor can read information from and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a communication device. Of course, the processor and the storage medium can also exist as discrete components in the communication device. The present application also provides a chip system including a processor for implementing the functions of the storage device in the above method. In a possible design, the chip system also includes a memory for storing program instructions and / or data. The chip system can be composed of a chip, or can include a chip and other discrete devices.

[0241] The present application also provides a computing device. Please refer to FIG. 8, which is a structural schematic diagram of a computing device provided by the present application. The computing device 800 includes a bus 802, a processor 804, a memory 806 and a communication interface 808. The processor 804, the memory 806 and the communication interface 808 are communicatively connected to each other through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 800. For example, the computing device 800 can be the server 120 described above.

[0242] The bus 802 can be a PCIe bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one line is represented in FIG. 8, but it does not mean that there is only one bus or only one type of bus. The bus 802 can include a path for transmitting information between various components (e.g., the processor 804, the memory 806, the communication interface 808) of the computing device 800.

[0243] The processor 804 can include any one or more of a CPU, a GPU, a FPGA, a microprocessor (MP), or a DSP, etc.

[0244] The memory 806 can include a volatile memory, such as a RAM. The processor 804 can also include a non-volatile memory, such as a ROM, a flash memory, an HDD, or an SSD.

[0245] The memory 806 stores executable program code, and the processor 804 executes the executable program code to respectively implement the functions of the aforementioned first receiving module 610, the scanning module 620, the second receiving module 630, and the returning module 640, so as to implement the data reading method. That is, the memory 806 stores instructions for executing the data reading method.

[0246] The communication interface 808 uses a transceiving module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or communication networks. The computing device 800 can be a computer (e.g., a server) in a cloud data center, or a computer in an edge data center, or a terminal.

[0247] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device, which can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a desktop computer, a notebook computer, or a terminal device such as a smart phone. For example, the computing device cluster can be the server 120 described above.

[0248] As shown in FIG. 9, FIG. 9 is a structural schematic diagram of a computing device cluster provided by the present application. The computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster can store the same instructions for executing the data reading method.

[0249] In some possible implementation, the memory 806 of one or more of the computing devices 800 in the computing device cluster can also respectively store partial instructions for performing the data reading method. In other words, the combination of the one or more computing devices 800 can collectively perform the instructions for performing the data reading method.

[0250] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions respectively for performing partial functions of the data reading method. That is, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of one or more of the first receiving module 610, the scanning module 620, the second receiving module 630, and the returning module 640.

[0251] In some possible implementation, one or more of the computing devices in the computing device cluster can be connected through a network. The network can be a wide area network or a local area network, etc. FIG. 10 shows one possible implementation. As shown in FIG. 10, FIG. 10 is a schematic diagram of connection between computing devices provided in the present application, two computing devices 800A and 800B are connected through a network. Specifically, the communication interface in each computing device is connected to the network. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for performing the functions of the first receiving module 610 and the second receiving module 630. Meanwhile, the memory 806 in the computing device 800B stores instructions for performing the functions of the scanning module 620 and the returning module 640.

[0252] It should be understood that the functions of the computing device 800A shown in FIG. 10 can also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B can also be completed by multiple computing devices 800.

[0253] The embodiments of the present application also provide a computer program product containing instructions. The computer program product can be software or a program product containing instructions, which can run on a computing device or be stored in any available medium. When the computer program product runs on at least one computing device, the at least one computing device is caused to perform the above data reading method.

[0254] The embodiments of the present application further provide a computer readable storage medium. The computer readable storage medium can be any available medium or data storage device that can be accessed by a computing device and includes one or more available media or data storage devices. The available medium can be a magnetic medium, (e.g., a floppy diskette, a hard disk drive, a magnetic tape), an optical medium, (e.g., a digital video disc (DVD)), or a semiconductor medium, (e.g., a solid state hard drive), etc. The computer readable storage medium includes instructions that instruct a computing device to perform the data reading method.

[0255] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer programs or instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are performed. The computer can be a general purpose computer, a special purpose computer, a computer network, a network device, a user equipment or other programmable apparatus. The computer programs or instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer programs or instructions can be transferred from one website site, computer, server or data center to another website site, computer, server or data center through wired or wireless manner. The computer readable storage medium can be any available medium accessible by a computer or a data storage device integrated with one or more available media, such as a server, data center, etc. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, a magnetic tape; an optical medium, such as a DVD; or a semiconductor medium, such as an SSD.

[0256] In various embodiments of the present application, the terms and / or descriptions of different embodiments are consistent and can be referred to each other if there is no special description and logical conflict, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship. The various numbers involved in the embodiments of the present application are only used for differentiation for convenience of description, and are not used to limit the scope of the embodiments of the present application. The size of the serial number of the above processes does not mean the execution order, and the execution order of the processes should be determined according to their functions and inherent logic.

Claims

1. A data reading method characterized by, The method is applied to a data management system, wherein an identifier of data is stored in the data management system, and a storage form of the identifier of the data in the data management system is a self-balancing tree; The data management system comprises a server and a client, and the method comprises: The server receives a first processing request from the client, wherein the first processing request is used to indicate acquisition of shard boundary information of target data, and the data comprises the target data; In response to the first processing request, the server returns the shard boundary information of the target data to the client by scanning a target self-balancing tree corresponding to the target data, wherein the self-balancing tree comprises the target self-balancing tree, and the shard boundary information of the target data comprises values of identifiers of the target data stored in a root node of the target self-balancing tree or child nodes of the root node; The server receives a second processing request from the client, wherein the second processing request is used to indicate acquisition of P shards of the target data, and boundaries of the P shards of the target data are determined based on the shard boundary information of the target data, and P is a positive integer; In response to the second processing request, the server returns the P shards of the target data to the client in a form of shards.

2. The method of claim 1, wherein, The first processing request is a structured query language (SQL) statement.

3. The method of claim 2, wherein, The SQL statement comprises a specified field used to define a number of shards of the target data, and the specified field is a syntax field of the SQL statement or a comment field of the SQL statement.

4. The method according to any one of claims 1 to 3, characterized in that, The first processing request carries a shard value used to indicate the number of shards of the target data, and a number of shards indicated by a number of identifiers of the target data included in the shard boundary information of the target data is greater than or equal to the shard value.

5. The method of claim 4, wherein, The server returns the shard boundary information of the target data to the client by scanning the target self-balancing tree corresponding to the target data, comprising: acquiring identifiers of the target data stored in the root node of the target self-balancing tree; if a number of shards indicated by a number of identifiers of the target data stored in the root node is less than the number of shards of the target data, acquiring values of the identifiers of the target data stored in child nodes of the root node, and returning the values of the identifiers of the target data stored in the child nodes of the root node to the client as the shard boundary information of the target data, wherein a number of shards indicated by a number of identifiers of the target data stored in the child nodes of the root node is greater than or equal to the number of shards of the target data; if the number of shards indicated by the number of identifiers of the target data stored in the root node is greater than or equal to the number of shards of the target data, returning the values of the identifiers of the target data stored in the root node to the client as the shard boundary information of the target data.

6. The method according to any one of claims 1 to 5, characterized in that, The identifier of the data is a primary key or an index of the data.

7. The method according to any one of claims 1 to 6, characterized in that, The self-balancing tree is any one of a B+ tree, a B-tree, a B* tree, or a self-balancing binary tree.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: The client sends the first processing request to the server; The client receives the shard boundary information of the target data returned by the server; The client determines the boundaries of the P shards of the target data according to the shard boundary information of the target data; The client sends the second processing request to the server; The client receives the P shards of the target data returned by the server.

9. A data reading device, characterized by The apparatus includes: A first receiving module configured to receive a first processing request from the client, wherein the first processing request is used to indicate to obtain shard boundary information of target data, and the data includes the target data; A scanning module configured to scan a target self-balancing tree corresponding to the target data in response to the first processing request, and return the shard boundary information of the target data to the client; wherein the server stores an identifier of data, and the storage form of the identifier of the data in the server is a self-balancing tree, the self-balancing tree includes the target self-balancing tree, and the shard boundary information of the target data includes a value of the identifier of the target data stored in a root node of the target self-balancing tree or a child node of the root node; A second receiving module configured to receive a second processing request from the client, wherein the second processing request is used to indicate to obtain P shards of the target data, the boundaries of the P shards of the target data are determined based on the shard boundary information of the target data, and P is a positive integer; A returning module configured to return the P shards of the target data to the client in the form of shards in response to the second processing request.

10. The apparatus of claim 9, wherein, The first processing request is a structured query language (SQL) statement.

11. The apparatus of claim 10, wherein, The SQL statement includes a specified field used to define the number of shards of the target data, and the specified field is a syntax field of the SQL statement or a comment field of the SQL statement.

12. The apparatus of any one of claims 9-11, wherein, The first processing request carries a shard value used to indicate the number of shards of the target data, and the number of shards indicated by the number of identifiers of the target data included in the shard boundary information of the target data is greater than or equal to the shard value.

13. The apparatus of claim 12, wherein, The scanning module is specifically configured to acquire the identifiers of the target data stored in the root node of the target self-balancing tree; if the number of shards indicated by the number of the identifiers of the target data stored in the root node is less than the number of shards of the target data, acquire the values of the identifiers of the target data stored in the child nodes of the root node, and return the values of the identifiers of the target data stored in the child nodes of the root node as the shard boundary information of the target data to the client, wherein the number of shards indicated by the number of the identifiers of the target data stored in the child nodes of the root node is greater than or equal to the number of shards of the target data; if the number of shards indicated by the number of the identifiers of the target data stored in the root node is greater than or equal to the number of shards of the target data, return the values of the identifiers of the target data stored in the root node as the shard boundary information of the target data to the client.

14. The apparatus of any one of claims 9-13, wherein, The identifier of the data is a primary key or an index of the data.

15. The apparatus of any of claims 9-14, wherein, The self-balancing tree is any one of a B+ tree, a B- tree, a B* tree, or a self-balancing binary tree.

16. The apparatus of any one of claims 9-15, wherein, The apparatus further includes a transceiving module; The transceiving module is configured to send the first processing request to the server, receive the shard boundary information of the target data returned by the server, determine the boundaries of P shards of the target data according to the shard boundary information of the target data, and send the second processing request to the server and receive the P shards of the target data returned by the server.

17. A cluster of computer devices, characterized in that, The at least one computing device includes a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method of any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions, and when the computer program or instructions are executed by a processing device, the method of any one of claims 1 to 8 is implemented.

19. A computer program product comprising computer programs or instructions, characterized in that, When the computer program or instructions are executed by a processing device, the method of any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Distributed database fragmentation method and device, electronic equipment and storage medium

    CN116303753A

  • Database-based data fragmentation processing method and device, medium and electronic equipment

    CN116521708A

  • Data fragmentation processing method and device, equipment, storage medium and program product

    CN118606398A

  • Distributed database systems and structures

    US11030187B1

  • Data management method and related system

    WO2024040931A1