Data reading method and related device

By scanning the self-balancing tree on the server side to obtain the sharding boundary information, the problem of low data reading efficiency in the existing technology is solved, and the effect of fast parallel data reading is achieved, reducing resource consumption and development costs.

CN121764937APending Publication Date: 2026-03-31HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411388120.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2026-03-31

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 fragmentation boundary information is obtained. The fragmentation boundary of the target data is quickly determined by utilizing the balance marked in the self-balancing tree, and P fragments of data can be read in parallel.

Benefits of technology

It improves data reading efficiency, reduces resource consumption, meets users' personalized needs, and lowers development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121764937A_ABST
    Figure CN121764937A_ABST
Patent Text Reader

Abstract

The invention discloses a data reading method and a related device, and relates to the field of data storage. And the server receives a first processing request which is from the client and is used for indicating to acquire the fragmentation boundary information of the target data, and returns the fragmentation boundary information of the target data to the client by scanning the target self-balancing tree corresponding to the target data in response to the first processing request. And the server side receives a second processing request which is from the client side and is used for indicating to obtain the P fragments of the target data, and further returns the P fragments of the target data to the client side in a fragment form in response to the second processing request. The fragment boundary information of the target data comprises a value of an identifier of the target data stored in a root node of the target self-balancing tree or a child node of the root node. By taking the value of the identifier of the target data stored in the root node or the child node of the root node as the fragment boundary information, the speed of determining the fragment boundary information is accelerated, and the efficiency of performing data reading on the P fragments of the target data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage, and in particular to a data reading method and related apparatus. Background Technology

[0002] Data management refers to the process of organizing and maintaining data, often including data querying and synchronization. Taking data querying as an example, when retrieving large amounts of data from a data storage system, to improve query efficiency, the data is usually divided into multiple shards, and multi-threaded parallel queries are used on these shards. In existing technologies, data is divided into shards and queried by setting the number of rows to skip (indicated by the "offset" parameter) and the number of rows to read (indicated by the "limit" parameter) in a Structured Query Language (SQL) statement. However, using the "offset + limit" partitioning method also requires reading data from rows before the offset position. Therefore, when partitioning data, the actual amount of data read is large, resulting in low reading efficiency. Summary of the Invention

[0003] This application provides a data reading method and related apparatus to solve the problem that when using the offset+limit partitioning method, the resulting fragment quality is long, the actual amount of data to be read is increased, and the data reading efficiency is low.

[0004] Firstly, this application provides a data reading method, which can be applied to a computer system or a computing device supporting the implementation of the data reading method in the computer system. 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 data identifiers, and the data identifiers are stored in the data management system in the form of a self-balancing tree. The data management system includes a server and a client. Here, the data reading method provided in this embodiment is described using the server executing the data reading method provided in this embodiment as an example. The data reading method includes: the server receiving a first processing request from the client indicating the acquisition of fragment boundary information of target data; and responding to the first processing request, scanning the target self-balancing tree corresponding to the target data and returning the fragment boundary information of the target data to the client. Furthermore, the server receiving a second processing request from the client indicating the acquisition of P fragments of the target data; and responding to the second processing request, returning P fragments of the target data to the client in the form of fragments. The data includes target data, the self-balancing tree includes the target self-balancing tree, and the fragmentation boundary information of the target data includes: the value of the target data identifier stored in the root node or child node of the target self-balancing tree. The boundaries of the P fragments of the target data are determined based on the fragmentation boundary information of the target data, where P is a positive integer.

[0005] In this application, the server scans the target self-balancing tree corresponding to the target data, and then uses the values ​​of the target data identifiers stored in the root node or its child nodes as fragment boundary information. This speeds up the determination of the target data fragment boundary information, thereby improving the efficiency of reading P fragments of the target data determined based on the fragment boundary information. Furthermore, since the identifiers are stored in a self-balancing tree format, the values ​​of the identifiers stored among the nodes in the self-balancing tree are relatively balanced. That is, the values ​​of multiple sets of identifiers (one or two identifiers corresponding to a fragment) in the target data indicate relatively balanced sub-data of the target data. Therefore, when the server reads and returns P fragments of the target data in parallel, the efficiency of data reading can be further improved.

[0006] In one possible scenario, the boundaries of the aforementioned P fragments are: the fragment boundary information of the target data includes the values ​​of the identifiers of some or all of the target data.

[0007] In one possible scenario, the first processing request mentioned above is an SQL statement.

[0008] In one possible scenario, the second processing request mentioned above is an SQL statement.

[0009] In one possible scenario, the SQL statement above includes a specified field that defines the number of shards for the target data.

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

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

[0012] In this application, by using a specified field as a comment field in an 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 need to modify the client's SQL parser and lowering development costs.

[0013] For example, the specified field above could be SPLIT_CHUNK.

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

[0015] In one possible scenario, the first processing request carries a fragmentation value indicating the number of fragments of the target data. The number of fragments indicated by the number of identifiers of the target data included in the fragmentation boundary information of the target data is greater than or equal to the fragmentation value.

[0016] In this application, by defining a shard value in the first processing request to indicate the number of shards of the target data, the server returns shard boundary information that meets the shard value requirements, thereby satisfying the user's personalized needs and improving the user experience.

[0017] In one possible example, if the number of shards indicated by the number of identifiers of all target data stored in the root node or its child nodes of the target self-balancing tree is greater than the shard value, then the server uses a portion of the values ​​of all the aforementioned target data identifiers as 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.

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

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

[0020] In one possible implementation, the server scans the target self-balancing tree corresponding to the target data and returns the sharding boundary information of the target data to the client. This includes: the server obtaining 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 identifiers of the target data stored in the root node is less than the number of shards of the target data, the server obtains the values ​​of the identifiers of the target data stored in the child nodes of the root node and returns these values ​​as the sharding boundary information of the target data to the client. Specifically, the number of shards indicated by the 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, the server returns the values ​​of the identifiers of the target data stored in the root node as the sharding boundary information of the target data to the client.

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

[0022] In one possible scenario, the child nodes of the root node can be the first-level child nodes (first child nodes), the second-level child nodes (second child nodes), and so on, until the number of target data identifiers stored in the Nth-level child node (Nth child node) indicates that the number of shards is greater than or equal to the number of target data shards. In other words, the server will scan the target self-balancing tree layer by layer until it reaches the aforementioned Nth child node, at which point the scanning stops.

[0023] In one possible scenario, the identifier for the aforementioned data is the primary key or index of the data.

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

[0025] In one possible implementation, the data reading method further includes: the client sending a first processing request to the server and receiving the fragmentation boundary information of the target data returned by the server. Based on the fragmentation boundary information of the target data, the client determines the boundaries of P fragments of the target data, then sends a second processing request to the server and receives the P fragments of the target data returned by the server.

[0026] In this application, through interaction between the client and the server, the client obtains the fragmentation boundary information of the target data, and then sends a second processing request to the server based on the boundaries of P fragments determined by the fragmentation boundary information of the target data. The client obtains the P fragments of the target data returned by the server, thereby enabling the client to quickly obtain the P fragments of the target data based on the fragmentation boundary information of the target data returned by the server, improving the efficiency of data reading.

[0027] In one possible scenario, the client displays P pieces of the target data on a front-end connected to the client. For example, the client displays the P pieces in pages on the front-end, with each page displaying the sub-data corresponding to one piece, thereby enabling data querying.

