Data query method and database system
Patent Information
- Application Number
- PCT/CN2026/086225
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-04-15
- Filing Date
- 2026-03-26
- Publication Date
- 2026-10-22
Smart Images

Figure CN2026086225_22102026_PF_FP_ABST
Abstract
Description
A data query method and database system
[0001] This application claims priority to Chinese Patent Application No. 202510472451.3, filed on April 15, 2025, entitled "A Data Query Method and Database System", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of database technology, specifically to a data query method and a database system. Background Technology
[0003] In the scenario of paginated data query in a database, the query in this embodiment can be used to indicate the data in the dataset that is sorted according to certain rules and whose sorting position is within a certain range. For example, the dataset may include multiple rows of data (or multiple columns of data; for ease of description, rows are used as an example here), and the query can be used to indicate the search for data whose sorting position is within a certain range after sorting multiple rows of data according to the numerical value of a certain column.
[0004] Since the dataset is distributed across multiple different data nodes (DNs), and the query requires selecting data from the sorted results of the global data, existing technologies first aggregate the data from the DNs to a coordinator node (CN). The CN then sorts the aggregated data and selects data from the sorted results to complete the query task. Because the CN needs to sort a large amount of data, this results in significant computational overhead and query latency. Summary of the Invention
[0005] Firstly, this application provides a data query method applied to a database system, the database system including multiple data nodes (DNs). The method includes: obtaining a query; the query indicating the search for a first subset of the dataset, the first subset being a subset whose sorted position is within a first sorting range after sorting the data in the dataset according to their numerical values; the dataset being distributed across the multiple DNs; based on the query and the numerical distribution of the data in the dataset, aggregating the data in the dataset whose numerical values are within the first numerical range onto a first DN of the multiple DNs; the numerical values of the subset whose sorted position is within the first sorting range are within the first numerical range, the first numerical range being a sub-data range of the numerical range of the data in the dataset; and sorting the data whose numerical values are within the first numerical range using the first DN to determine the first subset.
[0006] The approach of this embodiment is as follows: First, the distribution of data values in the dataset (distributed across multiple Data Nodes) is obtained. This data value distribution describes the magnitude relationship of the data values in the dataset. Then, based on the magnitude distribution, it is determined which sub-data range (first magnitude range) of the overall magnitude distribution of the dataset the value of the data indicated in the query (i.e., the subset of the dataset whose sorting position is within the first sorting range) falls within. Data within this range constitutes a portion of the dataset's data volume and includes the data indicated in the query. Next, the data whose magnitude falls within the first magnitude range from the multiple Data Nodes can be aggregated into one of the multiple Data Nodes. This Data Node then sorts the data whose magnitude falls within the first magnitude range, thereby determining the query result. Since the Data Node only sorts a subset of the dataset, this effectively reduces the computational and time overhead required for sorting.
[0007] Here, "convergence" can be understood as the sending of data, such as data copying. Specifically, taking the transmission of data from DN1 to DN2 as an example, DN1 can copy the data already written to disk in its memory and send it to DN2. After receiving the copied data, DN2 can process it in memory (e.g., sorting) or store it in a storage device such as a hard disk and then process it in memory (e.g., sorting). Of course, after completing the data processing, the data stored in the hard disk or other storage devices can be deleted.
[0008] In one possible implementation, the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the numerical size distribution is specifically: the numerical size of the data in the dataset is the number of data in each of the multiple different sub-numerical ranges, and the first numerical range is one of the multiple different sub-numerical ranges.
[0009] In one possible implementation, the different sub-numerical ranges within the plurality of different sub-numerical ranges do not overlap.
[0010] In one possible implementation, the step of sorting the data whose numerical values fall within the first numerical range using the first DN to determine the first subset of data includes: using the first DN, determining the first subset of data based on the number of data in the dataset whose numerical values fall within the first numerical range, and a first sorting result of sorting the data whose numerical values fall within the first numerical range.
[0011] In one possible implementation, the method further includes: obtaining the distribution of the numerical values of the data belonging to the dataset stored on each of the plurality of DNs; and determining the numerical value distribution of the data in the dataset based on the distribution of the numerical values of the data belonging to the dataset stored on each DN.
[0012] In one possible implementation, the method further includes: obtaining sampling results obtained by sampling the data of the stored dataset by each DN; sorting the data in the multiple sampling results according to their numerical values to obtain a second sorting result; and using the numerical values of the data at preset intervals in the sorting position of the second sorting result as the boundaries of the sub-data range to determine the multiple sub-data ranges.
[0013] By using the above method, the amount of data aggregated on different DNs can be relatively balanced, thereby reducing the amount of data that needs to be processed for sorting.
[0014] In one possible implementation, the query is further used to indicate the search for a second subset of the dataset, the second subset being a subset whose sorted position is within a second sorting range after the data in the dataset is sorted by numerical size; the sorted position within the second sorting range is after the second sorting range, and the method further includes: determining, based on the query and the numerical size distribution of the data in the dataset, that the numerical size of the subset whose sorted position is within the second sorting range is within a second numerical range, the second numerical range being a sub-data range of the numerical range of the data in the dataset; aggregating the data in the dataset whose numerical size is within the second numerical range to a second DN of the plurality of DNs; and sorting the data whose numerical size is within the second numerical range using the second DN to determine the second subset.
[0015] In one possible implementation, the database system further includes a coordinating node (CN), and the query acquisition includes: the CN receiving a query sent by a client; the method further includes: after receiving the first subset of data sent by the first DN, the CN then receives the second subset of data sent by the second DN. When the data requested by the query is distributed across multiple DNs, the CN can receive the data sent by the DNs sequentially, thereby ensuring the global order of the data.
[0016] In one possible implementation, the method further includes: after receiving the first subset of data broadcast by the first DN, at least one of the plurality of DNs receives the second subset of data broadcast by the second DN. When the data to be searched according to the query is distributed across multiple DNs, in order to ensure that the broadcast data still has global order, at least one of the plurality of DNs may receive the data in the order of the size of the numerical range corresponding to the DN.
[0017] Secondly, this application provides a data sorting method applied to a database system, the database system including a coordinating node CN and multiple data nodes DN, the method comprising:
[0018] Obtain a sorting request; the sorting request is used to instruct that the data in the dataset be sorted according to their numerical values; the dataset is distributed across the multiple DNs; the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the different sub-numerical ranges do not overlap.
[0019] Based on the query and the numerical distribution of the data in the dataset, the data with numerical values in the dataset within the different sub-numerical ranges are aggregated onto different DNs of the multiple DNs;
[0020] The aggregated data is sorted using each of the DNs to obtain a sorting result;
[0021] Based on the sorting of the numerical values of the multiple DNs, the sorting results are sequentially sent to the CN, or broadcast sequentially within the multiple DNs.
[0022] Thirdly, this application provides a database system, including: a coordination node CN and multiple data nodes DN;
[0023] The CN is used to retrieve a query; the query is used to indicate the search for the first subset of the dataset, which is a subset of the dataset whose sorted position is within a first sorting range after sorting the data in the dataset according to their numerical values; the dataset is distributed across the multiple DNs.
[0024] At least one of the plurality of DNs is used to determine, based on the query and the numerical distribution of the data in the dataset, the numerical size of the sub-data set whose sorting position is within the first sorting range is within a first numerical range, where the first numerical range is a sub-data range of the numerical range of the data in the dataset;
[0025] The plurality of DNs are used to aggregate data whose numerical values in the dataset are within a first numerical range to the first DN of the plurality of DNs;
[0026] The first DN is used to sort data whose numerical values fall within the first numerical range to determine the first subset of data.
[0027] In one possible implementation, the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the numerical size distribution is specifically: the numerical size of the data in the dataset is the number of data in each of the multiple different sub-numerical ranges, and the first numerical range is one of the multiple different sub-numerical ranges.
[0028] In one possible implementation, the different sub-numerical ranges within the plurality of different sub-numerical ranges do not overlap.
[0029] In one possible implementation, the first DN is specifically used for:
[0030] The first subset of the dataset is determined based on the number of data in the sub-range of values preceding the first range, and the first sorting result of sorting the data whose values fall within the first range.
[0031] In one possible implementation, at least one of the plurality of DNs is used for:
[0032] Obtain the distribution of the numerical values of the data belonging to the dataset stored on each of the plurality of DNs; determine the numerical value distribution of the data in the dataset based on the distribution of the numerical values of the data belonging to the dataset stored on each DN.
[0033] In one possible implementation, at least one of the plurality of DNs is used for:
[0034] Obtain the sampling result obtained by sampling the data of the stored dataset by each DN; sort the data in the multiple sampling results according to the numerical size to obtain a second sorting result; use the numerical size of the data at each preset interval of the sorting position in the second sorting result as the boundary of the sub-data range to determine the multiple sub-data ranges.
[0035] In one possible implementation, the query is further used to indicate the search for a second subset of the dataset, the second subset being a subset whose sorted position is within a second sorting range after the data in the dataset has been sorted by numerical value; the sorted position within the second sorting range is after the second sorting range, and at least one of the plurality of DNs is used for:
[0036] Based on the query and the numerical distribution of the data in the dataset, the numerical values of the sub-dataset whose sorting position is within the second sorting range are determined to be within a second numerical range, where the second numerical range is a sub-data range of the numerical range of the data in the dataset.
[0037] The plurality of DNs are used to aggregate data in the dataset whose numerical values are within the second numerical range to the second DN of the plurality of DNs;
[0038] The second DN is used to sort the data whose numerical values are within the second numerical range to determine the second subset.
[0039] In one possible implementation,
[0040] The first DN is used to send the first subset of data to the CN;
[0041] The second DN is used to send the second sub-dataset to the CN after the first DN has sent the first sub-dataset to the CN.
[0042] In one possible implementation,
[0043] The first DN is used to broadcast the first subset of data within the plurality of DNs;
[0044] The second DN is used to broadcast the second subset of data within the plurality of DNs after the first DN has broadcast the first subset of data within the plurality of DNs.
[0045] Fourthly, this application provides a data query method based on a cloud management platform, wherein the cloud management platform is used to manage the infrastructure providing cloud services, and the infrastructure includes a storage system and a cluster of computing nodes. The method includes:
[0046] The cloud management platform obtains a query; the query is used to indicate the search for a first subset of the dataset, the first subset being a subset whose sorted position is within a first sorting range after sorting the data in the dataset according to their numerical values; the dataset is distributed across the multiple Data Nodes (DNs); the compute node cluster, based on the query and the numerical distribution of the data in the dataset, aggregates the data in the dataset whose numerical values are within the first numerical range onto the first DN of the multiple DNs; the numerical values of the subset whose sorted position is within the first sorting range are within the first numerical range, the first numerical range being a sub-data range of the numerical range of the data in the dataset; the compute node cluster sorts the data whose numerical values are within the first numerical range using the first DN to determine the first subset.
[0047] The computing node cluster can execute the actions performed by the DN in this application embodiment.
[0048] Fifthly, this application provides a computing device cluster. The computing device cluster includes at least one computing device, and the at least one computing device includes at least one processor and at least one memory. The at least one processor and the at least one memory communicate with each other. The at least one processor is used to execute instructions stored in the at least one memory to cause the computing device or the computing device cluster to perform a method as described in the first aspect or any implementation thereof, or to perform a method as described in the second aspect or any implementation thereof.
[0049] In a sixth aspect, this application provides a computer-readable storage medium storing instructions that instruct a computing device or a cluster of computing devices to perform a method executed by a database system according to the first aspect or any implementation thereof, or to perform a method according to the second aspect or any implementation thereof.
[0050] In a seventh aspect, this application provides a computer program product containing instructions that, when run on a computing device or a cluster of computing devices, causes the computing device or cluster of computing devices to execute the database system execution method of the first aspect or any implementation thereof, or to execute the method of the second aspect or any implementation thereof.
[0051] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description
[0052] Figures 1A and 2 are schematic diagrams of the application framework of this application;
[0053] Figure 3 is a flowchart illustrating the data query method according to an embodiment of this application;
[0054] Figures 4 to 6 are schematic diagrams of the query processing in the embodiments of this application;
[0055] Figure 7 is a schematic diagram of the database in an embodiment of this application;
[0056] Figure 8 is a schematic diagram of the data query method according to an embodiment of this application;
[0057] Figures 9 to 11 are schematic diagrams of the structure of the device according to an embodiment of this application. Detailed Implementation
[0058] The embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. As those skilled in the art will recognize, with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0059] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0060] The method provided in this application embodiment can be applied to a database system. Figure 1A shows a typical logical architecture of a database system. According to Figure 1A, the database system 100 includes a database 110 and a database management system (DBMS) 130.
[0061] Database 110 is an organized collection of data stored in database storage 120; that is, a related collection of data organized, stored, and used according to a specific data model. Depending on the data model used to organize the data, data can be divided into various types, such as relational data, graph data, and time series data. Relational data is data modeled using a relational model, typically represented as tables, where rows represent a set of related values for an object or entity. Graph data, simply called a "graph," is used to represent relationships between objects or entities, such as social relationships. Time series data is a series of data columns recorded and indexed in chronological order, used to describe the state changes of an object over time.
[0062] The database management system 130 is the core of the database system, serving as system software for organizing, storing, and maintaining data. Clients 200 can access the database 110 through the database management system 130, and database administrators also use the database management system for database maintenance. The database management system 130 provides various functions for clients 200 to create, modify, and query the database; clients 200 can be applications or user devices. The functions provided by the database management system 130 may include, but are not limited to, the following: (1) Data definition function: The database management system 130 provides a data definition language (DDL) to define the structure of the database 110. The DDL is used to describe the database framework and can be stored in the data dictionary; (2) Data access function: The database management system 130 provides a data manipulation language (DML) to implement basic access operations on the database 110, such as retrieval, insertion, modification and deletion; (3) Database operation management function: The database management system 130 provides data control function to effectively control and manage the operation of the database 110 to ensure that the data is correct and valid; (4) Database creation and maintenance function: including loading the initial data of the database, database dumping, recovery, reorganization, system performance monitoring and analysis, etc.; (5) Database transmission: The database management system provides data transmission to realize communication between the client and the database management system, which is usually coordinated with the operating system.
[0063] Database storage 120 includes, but is not limited to, solid-state drives (SSDs), disk arrays, cloud storage, or other types of non-transient computer-readable storage media. Those skilled in the art will understand that a database system may include fewer or more components than those shown in FIG. 1A, or may include components different from those shown in FIG. 1A, which merely illustrates components more relevant to the implementation disclosed in the embodiments of this application.
[0064] The database system provided in this application embodiment can be a distributed database system (DDBS). In order to achieve concurrency control between transactions during transaction processing, DDBS typically uses a global transaction manager (GTM) to manage transactions. DDBS is described below with reference to Figures 1B and 1C.
[0065] Figure 1B is a schematic diagram of a distributed database system using a shared-storage architecture, including one or more coordinator nodes (CNs) and multiple data nodes (DNs). CNs and DNs communicate via a network channel. In one embodiment, this network channel can consist of network devices such as switches, routers, and gateways. CNs, DNs, and the GTM (Gateway Management System) jointly implement the functions of the database management system, providing clients with services such as database retrieval, insertion, modification, and deletion. In one embodiment, a database management system is deployed on each CN and DN. The shared data storage contains data that can be shared by multiple DNs, and DNs can perform read and write operations on the data in the data storage through the network channel. The shared data storage can be a shared disk array. The CNs and DNs in the distributed database system can be physical machines, such as database servers, or virtual machines (VMs) or containers running on abstract hardware resources. In one embodiment, CNs and DNs are virtual machines or containers, and the network channel is a virtual switching network, which includes virtual switches. The database management system deployed in the CN and DN is a DBMS instance. This DBMS instance can be a process or a thread, and these DBMSs work together to complete the functions of a database relational system. In another embodiment, the CN and DN are physical machines, and the network channel includes one or more switches, which can be storage area network (SAN) switches, Ethernet switches, fiber optic switches, or other physical switching devices.
[0066] Figure 1C illustrates a distributed database system employing a shared-nothing architecture. Each Data Domain (DN) has its own dedicated hardware resources (such as data storage), operating system, and database. The Data Center (CN) and DNs communicate via a network channel, which can be understood by referring to the relevant description in Figure 1B above. In this system, data is distributed across the DNs according to the database model and application characteristics. Query tasks are divided into several parts by the CN and executed in parallel on all DNs, coordinating computation to provide database services as a whole. All communication functions are implemented on a high-bandwidth interconnected network. Similar to the shared-storage architecture distributed database system described in Figure 1B, the CNs and DNs here can be either physical machines or virtual machines.
[0067] In all embodiments of this application, the data storage of the database system includes, but is not limited to, solid-state drives (SSDs), disk arrays, or other types of non-transient computer-readable media. Although the database is not shown in Figures 1B-1C, it should be understood that the database is stored in the data storage. Those skilled in the art will understand that a database system may include fewer or more components than those shown in Figures 1A-1C, or may include components different from those shown in Figures 1A-1C, which merely show components more relevant to the implementation disclosed in the embodiments of this application. However, those skilled in the art will understand that a distributed database system may contain any number of CNs and DNs. The database management system functions of each CN and DN can be implemented by appropriate combinations of software, hardware, and / or firmware running on each CN and DN.
[0068] The distributed database system described in Figures 1B and 1C above includes multiple DNs and multiple CNs, where each DN has essentially the same function, and each CN also has essentially the same function.
[0069] Figure 2 illustrates an application data management system provided in an embodiment of this application. Specifically, as shown, the data node cluster may include multiple data nodes (DNs). Application developers can deploy relevant data of their developed applications in the corresponding data node DNs. The application can send service requests to the application server, which can convert the service requests into data operation requests. The application server can then send the data operation requests to the distributed database system. Subsequently, one or more data nodes (DNs) in the distributed database system perform the operations corresponding to the operation requests on the data in the database storage. Specifically, the application server can send the data operation requests to the coordination node in the coordination node cluster. The coordination node then forwards the operation requests to the relevant DNs, which then perform the data operations corresponding to the operation requests.
[0070] This application provides a data query method. Referring to Figure 3, which is a flowchart illustrating a data query method provided in this application, the method includes:
[0071] 301. Obtain a query; the query is used to indicate the search for the first subset of the dataset, the first subset being the subset whose sorted position is within the first sorting range after sorting the data in the dataset according to their numerical values; the dataset is distributed across the multiple DNs.
[0072] The database can receive queries from users or clients. For example, the CN field in the database can receive queries from users or clients.
[0073] Specifically, in this embodiment of the application, the query can find the first subset of the dataset. The first subset is the subset of the dataset whose sorted position is within the first sorting range after the data in the dataset is sorted according to the numerical size.
[0074] In the scenario of paginated data query in a database, the query in this embodiment can be used to indicate the data in the dataset that is sorted according to certain rules and whose sorting position is within a certain range. For example, the dataset may include multiple rows of data (or multiple columns of data; for ease of description, rows are used as an example here), and the query can be used to indicate the search for data whose sorting position is within a certain range after sorting multiple rows of data according to the numerical value of a certain column.
[0075] Since the dataset is distributed across multiple different data nodes (DNs), and the query requires sorting the global data and then selecting data from the sorted results, existing technologies first aggregate the data from the DNs to the CN, which then sorts the aggregated data and selects data from the sorted results to complete the query task. Because the CN needs to sort a large amount of data, this results in significant computational overhead and query latency.
[0076] For example, queries can be expressed using the SQL LIMIT and OFFSET clauses. A query statement format could be `Order by xlimit y offset z`, which means sorting column x of the dataset and selecting data whose sorting position starts at row z and is offset by row y.
[0077] The sort order can refer to the logical order generated by the ORDER BY clause in the query or by relying on indexes. It determines how the data in the result set is arranged, but it does not change the physical storage order of the data on disk.
[0078] Optionally, in one possible implementation, the user-input query can be compiled and optimized to obtain a query plan. For example, the query can be compiled and optimized using the DN (Database Provider) in the database system to obtain a query plan. Then, the specific query task can be executed on the DN according to the query plan.
[0079] 302. Based on the query and the numerical distribution of the data in the dataset, aggregate the data whose numerical values are within a first numerical range to the first DN of the plurality of DNs; wherein, the numerical values of the subset of data whose sorting position is within the first sorting range are within the first numerical range, and the first numerical range is a sub-data range of the numerical range of the data in the dataset.
[0080] The approach of this embodiment is as follows: First, the distribution of data values in the dataset (distributed across multiple Data Nodes) is obtained. This data value distribution describes the magnitude relationship of the data values in the dataset. Then, based on the magnitude distribution, it is determined which sub-data range (first magnitude range) of the overall magnitude distribution of the dataset the value of the data indicated in the query (i.e., the subset of the dataset whose sorting position is within the first sorting range) falls within. Data within this range constitutes a portion of the dataset's data volume and includes the data indicated in the query. Next, the data whose magnitude falls within the first magnitude range from the multiple Data Nodes can be aggregated into one of the multiple Data Nodes. This Data Node then sorts the data whose magnitude falls within the first magnitude range, thereby determining the query result. Since the Data Node only sorts a subset of the dataset, this effectively reduces the computational and time overhead required for sorting.
[0081] The data distribution can be used to describe the distribution of different values in a dataset. For example, the overall range of values in the dataset can be divided into multiple sub-ranges, and the data distribution can be used to describe the amount of data in each sub-range. Furthermore, the data distribution can also be described using other dimensions of information, such as the frequency or probability of values, central tendency (e.g., mean, median), dispersion (e.g., standard deviation, range), and distribution pattern (e.g., symmetry, skewness), among one or more of these. This embodiment of the application is not limited to these aspects.
[0082] In one possible implementation, the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the numerical size distribution is specifically: the numerical size of the data in the dataset is the number of data in each of the multiple different sub-numerical ranges, and the first numerical range is one of the multiple different sub-numerical ranges.
[0083] In one possible implementation, the different sub-numerical ranges within the plurality of different sub-numerical ranges may or may not overlap. For example, they may be continuous numerical ranges (the boundaries of adjacent sub-numerical ranges are continuous, and there is no overlap between adjacent sub-numerical ranges).
[0084] The data distribution can also determine the ranking position of data within the first numerical range in the entire dataset. The ranking position of data within the first numerical range in the entire dataset can be represented by the amount of data in the dataset whose numerical value precedes the first numerical range. For example, with 1000 data entries, the numerical range is divided into three sub-ranges: 0-300, 300-700, and 700-1000. The amount of data in the 0-300 range is 300, the amount of data in the 300-700 range is 400, and the amount of data in the 700-1000 range is 300. The first numerical range is 300-700. Therefore, the amount of data in the dataset whose numerical value precedes the first numerical range is 300. Thus, the query result can be determined by the first DN, based on the number of data in the sub-ranges whose numerical value precedes the first numerical range, and the first sorting result of sorting the data whose numerical value precedes the first numerical range.
[0085] By analyzing the amount of data within different sub-ranges and the numerical relationships between them, it's possible to deduce which (or which sub-ranges) the data being searched falls within. For example, sub-range 1 is 0-100, sub-range 2 is 100-200, sub-range 3 is 200-300, sub-range 1 contains 1000 records, sub-range 2 contains 1100 records, and sub-range 3 contains 900 records. If the query indicates the data to be searched is ranked between 1300 and 1500, then the data ranked between 1300 and 1500 is within sub-range 2. If the query indicates the data to be searched is ranked between 900 and 1200, then some of the data ranked between 1300 and 1500 is within sub-range 1, and the other part is within sub-range 2.
[0086] In this embodiment, the numerical range of the data in the dataset can be divided into multiple sub-ranges. The number of sub-ranges can be the same as the number of Data Nodes (DNs) and correspond one-to-one. Then, the data in the dataset belonging to the sub-range containing the data searched by the query instruction can be aggregated onto the corresponding DN, and sorted by the DN. This presents a problem: if the amount of data belonging to a certain sub-range in the dataset is too large, and that range happens to be the sub-range containing the data searched by the query instruction, then the amount of data aggregated onto the corresponding DN and sorted will be excessive. To ensure that the amount of data in the DN during sorting is not too large, the amount of data belonging to different sub-ranges in the dataset should be as evenly distributed as possible.
[0087] Next, we will introduce how to divide the numerical range of the data in the dataset so that the amount of data belonging to different sub-ranges is as even as possible:
[0088] In one possible implementation, the database system can obtain sampling results obtained by each DN sampling the data of the stored dataset. For example, each DN can sample data from its own distribution. Sampling can be, but is not limited to, probability sampling (such as simple random, stratified, systematic, cluster sampling) and non-probability sampling (such as convenience, quota, snowball sampling, etc.). The sampling results obtained from multiple DNs can be summarized and sorted to obtain a second sorting result. Then, the numerical value of data at each preset interval (this number is related to the number of DNs; for example, if the data volume is 120 and the number of DNs is 3, then the preset interval can be 40) in the second sorting result can be used as the boundary of the sub-data range to determine the multiple sub-data ranges.
[0089] Example: 40 samples are taken from DN1, 40 from DN2, and 40 from DN3, resulting in a total of 120 samples after merging. The globally sampled data is then sorted to obtain a second sorting result. The numerical values of data at 40-digit intervals in this second sorting result are used as the boundaries of the sub-data ranges. For example, the numerical value of the 40th data point can be chosen as the boundary between the first and second sub-data ranges, and the numerical value of the 80th data point can be chosen as the boundary between the second and third sub-data ranges.
[0090] By using the above method, the amount of data aggregated on different DNs can be relatively balanced, thereby reducing the amount of data that needs to be processed for sorting.
[0091] In one possible implementation, after obtaining the sub-range partitioning results, the sub-range partitioning results can be broadcast to multiple DNs, so that each DN is aware of the sub-range partitioning results. Then, based on the sub-range partitioning results, the amount of data in each sub-range can be determined.
[0092] Each DN can identify the data in its own data whose values fall within the first value range, and then aggregate the data whose values fall within the first value range to the first DN. The first DN can receive data whose values fall within the first value range sent by other DNs, and summarize the data whose values fall within the first value range sent by other DNs and the data whose values fall within the first value range in its own data.
[0093] A pre-defined correspondence can be established, indicating that different sub-value ranges correspond to different DNs. For example, sub-value range 1 corresponds to DN1, sub-value range 2 corresponds to DN2, and sub-value range 3 corresponds to DN3. When the data to be searched in the query is located in sub-value range 1, the data from multiple DNs located in sub-value range 1 can be aggregated into DN1. When the data to be searched in the query is located in sub-value range 2, the data from multiple DNs located in sub-value range 2 can be aggregated into DN2. When the data to be searched in the query is located in sub-value range 3, the data from multiple DNs located in sub-value range 3 can be aggregated into DN3.
[0094] Of course, when the data to be found in the query is located in multiple sub-data ranges, the data in each sub-data range can be summarized into the corresponding different DNs. For example, when the data to be found in the query is located in sub-value ranges 1 and 2, the data in sub-value range 1 on multiple DNs can be summarized into DN1, and the data in sub-value range 2 on multiple DNs can be summarized into DN2.
[0095] 303. Sort the data whose values are within the first numerical range using the first DN to determine the first subset of data.
[0096] After receiving the data, the first DN can sort the data whose values are within the first numerical range, and calculate which data (that is, the first subset of the dataset) need to be searched in the query based on the sorting results and the sorting position of the data within the first numerical range in the entire dataset.
[0097] In one possible implementation, the query further instructs the search for a second subset of the dataset, which is a subset of data in the dataset whose sorted position falls within a second sorting range after the data in the dataset has been sorted by numerical value. The sorted position within the second sorting range is located after the first sorting range. Alternatively, the query may not divide the searched sorting position into a first and a second sorting range, but rather instruct the search for data in a continuous sorting position, which may encompass both the first and second sorting ranges. Furthermore, based on the query and the numerical distribution of the data in the dataset, the numerical values of the subset of data whose sorted position falls within the second sorting range are determined to be within a second numerical range, which is a sub-range of the numerical range of the data in the dataset. The data in the dataset whose numerical values fall within the second numerical range are aggregated onto a second DN of the plurality of DNs. The data whose numerical values fall within the second numerical range are then sorted using the second DN to determine the second subset of the dataset. Regarding how to aggregate data whose values fall within the second numerical range in the dataset to the second DN of the plurality of DNs, and how to sort the data whose values fall within the second numerical range using the second DN to determine the second subset dataset, the processing procedure for the first DN in the above embodiments can be referred to, and the similarities will not be repeated here.
[0098] In one possible implementation, data belonging to different sub-numerical ranges can be aggregated to their respective DNs. Each DN can then receive the aggregated data and analyze whether the data specified in the query exists within its aggregated data. If so, the data is sorted and selected. The specific process can be seen in Figure 4.
[0099] Referring to the four scenarios in Figure 4, a DN can determine the query statement based on its own aggregated data. This query statement can be used to find the data within the aggregated data that the query indicates is looking for. Taking the SQL LIMIT and OFFSET clauses as examples, the values of limit and offset can be determined based on the aggregated data. For a given DN, the total amount of data in the sub-value range preceding the corresponding sub-value range of that DN can be obtained. Taking finding data from 4000 rows of data with a sort position between 991 and offset 10 rows as an example, after calculation using the method in Figure 4, DN1 adjusts limitcount to 5. When reading data from the upper-level sort, it will skip the first 990 rows and only read the last 5 rows. Similarly, DN2 adjusts limitcount to 5. When reading data from the upper-level sort, it will only read the first 5 rows and will not read the last 997 rows. Ultimately, only 5 rows from both DN1 and DN2 will be sent to the CN. Finally, since the data between the DNs in the upper layer is already ordered after the value interval redistribution, and the data between the DNs is globally ordered after the upper layer performs local sorting, the CN finally receives the data according to the order of the DNs, and no longer needs to perform merge sorting.
[0100] In one possible implementation, when the data requested by the query is distributed across multiple Data Nodes (DNs), the Data Node (CN) can receive the data sent by the DNs sequentially, thereby ensuring the global order of the data. Specifically, the CN can receive the second subset of data sent by the second DN after receiving the first subset sent by the first DN.
[0101] The redistribution plan and data volume changes at each stage in this embodiment are shown in Figure 5. DN3, by sorting its own data, determines the data volumes belonging to four different numerical ranges: 248, 251, 255, and 246. Since the data to be searched falls within the first two numerical ranges, the data from the first range can be sent to DN1, and the data from the second range to DN2. DN1 receives data from multiple DNs, including DN3, whose values fall within the first range, sorts it locally, and selects the last five rows. DN2 receives data from multiple DNs, including DN3, whose values fall within the second range, sorts it locally, and selects the first five rows. Then, the gather operator can be used to send the 10 rows of data to CN.
[0102] By applying the scheme of this application embodiment, the value interval redistribution stream operator is used to redistribute the data at the underlying sort+limit, so that the data between DNs after sorting at the upper layer achieves global order. Finally, when collecting data by gathering, it is only necessary to receive data according to the DN order, without needing to perform merge sort again. In both the underlying and upper-layer sort+limit, it is possible to count which data actually needs to be sent, perform data filtering in advance, greatly reduce the amount of data transmitted, and improve execution efficiency.
[0103] In one possible implementation, when the query is not an external query but a subquery of a query, after determining the data to be searched, the DN (Data Node) may not send it directly to the CN (Data Center), but instead broadcast the data among multiple DNs. The DNs then proceed with the next query task. When the query indicates that the data to be searched is distributed across multiple DNs, to ensure that the broadcast data still maintains global order, it can be broadcast in order of the size of the numerical range corresponding to the DN. Specifically, after at least one of the multiple DNs receives the first subset of data broadcast by the first DN, it can then receive the second subset of data broadcast by the second DN.
[0104] For example, the following is a case where `Order by x limit y offset z` appears in a subquery:
[0105] Select from t1
[0106] Where a1 in(
[0107] select a2 from t2
[0108] where b2=1
[0109] order by a2 limit 5 offset 1000);
[0110] The subquery corresponding to the embodiment of this application is shown in Figure 6. The difference from Figure 5 is that the GATHER operator is replaced by the BROADCAST operator.
[0111] Furthermore, this application embodiment can also be applied to sorting requests. Specifically, the database can obtain a sorting request; the sorting request is used to instruct the data in the dataset to be sorted according to their numerical values; the dataset is distributed across multiple Data Domains (DNs); the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the different sub-numerical ranges do not overlap; then, based on the query and the numerical distribution of the data in the dataset, the data with numerical values in the dataset within the different sub-numerical ranges are aggregated to different DNs of the multiple DNs; the aggregated data is sorted through each DN to obtain a sorting result; through the multiple DNs, according to the numerical values of the multiple different sub-numerical ranges, the sorting result is sequentially sent to the Data Domain (CN), or sequentially broadcast within the multiple DNs.
[0112] By doing so, the sorting task is distributed across multiple DNs instead of being concentrated on a single node, thereby reducing the computational and time overhead of sorting.
[0113] Referring to Figure 7, this application embodiment also provides a database system 800, including: a coordination node CN 801 and multiple data nodes DN 802;
[0114] The CN801 is used to execute step 1 in Figure 8: obtain a query; the query is used to indicate the search for the first subset of the dataset, the first subset of the dataset being the subset whose sorted position is within the first sorting range after sorting the data in the dataset according to their numerical values; the dataset is distributed across the multiple DNs;
[0115] At least one of the plurality of DN802 is used to perform step 2 in Figure 8: based on the query and the numerical distribution of the data in the dataset, determine the numerical size of the sub-data set whose sorting position is within the first sorting range within a first numerical range, wherein the first numerical range is a sub-data range of the numerical range of the data in the dataset;
[0116] The plurality of DN802 are used to perform step 2 in Figure 8: aggregate the data whose numerical values are in the first numerical range to the first DN8021 of the plurality of DNs;
[0117] The first DN8021 is used to perform step 3 in Figure 8: sorting the data whose numerical values are within the first numerical range to determine the first subset of data.
[0118] In one possible implementation, the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the numerical size distribution is specifically: the numerical size of the data in the dataset is the number of data in each of the multiple different sub-numerical ranges, and the first numerical range is one of the multiple different sub-numerical ranges.
[0119] In one possible implementation, the different sub-numerical ranges within the plurality of different sub-numerical ranges do not overlap.
[0120] In one possible implementation, the first DN 8021 is specifically used for:
[0121] The first subset of the dataset is determined based on the number of data in the sub-range of values preceding the first range, and the first sorting result of sorting the data whose values fall within the first range.
[0122] In one possible implementation, at least one of the plurality of DNs is used for:
[0123] Obtain the distribution of the numerical values of the data belonging to the dataset stored on each of the plurality of DNs; determine the numerical value distribution of the data in the dataset based on the distribution of the numerical values of the data belonging to the dataset stored on each DN.
[0124] In one possible implementation, at least one of the plurality of DNs is used for:
[0125] Obtain the sampling result obtained by sampling the data of the stored dataset by each DN; sort the data in the multiple sampling results according to the numerical size to obtain a second sorting result; use the numerical size of the data at each preset interval of the sorting position in the second sorting result as the boundary of the sub-data range to determine the multiple sub-data ranges.
[0126] In one possible implementation, the query is further used to indicate the search for a second subset of the dataset, the second subset being a subset whose sorted position is within a second sorting range after the data in the dataset has been sorted by numerical value; the sorted position within the second sorting range is after the second sorting range, and at least one of the plurality of DNs is used for:
[0127] Based on the query and the numerical distribution of the data in the dataset, the numerical values of the sub-dataset whose sorting position is within the second sorting range are determined to be within a second numerical range, where the second numerical range is a sub-data range of the numerical range of the data in the dataset.
[0128] The plurality of DNs are used to aggregate data in the dataset whose numerical values are within the second numerical range to the second DN of the plurality of DNs;
[0129] The second DN is used to sort the data whose numerical values are within the second numerical range to determine the second subset.
[0130] In one possible implementation,
[0131] The first DN is used to send the first subset of data to the CN;
[0132] The second DN is used to send the second sub-dataset to the CN after the first DN has sent the first sub-dataset to the CN.
[0133] In one possible implementation,
[0134] The first DN is used to broadcast the first subset of data within the plurality of DNs;
[0135] The second DN is used to broadcast the second subset of data within the plurality of DNs after the first DN has broadcast the first subset of data within the plurality of DNs.
[0136] A database system, as an example of a software functional unit, can include code running on compute instances. A compute instance can be at least one of a physical host (computing device), virtual machine, container, or other computing device. Further, the aforementioned computing device can be one or more. For example, a node can include code running on multiple hosts, virtual machines, or containers. It should be noted that the multiple hosts, virtual machines, or containers used to run the code can be distributed within the same Availability Zone (AZ) or in different AZs, with each AZ comprising one or more geographically proximate data centers. The multiple hosts, virtual machines, or containers used to run the code can also be distributed within the same region or in different regions. Typically, a region can include multiple AZs, with VPCs set up within a single region. Cross-region communication between two VPCs within the same region, and between VPCs in different regions, requires a communication gateway within each VPC to achieve interconnection between VPCs.
[0137] Similarly, multiple hosts, virtual machines, or containers used to run this code can be distributed within the same VPC or across multiple VPCs. Typically, a region can include multiple Availability Zones (AZs).
[0138] As an example of a hardware functional unit, a database system may include at least one computing device, such as a server. Alternatively, the module may be a device implemented using an ASIC or a PLD. The aforementioned PLD may be implemented using a CPLD, FPGA, GAL, or any combination thereof.
[0139] The database system includes multiple computing devices that can be distributed in the same Availability Zone (AZ) or in different AZs. Similarly, the modules include multiple computing devices that can be distributed in the same region or in different regions. Likewise, the modules include multiple computing devices that can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs. This application also provides a computing device 1000. As shown in FIG9, the computing device 1000 includes: a bus 1002, a processor 1004, a memory 1006, and a communication interface 1008. The processor 1004, the memory 1006, and the communication interface 1008 communicate via the bus 1002. The computing device 1000 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 1000.
[0140] Bus 1002 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one line is used in Figure 9, but this does not imply that there is only one bus or one type of bus. Bus 1002 can include pathways for transmitting information between various components of computing device 1000 (e.g., memory 1006, processor 1004, communication interface 1008).
[0141] The processor 1004 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0142] Memory 1006 may include volatile memory, such as random access memory (RAM). Memory 1006 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD). Memory 1006 stores executable program code, which processor 1004 executes to implement the methods executed by the aforementioned database system. Specifically, memory 1006 stores instructions for the methods executed by the database system (e.g., a first database system and a second database system).
[0143] The communication interface 1008 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 1000 and other devices or communication networks.
[0144] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device 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.
[0145] As shown in Figure 10, the computing device cluster includes at least one computing device 1000. The memory 1006 of one or more computing devices 1000 in the computing device cluster may store instructions for executing methods of the database system.
[0146] In some possible implementations, one or more computing devices 1000 in the computing device cluster can also be used to execute partial instructions of methods executed by a database system (e.g., a first database system and a second database system). In other words, a combination of one or more computing devices 1000 can jointly execute instructions of methods executed by the database system.
[0147] It should be noted that the memory 1006 in different computing devices 1000 in the computing device cluster can store different instructions for executing some functions of the heterogeneous database system 100.
[0148] 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), etc. Figure 11 illustrates one possible implementation. As shown in Figure 11, two computing devices 120A and 120B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 116 in computing device 120A can store instructions for performing a portion of the functions of the database system. Simultaneously, the memory 116 in computing device 120B can store instructions for performing another portion of the functions of the database system.
[0149] It should be understood that the functions of computing device 120A shown in Figure 11 can also be performed by multiple computing devices. Similarly, the functions of computing device 120B can also be performed by multiple computing devices.
[0150] This application also provides another computing device cluster. The connection relationship between the computing devices in this computing device cluster can be similarly referred to the connection method of the computing device clusters in Figures 10 and 11. The difference is that the memory 116 in one or more computing devices in this computing device cluster can store the same instructions for executing the method of the database system.
[0151] In some possible implementations, the memory 116 of one or more computing devices in the computing device cluster may also store partial instructions for executing the template generation method. In other words, a combination of one or more computing devices can jointly execute the instructions for executing the template generation method.
[0152] It should be noted that the memory 116 in different computing devices within the computing device cluster can store different instructions for executing parts of the template generation method. That is, the instructions stored in the memory 116 of different computing devices can implement the functions of one or more modules in the second database system and the first database system.
[0153] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, 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., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the data query method performed by the aforementioned database system.
[0154] This application also provides a computer program product containing instructions. The 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 execute the data query method described above for the database system.
[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.
Claims
1. A data query method, characterized in that, Applied to a database system, the database system comprising multiple data nodes (DNs), the method includes: A query is retrieved; the query is used to indicate the search for the first subset of the dataset, which is the subset of data in the dataset that is sorted by numerical value and whose sorted position is within a first sorting range; the dataset is distributed across the multiple DNs; Based on the query and the numerical distribution of the data in the dataset, the data whose numerical values are within a first numerical range are aggregated onto the first DN of the plurality of DNs; wherein, the numerical values of the sub-dataset whose sorting position is within the first sorting range are within the first numerical range, and the first numerical range is a sub-data range of the numerical range of the data in the dataset; The first subset of data is determined by sorting the data whose values fall within the first numerical range using the first DN.
2. The method according to claim 1, characterized in that, The numerical distribution is also used to indicate the sorting position of the data within the first numerical range in the dataset; the step of sorting the data within the first numerical range using the first DN to determine the first subset includes: The first subset of data is determined by using the first DN, the sorting position of data within the first numerical range in the dataset, and the first sorting result of sorting data whose numerical values are within the first numerical range.
3. The method according to claim 1 or 2, characterized in that, The numerical range of the data in the dataset includes multiple different sub-numerical ranges; the distribution of numerical values specifically refers to the number of data in each sub-numerical range, where the first numerical range is one of the multiple different sub-numerical ranges.
4. The method according to claim 2 or 3, characterized in that, The step of determining the first subset of data based on the sorting position of data within the first numerical range in the dataset, and the first sorting result of sorting data whose values fall within the first numerical range, includes: The first subset of data is determined by using the first DN, based on the number of data in the dataset whose numerical values fall within the first numerical range, and the first sorting result of sorting the data whose numerical values fall within the first numerical range.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Obtain the distribution of the numerical values of the data belonging to the dataset stored on each of the plurality of DNs; The distribution of the numerical values of the data in the dataset is determined based on the distribution of the numerical values of the data belonging to the dataset stored on each DN.
6. The method according to any one of claims 2 to 5, characterized in that, The method further includes: Obtain the sampling result obtained by sampling the data of the stored dataset for each DN; The data from the multiple sampling results are sorted according to their numerical values to obtain a second sorting result; The numerical values of data at predetermined intervals in the second sorting result are used as the boundaries of the sub-data ranges to determine the multiple sub-data ranges.
7. The method according to any one of claims 1 to 6, characterized in that, The query is also used to indicate the search for a second subset of the dataset, which is a subset of the dataset whose sorted position is within a second sorting range after the data in the dataset is sorted according to numerical size. The second sorting range is located after the second sorting range, and the method further includes: Based on the query and the numerical distribution of the data in the dataset, the data whose numerical values are within the second numerical range are aggregated into the second DN of the multiple DNs. The numerical values of the sub-dataset whose sorting position is within the second sorting range are within the second numerical range. The second numerical range is a sub-data range of the numerical range of the data in the dataset. The first DN and the second DN are different. The second subset of data is determined by sorting the data whose values fall within the second numerical range using the second DN.
8. The method according to claim 7, characterized in that, The database system also includes a coordination node (CN), and the process of obtaining a query includes: the CN receiving a query sent by the client; The method further includes: After receiving the first subset of data sent by the first DN, the CN then receives the second subset of data sent by the second DN.
9. The method according to claim 7, characterized in that, The method further includes: After receiving the first subset of data from the first DN, at least one of the plurality of DNs receives the second subset of data from the second DN.
10. A data sorting method, characterized in that, Applied to a database system, the database system including a coordinating node (CN) and multiple data nodes (DN), the method includes: Obtain a sorting request; the sorting request is used to instruct that the data in the dataset be sorted according to their numerical values; the dataset is distributed across the multiple DNs; the numerical range of the data in the dataset includes multiple different sub-numerical ranges; the different sub-numerical ranges do not overlap. Based on the query and the numerical distribution of the data in the dataset, the data with numerical values in the dataset within the different sub-numerical ranges are aggregated onto different DNs of the multiple DNs; The aggregated data is sorted using each of the DNs to obtain a sorting result; Based on the sorting of the numerical values of the multiple DNs, the sorting results are sequentially sent to the CN, or broadcast sequentially within the multiple DNs.
11. A database system, characterized in that, include: Coordinating node CN and multiple data nodes DN; The CN is used to retrieve queries; The query is used to indicate the search for the first subset of the dataset, which is the subset of the dataset whose sorted position is within a first sorting range after sorting the data in the dataset according to their numerical values; the dataset is distributed across the multiple DNs; The plurality of DNs are used to aggregate data whose numerical values in the dataset are within a first numerical range to the first DN of the plurality of DNs, based on the query and the numerical distribution of the data in the dataset; wherein, the numerical values of the sub-dataset whose sorting position is within the first sorting range are within the first numerical range, and the first numerical range is a sub-data range of the numerical range of the data in the dataset; The first DN is used to sort data whose numerical values fall within the first numerical range to determine the first subset of data.
12. The database system according to claim 11, characterized in that, The numerical range of the data in the dataset includes multiple different sub-numerical ranges; the distribution of numerical values specifically refers to the number of data in each sub-numerical range, where the first numerical range is one of the multiple different sub-numerical ranges.
13. The database system according to claim 12, characterized in that, The different sub-numerical ranges do not overlap.
14. The database system according to claim 12 or 13, characterized in that, The first DN is specifically used for: The first subset of the dataset is determined based on the number of data in the sub-range of values preceding the first range, and the first sorting result of sorting the data whose values fall within the first range.
15. The database system according to any one of claims 11 to 14, characterized in that, At least one of the plurality of DNs is used for: Obtain the distribution of the numerical values of the data belonging to the dataset stored on each of the plurality of DNs; determine the numerical value distribution of the data in the dataset based on the distribution of the numerical values of the data belonging to the dataset stored on each DN.
16. The database system according to any one of claims 12 to 15, characterized in that, At least one of the plurality of DNs is used for: Obtain the sampling result obtained by sampling the data of the stored dataset for each DN; sort the data in the multiple sampling results according to their numerical values to obtain a second sorting result; The numerical values of data at predetermined intervals in the second sorting result are used as the boundaries of the sub-data ranges to determine the multiple sub-data ranges.
17. The database system according to any one of claims 11 to 16, characterized in that, The query is further used to indicate the search for a second subset of the dataset, which is a subset of the dataset whose sorted position is within a second sorting range after the data in the dataset is sorted by numerical value; the sorted position within the second sorting range is after the second sorting range, and at least one of the plurality of DNs is used for: Based on the query and the numerical distribution of the data in the dataset, the numerical values of the sub-dataset whose sorting position is within the second sorting range are determined to be within a second numerical range, where the second numerical range is a sub-data range of the numerical range of the data in the dataset. The plurality of DNs are used to aggregate data in the dataset whose numerical values are within the second numerical range to the second DN of the plurality of DNs; The second DN is used to sort the data whose numerical values are within the second numerical range to determine the second subset.
18. The database system according to claim 17, characterized in that, The first DN is used to send the first subset of data to the CN; The second DN is used to send the second sub-dataset to the CN after the first DN has sent the first sub-dataset to the CN.
19. The database system according to claim 17, characterized in that, The first DN is used to broadcast the first subset of data within the plurality of DNs; The second DN is used to broadcast the second subset of data within the plurality of DNs after the first DN has broadcast the first subset of data within the plurality of DNs.
20. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and 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 to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 10.
21. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the method as described in any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that, Includes computer program instructions, which, when executed by a cluster of computing devices, perform the method as described in any one of claims 1 to 10.