[0028] In another possible scenario, the client exports P shards of the target data, such as in Excel format. A sub-table in an Excel file contains sub-data corresponding to a shard, thus achieving data export.

[0029] In another possible scenario, the client sends P fragments of the target data to other servers, thereby achieving data copying, data migration, and data synchronization.

[0030] Secondly, this application provides a data reading device. This data reading device is applied to a computer system or to a computing device that supports the computer system in implementing a data reading method. For example, the computer system may be a data management system, and the computing device may be a storage device or a server. The data reading device includes modules for executing the data reading method in the first aspect or any optional implementation of the first aspect. The data reading device includes:

[0031] The first receiving module is used to receive a first processing request from the client, wherein the first processing request is used to indicate the fragment boundary information of the target data to be obtained, and the data includes the target data.

[0032] The scanning module, in response to the first processing request, scans the target self-balancing tree corresponding to the target data and returns the fragmentation boundary information of the target data to the client. The server stores data identifiers in the form of a self-balancing tree, which includes the target self-balancing tree. The fragmentation boundary information of the target data includes the value of the target data identifier stored in the root node or a child node of the target self-balancing tree.

[0033] The second receiving module is used to receive a second processing request from the client. The second processing request is used to instruct the acquisition of P fragments of the target data, the boundaries of the P fragments of the target data are determined based on the fragment boundary information of the target data, and P is a positive integer.

[0034] The return module is used to respond to the second processing request and return P fragments of the target data to the client in a fragmented manner.

[0035] In one possible scenario, the first processing request is a Structured Query Language (SQL) statement.

[0036] In one possible scenario, the SQL statement includes a specified field that defines the number of shards of the target data. This specified field can be a syntax field or a comment field of the SQL statement.

[0037] In one possible scenario, the first processing request carries a fragmentation value, which indicates the number of fragments of the target data. The number of fragments indicated by the number of identifiers of the target data included in the fragmentation boundary information of the target data is greater than or equal to the fragmentation value.

[0038] In one possible implementation, the scanning module is specifically used to obtain 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 identifiers of the target data stored in the root node is less than the number of shards of the target data, then the module obtains the values ​​of the identifiers of the target data stored in the child nodes of the root node and returns these values ​​as shard boundary information of the target data to the client. Specifically, the number of shards indicated by the 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, then the values ​​of the identifiers of the target data stored in the root node are returned as shard boundary information of the target data to the client.

[0039] In one possible scenario, the identifier for the data is the primary key or index.

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

[0041] In one possible implementation, the apparatus further includes a transceiver module. The transceiver module is configured to send a first processing request to the server and receive fragmentation boundary information of the target data returned by the server; determine the boundaries of P fragments of the target data based on the fragmentation boundary information of the target data; and send a second processing request to the server and receive P fragments of the target data returned by the server.

[0042] For more detailed implementation information regarding the data reading device, please refer to the description of the first aspect or any implementation thereof above, as well as the content of the specific implementation method below, which will not be repeated here.

[0043] Thirdly, this application provides a data management system. The data management system includes various devices for executing the data reading method in the first aspect or any optional implementation of the first aspect. The data management system stores identifiers of data, and the data identifiers are stored in a self-balancing tree format. The data management system includes a server and a client.

[0044] The server is used to receive a first processing request from the client, wherein the first processing request is used to indicate the fragment boundary information of the target data to be obtained, and the data includes the target data.

[0045] The server, in response to the first processing request, returns the fragmentation boundary information of the target data to the client by scanning the target self-balancing tree corresponding to the target data. The self-balancing tree includes the target self-balancing tree, and the fragmentation 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.

[0046] The server receives a second processing request from the client, which instructs the client to acquire P fragments of the target data. The boundaries of the P fragments of the target data are determined based on the fragment boundary information of the target data, and P is a positive integer.

[0047] The server responds to the second processing request by returning P fragments of the target data to the client in a fragmented manner.

[0048] In one possible implementation, the client is configured to send a first processing request to the server and receive fragmentation boundary information of the target data returned by the server. The client is also configured to determine the boundaries of P fragments of the target data based on the fragmentation boundary information, then send a second processing request to the server and receive the P fragments of the target data returned by the server.

[0049] For more detailed implementation information regarding the data management system, please refer to the description of the first aspect or any of the implementation methods in the first aspect above, as well as the content of the specific implementation methods below, which will not be repeated here.

[0050] Fourthly, this application provides a computing device. The computing device includes a memory and a processor, the memory storing instructions; the processor executing the instructions to implement the methods in the first aspect or any possible implementation of the first aspect. The computing device shown in this aspect can be a server as described in the first aspect.

[0051] Fifthly, this application provides a computer-readable storage medium. This storage medium stores a computer program or instructions that, when executed by a computing device, implement the method described in the first aspect or any of the optional implementations of the first aspect.

[0052] Sixthly, this application provides a computer program product. The computer program product includes a computer program or instructions that, when executed by a computing device, implement the method described in the first aspect or any of the optional implementations of the first aspect.

[0053] The beneficial effects of aspects two through six above can be referred to the description of aspect one or any implementation thereof, and will not be repeated here. Based on the implementations provided in the above aspects, this application can be further combined to provide more implementations. Attached Figure Description

[0054] Figure 1 A schematic diagram of the structure of a data management system provided in this application;

[0055] Figure 2 A scenario illustration provided for this application;

[0056] Figure 3 A flowchart illustrating a data reading method provided in this application;

[0057] Figure 4 A schematic diagram of a self-balancing tree provided in this application;

[0058] Figure 5 A flowchart illustrating a boundary information acquisition method provided in this application;

[0059] Figure 6 A schematic diagram of the structure of a data reading device provided in this application Figure 1 ;

[0060] Figure 7 A schematic diagram of the structure of a data reading device provided in this application Figure 2 ;

[0061] Figure 8 A schematic diagram of the structure of a computing device provided in this application;

[0062] Figure 9 This application provides a schematic diagram of the structure of a computing device cluster;

[0063] Figure 10 This is a schematic diagram of the connection between computing devices provided in this application. Detailed Implementation

[0064] To address the issue of low efficiency in retrieving data from a data storage system, this application provides a data retrieval method. This method is applied to a data management system that stores data identifiers in a self-balancing tree format. The data management system includes a server and a client. The data retrieval method includes: the server receiving a first processing request from the client indicating the acquisition of fragment boundary information for target data; responding to the first processing request by scanning the target self-balancing tree corresponding to the target data and returning the fragment boundary information of the target data to the client; and the server receiving a second processing request from the client indicating the acquisition of P fragments of the target data; responding to the second processing request by returning P fragments of the target data to the client in fragment form. Here, the data includes the target data, the self-balancing tree includes the target self-balancing tree, and the fragment boundary information of the target data includes the value of the target data identifier stored in the root node or a child node of the root node of the target self-balancing tree. The boundaries of the P fragments of the target data are determined based on the fragment boundary information of the target data, where P is a positive integer.

[0065] In this application, the server scans the target self-balancing tree corresponding to the target data, and then uses the values ​​of the target data identifiers stored in the root node or its child nodes as fragment boundary information. This speeds up the determination of the target data fragment boundary information, thereby improving the efficiency of reading the P fragments of the target data determined based on the fragment boundary information. Furthermore, since the identifiers are stored in a self-balancing tree format, the values ​​of the identifiers stored between nodes in the self-balancing tree are relatively balanced. That is, the sub-data of the target data indicated by the values ​​of each set of identifiers (each set of identifiers corresponds to a fragment boundary) in the target data are also relatively balanced. Therefore, when the server reads and returns the P fragments of the target data in parallel, the efficiency of data reading can be further improved.

[0066] The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. The technical terms involved in this application are described below.

[0067] A B-tree is a self-balancing search tree. The storage area of ​​a B-tree stores an ordered set of keys. A B-tree consists of multiple index nodes, which can be divided into at least two levels (e.g., a B-tree includes a root node at level 1, a first child node at level 2, and a second child node at level 3). Each index node stores multiple keys. When querying data in a B-tree, based on a given key, a binary search is performed level by level, starting from the top-level index node, until the bottom-level index node or a level that meets the specified conditions is found. The aforementioned conditions can be found in the section describing the relationship between the number of identifiers and the number of fragments of the target data, which will not be elaborated upon here.

[0068] The difference between a B+ tree and a B-tree is that in a B+ tree, all keys are stored only in the lowest-level index node, while the intermediate index nodes only store keys used for indexing.

[0069] The difference between a B* tree and a B+ tree is that in a B* tree, index nodes at the same level have pointers to other index nodes.

[0070] A self-balancing binary tree is a type of binary tree that automatically adjusts itself to maintain balance after each insertion or deletion operation. Balance is typically defined as ensuring the tree's height remains logarithmic, thus keeping the time complexity of basic operations such as insertion, deletion, and search at O(log n) level. Common self-balancing binary trees include AVL trees (Adelson-Velsky and Landis trees), splay trees, and red-black trees.

[0071] An index node is a physical unit of data storage. A B+Tree or B-Tree consists of multiple index nodes, such as the root node, first child node, second child node, etc., as mentioned above. Index nodes are also called index blocks or index pages, and their size is fixed, typically 8KB or 16KB.

[0072] The application scenarios of the above data reading method are explained below with reference to the accompanying drawings. For example... Figure 1 As shown, Figure 1 This is a schematic diagram of a data management system provided in this application. The data management system includes a client 110 and a server 120. Figure 1In the framework shown, users access data through applications. The computers running these applications can be referred to as "clients" or "hosts." Client 110 can be a physical machine or a virtual device. Physical machines include, but are not limited to, desktop computers, servers, laptops, and mobile devices; virtual devices include, but are not limited to, virtual machines (VMs) and containers. This data management system can also be referred to as a data storage system.

[0073] In one possible embodiment, the data management system is a database system, with client 110 and server 120 being the client and server of the database system, respectively. With the application of cloud computing technology, the database system can further be a cloud database system created based on cloud infrastructure, wherein server 120 is a cluster of computing devices deployed with database instances. The cluster of computing devices includes at least one computing device, and each computing device can be any of the following: a physical server, a virtual machine (VM), an elastic cloud server (ECS), or a container.

[0074] In one possible example, client 110 accesses server 120 via a network to access data; for example, the network may include switch 130.

[0075] In another possible example, client 110 may also communicate with server 120 via a wired connection, such as a Universal Serial Bus (USB) or a Peripheral Component Interconnect Express (PCIe) bus.

[0076] Figure 1 The server 120 shown can be a centralized storage system. A key feature of a centralized storage system is a unified entry point through which all data from external devices passes; this entry point is the engine 121 of the centralized storage system. The engine 121 is the core component of the centralized storage system, where many advanced functions are implemented. In one possible example, the server 120 may include one or more storage devices, each of which may include the engine 121 and the disk enclosure 122 described below.

[0077] like Figure 1 As shown, engine 121 may have one or more controllers. Figure 1The following example illustrates the concept of engine 121 containing one controller. In one possible example, if engine 121 has multiple controllers, any two controllers can have a mirroring channel, enabling any two controllers to serve as backups for each other, thereby preventing hardware failures from causing the entire server 120 to become unavailable. It should be understood that if engine 121 includes multiple controllers, then engine 121 can also be referred to as the array controller of server 120.

[0078] Engine 121 also includes a front-end interface 1211 and a back-end interface 1214. The front-end interface 1211 is used to communicate with client 110 to provide data access services to client 110. The back-end interface 1214 is used to communicate with hard drives to expand the capacity of server 120. Through the back-end interface 1214, engine 121 can connect to more hard drives, thus forming a very large storage resource pool.

[0079] In terms of hardware, such as Figure 1 As shown, the controller includes at least a processor 1212 and memory 1213. The processor 1212 is a central processing unit (CPU) used to process processing requests from outside the server 120 (client 110 or other servers), and also to process processing requests generated internally by the server 120. For example, when the processor 1212 receives a first or second processing request sent by the client 110 through the front-end interface 1211, it temporarily stores the data corresponding to these second processing requests in memory 1213. The processor 1212 reads data from at least one of the following hard drives: hard disk drive 1221, hard disk drive 1222, solid-state drive (SSD) 1223, or other hard disk drive 1224, and temporarily stores it in memory 1213. When the total amount of data in memory 1213 reaches a certain threshold, the processor 1212 sends the data stored in memory 1213 to the client 110 through the front-end interface 1211.

[0080] Memory 1213 refers to internal memory that directly exchanges data with the processor. It can read and write data at any time and at high speed, serving as temporary data storage for the operating system or other running programs. Memory includes at least two types of memory, such as random access memory (RAM) or read-only memory (ROM). For example, RAM can be dynamic random access memory (DRAM) or storage class memory (SCM). DRAM is a semiconductor memory and, like most random access memory (RAM), is a volatile memory device. However, DRAM and SCM are merely illustrative examples in this embodiment; memory can also include other types of RAM, such as static random access memory (SRAM). For read-only memory, examples include programmable read-only memory (PROM) and erasable programmable read-only memory (EPROM).

[0081] Additionally, memory 1213 can also be a dual in-line memory module (DIMM), i.e., a module composed of DRAM, or an SSD. In practical applications, the controller can be configured with multiple memory modules 1213, and different types of memory modules 1213. This embodiment does not limit the number or type of memory modules 1213. Furthermore, memory modules 1213 can be configured to have a power-saving function. The power-saving function means that when the system experiences a power outage and then power is restored, the data stored in memory modules 1213 will not be lost. Memory with a power-saving function is called non-volatile memory.

[0082] The memory 1213 stores a software program. The processor 1212 runs the software program in the memory 1213 to obtain the fragment boundary information of the acquired data, or to read the sub-data included in the fragment.

[0083] like Figure 1As shown, in this system, engine 121 may not have a hard drive slot; the hard drive needs to be placed in hard drive enclosure 122, and the back-end interface 1214 communicates with the hard drive enclosure 122. The back-end interface 1214 exists in the form of an adapter card within engine 121, and two or more back-end interfaces 1214 can be used simultaneously on one engine 121 to connect multiple hard drive enclosures. Alternatively, the adapter card can be integrated onto the motherboard, in which case the adapter card can communicate with processor 1212 via the PCIe bus.

[0084] It should be noted that, Figure 1 Only one engine 121 is shown in the figure. However, in actual applications, the storage system may contain two or more engines 121, and redundancy or load balancing may be performed between multiple engines 121.

[0085] The hard drive enclosure 122 includes a control unit 1225 and several hard drives. The control unit 1225 can have various forms. In one case, the hard drive enclosure 122 is a smart enclosure, such as... Figure 1 As shown, the control unit 1225 includes a CPU and memory. The CPU performs operations such as address translation and reading / writing data. The memory is used to temporarily store data to be written to the hard disk or to read data from the hard disk to be sent to the controller. Alternatively, the control unit 1225 may be a programmable electronic component, such as a data processing unit (DPU). A DPU has the versatility and programmability of a CPU, but is more specialized, capable of efficiently operating on network packets, storage requests, or analysis requests. A DPU differs from a CPU by its high degree of parallelism (the ability to handle a large number of requests). Optionally, the DPU can be replaced by a graphics processing unit (GPU), an embedded neural network processing unit (NPU), or other processing chips. Typically, there can be one, two, or more control units 1225. The functions of the control unit 1225 can be offloaded to the network interface card (NIC) 1226. In other words, in this embodiment, the hard disk enclosure 122 does not contain a control unit 1225; instead, the network interface card 1226 performs data reading and writing, data analysis (such as determining data fragmentation boundary information), and other computing functions. In this case, the network interface card 1226 is a smart network interface card. It can contain a CPU and memory. The CPU is used to perform data analysis and data reading and writing operations. The memory is used to temporarily store data to be written to the hard disk or to read data 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 hierarchical relationship between the network interface card 1226 and the hard disks in the hard disk enclosure 122; the network interface card 1226 can access any hard disk in the hard disk enclosure 122 (e.g., ...). Figure 1 The mechanical hard drive 1221, mechanical hard drive 1222, solid-state drive 1223 and other hard drives 1224 shown are examples of hard drives that make it easier to expand the hard drive when storage space is insufficient.

[0086] Depending on the type of communication protocol between engine 121 and disk enclosure 122, disk enclosure 122 may be a serially attached small computer system interface (SAS) disk enclosure, an NVMe (Non-Volatile Memory Express) disk enclosure, or other types of disk enclosures. SAS disk enclosures use the SAS 3.0 protocol, and each enclosure supports 25 SAS disks. Engine 121 connects to disk enclosure 122 via an onboard SAS interface or a SAS interface module. NVMe disk enclosures function more like a complete computer system, with NVMe disks inserted into them. NVMe disk enclosures then connect to engine 121 via an RDMA port.

[0087] In one alternative implementation, the server 120 is a centralized storage system integrating disk control and storage. The server 120 does not have the aforementioned hard disk enclosure 122, and the engine 121 is used to manage multiple hard drives connected through hard disk slots. The functionality of the hard disk slots can be implemented by the backend interface 1214.

[0088] In another alternative implementation, Figure 1 The server 120 shown 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 that can communicate with each other. The computing device can be a physical computing device, such as a server, desktop computer, or storage array controller. Hardware-wise, the computing device can include a processor, memory, and a network interface card (NIC). The processor is a CPU used to handle processing requests from outside the computing device or processing requests generated internally by the computing device. For example, when the processor receives a query data request from a user, it reads data from the storage device and temporarily stores the data in memory. When the total amount of data in memory reaches a certain threshold, the processor sends the data stored in memory to the user's device. In addition, the processor is also used for data computation or processing, such as metadata management, data fragmentation boundary information acquisition, data compression, decompression, virtualization of storage space, and address translation. In one example, any computing device can access any storage device in the storage device cluster via a network. The storage device cluster includes multiple storage devices. A storage device includes one or more controllers, a NIC, and multiple hard drives; the NIC is used to communicate with the computing device.

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

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

[0091] For example, the identifier for the above data could be an index.

[0092] When data is identified by an index, the lowest-level index node in a self-balancing tree can store identifiers of the data, such as primary keys, data storage addresses, and the data's position in the table.

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

[0094] When the data identifier is the primary key, the index node at the bottom level of the self-balancing tree can directly store the data.

[0095] The following examples illustrate scenarios where server 120 reads data. Figure 2 As shown, Figure 2 This is a schematic diagram of a scenario provided for this application.

[0096] In the first possible scenario, such as Figure 2 As shown in 'a', server 120 performs data querying or data export. For example, server 120 receives a processing request sent by client 110 and performs data fragmented querying or fragmented export.

[0097] In the second possible scenario, such as Figure 2 As shown in b, server 120 backs up / copies its stored data. For example, in response to a processing request sent by client 110, server 120 returns P fragments to client 110 in the form of fragments, so that client 110 backs up / copies the aforementioned P fragments to other servers. Alternatively, server 120 periodically backs up / copies data fragments to other servers through client 110.

[0098] In one possible scenario, server 120 can back up / copy data to other servers in fragments, so that other servers can still provide storage services in the event of a failure of server 120.

[0099] In another possible scenario, server 120 is used to provide transactional services, while other servers can be used to provide analytical services. After the data in server 120 is sharded and backed up to other data management services, the other servers can provide analytical services based on the data.

[0100] In the third possible scenario, such as Figure 2 As shown in c, server 120 migrates or synchronizes the data it stores. For example, server 120 receives a processing request from client 110 (e.g., client 110 has a data management tool (such as a data migration tool / data synchronization tool) deployed on it). In response to the processing request, server 120 returns P fragments to client 110 in the form of fragments. Client 110 then sends the aforementioned P fragments to other servers, thereby realizing the migration or synchronization of data in server 120 to other servers.

[0101] In one possible scenario, server 120 and other servers belong to different storage service providers. Data migration or synchronization across service providers can be achieved through data management tools (data migration tools / data synchronization tools) deployed on client 110.

[0102] Regarding the above Figure 2 The following describes a data reading method applicable to the scenario illustrated. Figure 3 As shown, Figure 3 This is a flowchart illustrating a data reading method provided in this application. Figure 3 The method shown can be applied to Figure 1 The data management system shown in this embodiment is illustrated using server 120 as an example. Server 120 stores data identifiers, which are stored in a self-balancing tree format. Please refer to... Figure 3 The data reading method provided in this embodiment includes the following steps S310-S340.

[0103] S310, server 120 receives the first processing request from client 110.

[0104] The first processing request is used to instruct the shard boundary information of the target data to be retrieved. The target data is data in server 120. Specifically, the data stored in server 120 includes one or more shards, and a shard includes a set of sub-data in the target data.

[0105] In one possible scenario, the first processing request is SQL statement a. This SQL statement a is used to instruct the retrieval of fragment boundary information for the target data in server 120.

[0106] In one possible example, the target data mentioned above is the target data table in multiple data tables stored on server 120.

[0107] In one possible example, SQL statement a includes a specified field that defines the number of shards for the target data, i.e., the number of shards the user requires for the target data.

[0108] For example, the specified field is "SPLIT_CHUNK".

[0109] In one possible example, SQL statement a also includes a shard value, which indicates the number of shards of the target data.

[0110] For example, the above shard value is chunk_num.

[0111] For the SQL statement a above, two possible examples are shown below.

[0112] Example 1: The specified fields are syntax fields for SQL statement 'a', and the specified fields and chunked values ​​are located in the body of the SQL statement. For example, SQL statement 'a' is "SELECT col0, col1, ..., colk FROM table WHERE SPLIT_CHUNK(chunk_num)", where "col0, col1, ..., colk" are used to indicate the identifiers of the target data. When the identifier of the data is the primary key, "col0, col1, ..., colk" are the column identifiers where the primary key is located.

[0113] The SQL statement 'a' in this method needs to be supported by both the client 110 and the server 120. That is, the SQL statement parser deployed in the server 120 must be able to recognize the newly added syntax field "SPLIT_CHUNK(chunk_num)", and the client 110 must be able to send SQL statements containing the syntax field "SPLIT_CHUNK(chunk_num)" to the server 120.

[0114] Example 2: The specified field is a comment field for SQL statement 'a', and the specified field and the chunk 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.

[0115] In this method, the SQL statement 'a' needs to be supported by the server 120. The client does not need to make any modifications; it only needs to support 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 its meaning.

[0116] In other possible embodiments, the first processing request may also be in the form of a request other than an SQL statement, but it also carries a fragment value indicating the number of fragments of the target data, which is not limited in this application.

[0117] In one possible implementation, server 120 receives a first processing request from client 110, including: client 110 has an SQL client deployed, the SQL client can receive SQL statement a input by the user, and then send SQL statement a to server 120 where the database is deployed.

[0118] For example, the SQL clients mentioned above provide an interface for interacting with the database, allowing users to perform SQL queries, manage the database, and process data. SQL clients may include RazorSQL, SQuirreL SQL, SQLyog, etc.

[0119] In another possible implementation, a business application is deployed in the client 110. The business application receives keywords input by the user. The client 110 parses the identity tag of the target data based on the keywords, and then generates SQL statement a based on the identity tag of the target data and the number of fragments of the target data required, and sends SQL statement a to the server 120.

[0120] For example, the keywords mentioned above may include one or more of the following: the name of the target data, the identity document (ID), the shard value, or the name or ID of a sub-data item within the target data. Typically, the identity label of the target data can be a table ID.

[0121] In another possible implementation, server 120 receives a first processing request from client 110, including: server 120 receiving a first processing request from a data management tool deployed on client 110.

[0122] In one possible example, the data management tool could be a data migration tool or a data synchronization tool, etc.

[0123] In one possible example, server 120 receives a first processing request sent by the data management tool, including: the data management tool generates SQL statement a based on the identity tag of the target data input by the user and the number of fragments of the target data required, and sends SQL statement a to server 120.

[0124] In response to the first processing request, S320 and server 120 return the fragmentation boundary information of the target data to client 110 by scanning the target self-balancing tree corresponding to the target data.

[0125] The target data fragmentation boundary information includes the value of the target data identifier stored in the root node or child nodes of the target self-balancing tree. At least one self-balancing tree stored in the server 120 includes the target self-balancing tree.

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

[0127] like Figure 4 As shown, Figure 4 This is a schematic diagram of a self-balancing tree provided in this application. Figure 4 The self-balancing tree shown is a B+Tree, which has a three-layer structure: the root node in the first layer, the first child node in the second layer, and the second child node in the third layer.

[0128] In one possible scenario, if the identifier stored in the root node and the first child node is an index, then the data stored in the second child node is the primary key of the data table. The server 120 can then determine the corresponding column or row of data in the data table based on this primary key.

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

[0130] It is worth noting that, Figure 4 The self-balancing tree provided is only illustrated using a B+Tree as an example, where the B+Tree includes a three-layer structure. In other embodiments of this application, the self-balancing tree may include more or fewer layers, or the self-balancing tree may also be a B-Tree, B*Tree, self-balancing binary tree, etc., which will not be elaborated here.

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

[0132] In one possible implementation, in response to the first processing request, the server 120 returns the sharding boundary information of the target data to the client by scanning the target self-balancing tree corresponding to the target data. This includes: the server 120 scanning the target self-balancing tree corresponding to its stored data table and using 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 sharding boundary information.

[0133] For example, the server 120 scans the target self-balancing tree from top to bottom, layer by layer. If 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, then it only reads the value of the target data identifiers stored in the root node and returns the value of the target data identifiers in the root node as the fragment boundary information of the target data to the client 110.

[0134] If the number of target data identifiers stored in the root node indicates a number of shards less than the number of target data shards, then the identifiers of the target data in the first child node are read further, until the number of target data identifiers in the nth child node indicates a number of shards greater than or equal to the number of target data shards. Then, the value of the target data identifiers in the nth child node is returned to the client 110 as the shard boundary information of the target data. Therefore, this 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, where n is a positive integer.

[0135] In one possible example, the number of fragments indicated by the number of identifiers of the target data is the number of identifiers of the target data + 1. For example, in Figure 4 In the diagram, the root node stores three identifiers: 14, 20, and 25. Using these identifiers as boundaries, the target data can be divided into four shards, S1-S4. Shard S1 includes target data with primary key / index values ​​in the range (-∞, 14); shard S2 includes target data with primary key / index values ​​in the range [14, 20); shard S3 includes target data with primary key / index values ​​in the range [20, 25); and shard S4 includes target data with primary key / index values ​​in the range [25, +∞). In other words, Figure 4 The number of identifiers for the target data stored in the root node indicates the number of shards, which is 4.

[0136] The following example uses the identifier of the target data stored in the root node by the server-side 120 scan as an example, providing two possible examples.

[0137] Example 1: If the number of target data identifiers stored in the root node indicates the number of shards, which is greater than the number of target data shards, then the target data shard boundary information 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.

[0138] For example, server 120 uses the identifier values ​​of all target data in the root node as the fragmentation boundary information for the target data. In this implementation, after receiving the fragmentation boundary information, the client can further select a portion of the identifier values ​​from the fragmentation boundary information as the boundary line to determine the number of fragments equal to the user's required number. Figure 4 Taking the target self-balancing tree as an example, when the number of target data fragments required by the user in the first processing request is 3, since the number of fragments indicated by the number of identifiers stored in the root node of the target self-balancing tree is 4, which can meet the number of target data fragments required by the user, the server 120 can return all three identifiers 14, 20, and 25 stored in the root node as fragment boundary information to the client 110. After receiving the fragment boundary information, the client 110 further selects to divide the target data into three data fragments (-∞, 14), [14, 25), and [25, +∞) based on the values ​​of the two identifiers 14 and 25.

[0139] For example, server 120, based on the number of target data shards required by the user, selects a portion of the target data identifier values ​​from all target data identifier values ​​in the root node as the target data shard boundary information. This ensures that the number of shards indicated by the number of target data identifiers included in the aforementioned target data shard boundary information equals the total number of target data shards. Figure 4 Taking the target self-balancing tree as an example, when the number of target data fragments required by the user in the first processing request is 3, since the number of fragments indicated by the number of identifiers stored in the root node of the target self-balancing tree is 4, which exceeds the number of target data fragments required by the user, the server 120 can choose 2 identifiers in the root node as fragment boundary information to be returned to the client 110. For example, the returned fragment boundary information includes 14 and 20, or includes 14 and 25, or includes 20 and 25.

[0140] It is worth noting that, in Example 1 above, the selection of a portion of the target data's identifier values ​​from all the target data's identifier values ​​is not limited by the specific selection method in this application.

[0141] Example 2: If the number of target data identifiers stored in the root node indicates the number of shards, which is equal to the number of target data shards, then the server 120 will use the values ​​of all target data identifiers in the root node as the shard boundary information of the target data.

[0142] It is worth noting that the above examples are only used to illustrate the case where 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. In other embodiments, the number of shards indicated by the number of identifiers of the target data stored in the nth child node may be greater than or equal to the number of shards of the target data. For the content of using the value of the identifier of the target data stored in the nth child node as the shard boundary information of the target data, please refer to the descriptions in the two examples above, and will not be repeated here.

[0143] S330, server 120 receives a second processing request from client 110.

[0144] The second processing request is used to instruct the acquisition of P fragments of the target data. The boundaries of the P fragments of the target data are determined based on the fragment boundary information of the target data, where P is a positive integer.

[0145] In one possible example, the second processing request mentioned above is SQL statement b.

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

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

[0148] For example, the business application in client 110 receives keywords input by the user, generates SQL statement b based on the keywords, and sends SQL statement b to server 120. These keywords could be the sharding boundary information of the target data mentioned above, or the boundaries of P shards.

[0149] In other possible embodiments, when a user wants to obtain target data by fragment, the user will input an interactive command on the client 110 indicating the information required to obtain the target data by fragment. Then, in response to the interactive command, the client 110 first sends a first processing request to the server 120 according to the interactive command, and after receiving the fragment boundary information returned by the server 120, it continues to send a second processing request to the server 120 according to the interactive command.

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

[0151] Regarding the relationship between the boundaries of the P fragments of the target data and the fragment boundary information of the target data, the following provides two possible examples.

[0152] Example 1: If the number of fragments indicated by the number of identifiers of the target data included in the fragment boundary information of the target data is greater than the number of P fragments of the target data required in the second processing request, then the value included in the boundary of the P fragments of the target data is a portion of the value of the identifiers of the target data included in the fragment boundary information.

[0153] In other words, after obtaining the fragmentation boundary information of the target data, the client 110 filters or merges the values ​​of the target data identifiers included in the fragmentation boundary information of the target data to obtain the boundaries of P fragments, and generates SQL statement b based on the boundaries of the P fragments.

[0154] For example, the sharding boundary information of the target data includes: 14, 20, 25. To meet the user's requirement for the number of shards of the target data (i.e., P = 3), client 110 filters or merges 14, 20, and 25 to obtain three sharding boundaries including: 14 and 25. The ranges of the three shards are (-∞, 14), [14, 25), and [25, +∞), respectively.

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

[0156] Example 2: If the number of fragments indicated by the number of identifiers of the target data included in the fragment boundary information of the target data is equal to the number of fragments of the target data, then the value included in the boundary of the P fragments of the target data is all the values ​​of the identifiers of the target data included in the fragment boundary information.

[0157] In other words, after obtaining the fragmentation boundary information of the target data, the client 110 uses the value of the target data identifier included in the fragmentation boundary information of the target data as the boundary of P fragments, and generates a second processing request based on the boundary of P fragments.

[0158] For example, the target data's partition boundary information includes: 14, 20, 25. To meet the user's requirement for the number of partitions of the target data (i.e., P = 4), client 110 uses the aforementioned partition boundary information of the target data as the boundaries of 4 partitions, which include: 14, 20, 25. The ranges of the 4 partitions are (-∞, 14), [14, 20), [20, 25), and [25, +∞), respectively.

[0159] For example, after receiving the fragmentation boundary information of the target data, client 110 displays the fragmentation boundary information of the target data on the front end connected to client 110, and receives the boundaries of the four fragments input by the user. For example: 14, 20, 25 or (-∞, 14), [14, 20), [20, 25), [25, +∞). Alternatively, client 110 receives SQL statement b input by the user, which contains the boundaries of the four fragments.

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

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

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

[0163] In a possible example, the server 120 reads the sub-data included in each of the P shards of the target data from the hard disk into the memory in the form of shards.

[0164] Exemplarily, the second processing request may include multiple SQL statements b, and one SQL statement b corresponds to obtaining the sub-data included in one shard. Furthermore, the server 120 executes multiple SQL statements b in parallel to simultaneously obtain the sub-data included in multiple shards, and returns P shards of the target data to the client 110 in the form of shards, thereby improving the data reading efficiency of the server 120 and the shard obtaining efficiency of the client 110.

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

[0166] 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 above query statement and send it to the client 110.

[0167] Exemplarily, the server 120 reads the data in the target data table on 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 all the data in the target data table whose primary key is between row[i] and row[i+1] is read into the memory, the server then sends the data stored in the memory to the client 110.

[0168] In a possible example, the second processing request includes the boundaries of P shards, that is, the server 120 receives multiple query statements. Multiple threads in the server 120 process multiple query statements, and one thread processes one query statement, so as to achieve multi-threaded parallel query of different shards in the target data table and improve the query efficiency.

[0169] It should be noted that the difference between the data export scenario and the data query scenario is only that in the data export scenario, the server 120 exports the queried data. For example, the server 120 exports the queried data as an excel file, that is, the client receives the excel file, and the content shown in a sub-table in the excel file is the sub-data included in one shard.

[0170] It should be noted that Figure 3 The content shown is the description in the data query scenario. In scenarios such as data copy, data migration, and data synchronization, further processing will be carried out based on Figure 3 the content shown. For example, the client 110 will also perform data processing operations (such as forwarding) on the P shards of the target data.

[0171] The following will elaborate on the content of the data copy and data migration scenarios.

[0172] In the data copy scenario, the above 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 the table for storing the copied data.

[0173] The server 120 can query the data in the target data table whose primary key is between row[i] and row[i+1] according to the above copy statement, and copy the aforementioned data to Employees_Copy. The structure of Employees_Copy is the same as that of the target data table.

[0174] Exemplarily, the server 120 reads the data in the target data table on 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 all the data in the target data table whose primary key is between row[i] and row[i+1] is read into the memory, the data stored in the memory is then copied to Employees_Copy.

[0175] In a possible scenario, the above-mentioned target data table and Employees_Copy may be on the same server.

[0176] In another possible scenario, the above-mentioned target data table and Employees_Copy are not on the same server. In this scenario, the server or database where the table is located can also be added before the table names (Employees_Copy, table) in the above copy statement. 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.

[0177] Among them, when the above data table and Employees_Copy are not on the same server 120, the sharding of the target data table can be forwarded by the client 110. That is, after the client 110 receives P shards of the target data, it forwards the P shards of the target data to the server where Employees_Copy is located in parallel.

[0178] It should be noted 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, the content of the above data copy scenario can be referred to and will not be elaborated here.

[0179] In the data migration scenario, the above 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 the table for storing the migrated data.

[0180] Server 120 can use the above copy statement to query the data in the target data table whose primary key is between row[i] and row[i+1], and migrate the aforementioned data to Employees_Archive. After the data migration is complete, delete the data in the table whose primary key is between row[i] and row[i+1].

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

[0182] Regarding the content of S320 described above, the following is a possible embodiment. For example... Figure 5 As shown, Figure 5 This is a flowchart illustrating a method for obtaining fragmentation boundary information provided in this application. The first processing request mentioned above carries a flag for target data, which can be the aforementioned target data table. Figure 5 The content shown includes the following steps S510-S530.

[0183] S510 and server 120 determine the target self-balancing tree corresponding to the target data's label from the mapping relationship between the target data's label and the self-balancing tree.

[0184] The above mapping relationship is maintained in server 120. The identifier of the target data can be the table name or ID of the target data table, etc.

[0185] 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 identifier of the target data.

[0186] In one possible implementation, the server 120 determines the target self-balancing tree corresponding to the flag of the target data from the above mapping relationship.

[0187] S520 and server 120 obtain the value of the identifier of the target data stored in the root node or child node of the target self-balancing tree.

[0188] In one possible implementation, server 120 scans the target self-balancing tree from top to bottom until the number of shards indicated by the number of identifiers of the target data stored in the root node or child nodes (first child node, second child node, ..., nth child node) is greater than or equal to the shard value in the first processing request, then obtains the value of the identifier of the target data stored in the root node or child nodes.

[0189] In one possible example, server 120 retrieves the identifier of the target data stored in the root node of the target self-balancing tree. For example... Figure 4 As shown, server 120 obtains the identifiers of the target data stored in the root node: 14, 20, 25.

[0190] If the above shard value is 5, then the number of shards indicated by the number of identifiers of the target data stored in the root node (e.g., 4) is less than the number of shards of the target data required by the user. Then the server 120 obtains the value of the identifier of the target data stored in the child node.

[0191] The number of identifiers of the target data stored in the first child node indicates that the number of shards is greater than or equal to the number of shards of the target data required by the user.

[0192] For example, the number of identifiers of the target data obtained by server 120 from the first child node indicates the number of shards, which is equal to the number of shards of the target data required by the user. Figure 4 As shown, since the data in each node of the target self-balancing tree is arranged sequentially, the server 120 can start from the leftmost index node of the first child node and read the identifiers of the target data in the index nodes sequentially until the number of identifiers of the target data read is the fragment value minus 1, thereby realizing the value of the aforementioned target data identifier. For example, the server 120 reads the target data identifier values ​​as 5, 8, 14, and 17.

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

[0194] The number of identifiers for the target data indicates the number of fragments, which is the number of identifiers for the target data plus 1.

[0195] If the above shard value is 3, then 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 target data shards required by the user. The server 120 only needs to scan the root node to obtain the value of the target data identifier stored in the root node.

[0196] For example, the number of identifiers of the target data obtained by server 120 from the root node indicates the number of shards, which is equal to the number of shards of the target data required by the user. Figure 4 As shown, since the data in each node of the target self-balancing tree is arranged sequentially, the server 120 can sequentially read the identifiers of the target data in the root node starting from the leftmost node until the number of identifiers of the target data read is equal to the fragment value minus 1, thereby realizing the value of the aforementioned target data identifier. For example, the server 120 reads the target data identifier values ​​as 14 and 20.

[0197] For example, if the number of identifiers indicating the target data obtained by server 120 from the root node indicates that the number of shards is greater than the number of target data shards required by the user, server 120 directly reads the value of the identifiers storing the target data in the root node.

[0198] It is worth noting that the above description only uses the example of the server 120 reading the identifier of the target data starting from the leftmost position of the root node or the first child node. In other embodiments of this application, the server 120 may also read the identifier of the target data starting from the rightmost position of the root node or the first child node or a random position, which will not be elaborated here.

[0199] S530 and server 120 return the identifier of the target data read above as fragment boundary information to client 110.

[0200] In one possible example, if the number of identifiers of the target data read above indicates the number of fragments equal to the number of fragments of the target data, then the server 120 will use all the identifiers of the aforementioned target data as fragment boundary information and return them to the client 110.

[0201] In another possible example, if the number of identifiers of the target data read above indicates the number of fragments greater than the number of fragments of the target data, then the server 120 will use all the identifiers of the aforementioned target data as fragment boundary information and return them to the client 110.

[0202] In another possible example, if the number of fragments indicated by the number of identifiers of the target data read above is greater than the number of fragments of the target data, then the server 120 uses a portion of the identifiers of the aforementioned target data as fragment boundary information and returns it to the client 110. This ensures that the number of fragments indicated by the number of identifiers of the target data included in the fragment boundary information is equal to the number of fragments of the target data.

[0203] It is worth noting that the above description only uses a two-layer structure in the target self-balancing tree as an example. In other embodiments of this application, the target self-balancing tree may also include more layers (such as...). Figure 4In a three-layer structure, if the number of target data identifiers stored in the first child node indicates that the number of shards is still less than the number of target data shards required by the user, then the server 120 can also read the value of the target data identifier stored in the next layer node (second child node) of the first child node. For the content of the target data identifier value read by the server 120 in the second child node, refer to the above description of the target data identifier value read by the server 120 in the first child node, which will not be repeated here.

[0204] Therefore, during the process of scanning the target self-balancing tree layer by layer, if 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 fragments of target data required by the user, then the nth child node is a child node of the root node.

[0205] Regarding the above Figure 3 The following provides a complete embodiment, as shown in the illustration. This complete embodiment includes the following steps ①-⑥.

[0206] Step 1: Server 120 receives the first processing request sent by client 110.

[0207] The first processing request may be an SQL statement a, which carries the identifier of the target data table and the sharding value.

[0208] In one possible example, the SQL statement 'a' above may also include one or more primary keys or indexes in the target data table.

[0209] For details on step ①, please refer to the above. Figure 3 The contents shown in S310 will not be repeated here.

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

[0211] The specific steps the parser and optimizer take when processing SQL statement 'a' are described in detail here, referring to conventional techniques in this field.

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

[0213] Step 4: Server 120 sends fragmentation boundary information to client 110.

[0214] Step 5: Server 120 receives the second processing request sent by client 110.

[0215] Step 6: In response to the second processing request, server 120 returns P fragments of the target data to client 110 in the form of fragments.

[0216] For details regarding steps ③ through ⑥ above, please refer to the above. Figure 5 The specific wording is omitted here.

[0217] It is worth noting that the above explanations all use a complete data table as an example. In one possible scenario, the server 120 can also shard the partitioned table, which is a partition of the aforementioned data table, i.e., a subset of the aforementioned data table. For example, the SQL statement for sharding the partitioned table could be: SELECT col0,col1,...,colk FROM tablePARTITION(p_20240620) WHERE SPLIT_CHUNK(chunk_num), where tablePARTITION(p_20240620) represents the identifier of the partitioned table, such as p_20240620. The processing of the above SQL statement by the server 120 can be found in the above description. Figures 3-5 The content shown will not be repeated here.

[0218] In other embodiments of this application, the first processing request is SQL statement c. This SQL statement c instructs the server 120 to obtain sharding boundary information from a system table or a temporary table.

[0219] System tables are internal tables on server 120 used to store system-level metadata and configuration information. These tables typically contain data about database structure, objects, permissions, statistics, data sharding boundaries, etc. Temporary tables are tables on server 120 used to store temporary data. Temporary tables can be used to represent data sharding boundary information, especially when this information needs to be dynamically calculated or temporarily stored. For example, server 120 periodically (e.g., every hour) scans the self-balancing tree corresponding to the data table in the background, obtains the value of the identifier of the target data stored in the root node and / or the child nodes of the root node in the self-balancing tree, and stores the aforementioned target data identifier value into the aforementioned system table or temporary table.

[0220] Then, the server 120 obtains the value of the target data identifier from the aforementioned system table or temporary table through SQL statement c, and returns the value of the target data identifier as the sharding boundary information to the client 110.

[0221] For the subsequent content of this embodiment, please refer to the above. Figure 3 The descriptions of S330 and S340 will not be repeated here.

[0222] It is understood that, in order to implement the functions in the above embodiments, the server includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and method steps of the various examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution. The above-described embodiments... Figures 3 to 5 The data reading method provided in this embodiment is described in detail below. Figure 6 This describes the data reading device provided according to this embodiment.

[0223] Figure 6 A schematic diagram of the structure of a data reading device provided in this application Figure 1 This data reading device can be used to implement the functions of the server 120 in the above method embodiments, and therefore can also achieve the beneficial effects of the above method embodiments. In this embodiment, the data reading device 600 can be a module (such as a chip) of the server 120.

[0224] like Figure 6 As shown, the data reading device 600 includes a first receiving module 610, a scanning module 620, a second receiving module 630, and a return module 640. The data reading device 600 is used to implement the above-mentioned... Figure 3 , Figure 5 The method embodiment shown illustrates the function of the server 120. In one possible example, the data reading device 600 implements the above-described data reading method through the following specific processes:

[0225] The first receiving module 610 is used to receive a first processing request from the client, wherein the first processing request is used to indicate the fragmentation boundary information of the target data to be obtained, and the data includes the target data.

[0226] The scanning module 620 is used to respond to the first processing request, scan the target self-balancing tree corresponding to the target data, and return the fragmentation boundary information of the target data to the client; wherein, the server stores the identifier of the data, and the data identifier 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 fragmentation 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.

[0227] The second receiving module 630 is used to receive a second processing request from the client. The second processing request is used to instruct the acquisition of P fragments of the target data, wherein the boundaries of the P fragments of the target data are determined based on the fragment boundary information of the target data, and P is a positive integer.

[0228] Return module 640 is used to respond to the second processing request and return P fragments of the target data to the client in a fragmented manner.

[0229] To further achieve the above Figure 3 , Figure 5 The method embodiments shown in the illustration demonstrate functionality. This application also provides a data reading device, such as... Figure 7 As shown, Figure 7 A schematic diagram of the structure of a data reading device provided in this application Figure 2 The data reading device 600 also includes a transceiver module 650.

[0230] The transceiver module 650 is used to send a first processing request to the server and receive the fragmentation boundary information of the target data returned by the server; determine the boundaries of P fragments of the target data according to the fragmentation boundary information of the target data; and send a second processing request to the server and receive the P fragments of the target data returned by the server.

[0231] It should be noted that, in other embodiments, the first receiving module 610, the scanning module 620, the second receiving module 630, and the return module 640 can all execute 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 return module 640 can be specified as needed. By implementing different steps in the data reading method through the first receiving module 610, the scanning module 620, the second receiving module 630, and the return module 640, all functions of the data reading device 600 can be achieved.

[0232] It is worth noting that the server 120 according to the embodiments of this application can correspond to the data reading device 600 in the embodiments of the application, and can correspond to the execution of the method according to the embodiments of this application. Figure 3 , Figure 5 The corresponding main body, and the operation and / or function of each module in the data reading device 600 are respectively for the purpose of implementing the corresponding main body. Figure 3 , Figure 5 The corresponding processes of each method in the corresponding embodiments are not described in detail here for the sake of brevity.

[0233] When the data reading device 600 implements any of the data reading methods shown in the foregoing figures through software, the data reading device 600 and its various units can also be software modules. The data reading method described above is implemented by the processor calling the software module. The processor can be a CPU, an ASIC, or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), a field programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0234] A more detailed description of the data reading device 600 described above can be found in the relevant descriptions of the embodiments shown in the foregoing figures, and will not be repeated here. It is understood that the data reading device 600 shown in the foregoing figures is merely an example provided in this embodiment. Depending on the application scenario, the data reading device 600 may include more or fewer units, and this application does not limit it in this regard.

[0235] When the data reading device 600 is implemented in hardware, the hardware can be implemented by a processor or a chip. The chip includes interface circuitry and control circuitry. The interface circuitry is used to receive processing requests from other devices besides the processor and transmit them to the control circuitry, or to send data from the control circuitry (such as fragmentation boundary information, fragments of target data) to other devices besides the processor.

[0236] The control circuit and interface circuit are used, through logic circuits or executable code instructions, to implement any of the possible implementation methods in the above embodiments. The beneficial effects can be found in the descriptions of any aspect of the above embodiments, and will not be repeated here.

[0237] It is understood that the processor in the embodiments of this application may be a CPU, NPU, or GPU, or other general-purpose processors, digital signal processors (DSPs), ASICs, FPGAs, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.

[0238] in addition, Figure 6 , Figure 7 The data reading device 600 shown can also be implemented through a server, such as... Figure 1 The server 120 shown may be a data management system including the server 120.

[0239] The method steps in the embodiments of this application can also be implemented by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in RAM, flash memory, ROM, PROM, EPROM, electrically erasable programmable read-only memory (EEPROM), registers, hard disk, portable hard disk, CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Additionally, the ASIC can reside in a communication device. Alternatively, the processor and storage medium can exist as discrete components in the communication device. This application also provides a chip system including a processor for implementing the functions of the storage device in the above methods. In one possible design, the chip system further includes a memory for storing program instructions and / or data. The chip system can be composed of chips or can include chips and other discrete devices.

[0240] This application also provides a computing device, please refer to... Figure 8 , Figure 8 This application provides a schematic diagram of the structure of a computing device. The computing device 800 includes a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, memory 806, and communication interface 808 are interconnected via the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 800. For example, the computing device 800 can be the aforementioned server 120.

[0241] The 802 bus can be a PCIe bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 8 The bus 802 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 802 may include a path for transmitting information between various components of the computing device 800 (e.g., processor 804, memory 806, communication interface 808).

[0242] Processor 804 may include any one or more processors such as CPU, GPU, FPGA, microprocessor (MP) or DSP.

[0243] Memory 806 may include volatile memory, such as RAM. Processor 804 may also include non-volatile memory, such as ROM, flash memory, HDD, or SSD.

[0244] The memory 806 stores executable program code, and the processor 804 executes this executable program code to implement the functions of the aforementioned first receiving module 610, scanning module 620, second receiving module 630, and return module 640, thereby realizing the data reading method. That is, the memory 806 stores instructions for executing the data reading method.

[0245] The communication interface 808 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable 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, a computer in an edge data center, or a terminal.

[0246] This application also provides 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 terminal device such as a desktop computer, a laptop computer, or a smartphone. For example, the computing device cluster can be the aforementioned server 120.

[0247] like Figure 9 As shown, Figure 9 This application provides a schematic diagram of a computing device cluster. The computing device cluster includes at least one computing device 800. The memory 806 of one or more computing devices 800 in the computing device cluster may store the same instructions for executing data reading methods.

[0248] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the data reading method. In other words, a combination of one or more computing devices 800 can jointly execute the instructions for executing the data reading method.

[0249] It should be noted that the memory 806 in different computing devices 800 within the computing device cluster can store different instructions, each used to execute a portion of the data reading method's functions. That is, the instructions stored in the memory 806 of different computing devices 800 can implement the functions of one or more modules among the first receiving module 610, the scanning module 620, the second receiving module 630, and the return module 640.

[0250] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN). Figure 10 One possible implementation is shown. For example... Figure 10 As shown, Figure 10 This application provides a schematic diagram of a connection between computing devices, where two computing devices 800A and 800B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this possible implementation, the memory 806 in computing device 800A stores instructions for executing the functions of the first receiving module 610 and the second receiving module 630. Simultaneously, the memory 806 in computing device 800B stores instructions for executing the functions of the scanning module 620 and the return module 640.

[0251] It should be understood that Figure 10 The functions of the computing device 800A shown can also be performed by multiple computing devices 800. Similarly, the functions of the computing device 800B can also be performed by multiple computing devices 800.

[0252] This application also provides a computer program product containing instructions. This computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the aforementioned data reading method.

[0253] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform a data reading method.

[0254] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a DVD; or it can be a semiconductor medium, such as an SSD.

[0255] In the various embodiments of this application, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments are consistent and can be referenced mutually. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships. The various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers does not imply the order of execution; the execution order of each process should be determined by its function 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.