Distributing table rows in a distributed database system

By pulling rows from source nodes to target nodes based on distribution rules, the method addresses the inefficiencies in distributing tables in a distributed database system, enhancing efficiency and reducing resource usage.

JP7784209B2Active Publication Date: 2025-12-11INTERNATIONAL BUSINESS MACHINE CORPORATION
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2023543376
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-02-18
Filing Date
2022-02-16
Publication Date
2025-12-11
Estimated Expiration
2042-02-16

AI Technical Summary

Technical Problem

Storing tables in a distributed database system is a resource-intensive task due to the need to assign and redistribute rows across logical nodes, which can be inefficient and require significant processing resources.

Method used

A method where rows are selected from source nodes based on distribution rules and pulled to target nodes, rather than being pushed from all nodes, reducing the need for redundant processing and resource usage.

Benefits of technology

This approach improves distribution efficiency by minimizing resource consumption and optimizing storage layout, while seamlessly integrating with existing systems by adapting distribution rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007784209000001
    Figure 0007784209000001
  • Figure 0007784209000002
    Figure 0007784209000002
  • Figure 0007784209000003
    Figure 0007784209000003
Patent Text Reader

Abstract

In an approach to copying table rows across logical nodes in a distributed database system with multiple logical nodes, for each logical node of the multiple logical nodes, a connection is made to a current logical node of the multiple logical nodes. One or more rows to be stored in a target table on the current logical node are selected from a source node of the logical nodes, where the one or more rows are selected based on distribution rules for distributing data in the distributed database system. Rows are stored in a target table, where the rows are pulled from the source node and stored in the current logical node.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to the field of digital computer systems, and more particularly to a method for distributing rows of a table in a distributed database system. [Background technology]

[0002] Storing a table in a distributed database system may be accomplished by assigning rows of the table to logical nodes where they must be stored. After assigning rows to logical nodes, the rows may be stored on the respective logical nodes. Nevertheless, this process can be a resource-intensive task. Summary of the Invention

[0003] Embodiments of the present invention include computer-implemented methods, computer program products, and systems for distributing rows of a table in a distributed database system. In a first embodiment, for each logical node of a plurality of logical nodes, a connection is made to a current logical node of the plurality of logical nodes. One or more rows are selected from a source node of the logical nodes to be stored in a target table on the current logical node, where the one or more rows are selected based on distribution rules for distributing data in the distributed database system. The rows are stored in the target table, where the rows are pulled from the source node and stored in the current logical node.

[0004] In another aspect, the present invention relates to a computer program product comprising a computer readable storage medium having computer readable program code embedded therein, the computer readable program code being configured to perform all of the steps of the method according to the aforementioned embodiments.

[0005] In another aspect, the invention relates to a computer system for a distributed database system comprising a plurality of logical nodes, the computer system being configured to connect to each logical node of the distributed database system and to control each connected-to-logical node to identify or select rows from a source node of the plurality of logical nodes to be stored in a target table on the logical node, and to retrieve the identified rows and store them in the target table.

[0006] In the following, embodiments of the invention will be described in more detail, by way of example only, with reference to the drawings, in which: [Brief explanation of the drawings]

[0007] [Figure 1] 1 is a diagram of a distributed database system according to an example of the present subject matter. [Figure 2A] 1 is a flowchart of a method for distributing rows of a table in a distributed database system, according to an example of the present subject matter. [Figure 2B] 1 is a diagram illustrating data flow in a distributed database system according to an illustrative distributed method of the present subject matter. [Figure 2C] 1 is a diagram illustrating data flow in a distributed database system according to an illustrative distributed method of the present subject matter. [Figure 2D] 1 is a diagram illustrating data flow in a distributed database system according to an illustrative distributed method of the present subject matter. [Figure 3] 1 is a flowchart of a method according to an example of the present subject matter. [Figure 4] 1 is a flowchart of a method according to an example of the present subject matter. [Figure 5] FIG. 1 is a diagram of a computerized system suitable for performing one or more method steps as included in the present disclosure. DETAILED DESCRIPTION OF THE INVENTION

[0008] The description of various embodiments of the present invention will be presented for purposes of illustration and are not intended to be exhaustive or limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein has been chosen to best explain the principles of the embodiments, practical applications, or technical improvements over technology found in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

[0009] A distributed database system may include multiple computers or machines. Two or more logical nodes may coexist on the same machine in a distributed database system. Logical nodes coexisting on the same machine may share processing resources, such as a CPU, and may have their own or separate storage areas for storing data. This allows the machines to operate as if they were two or more independent machines. Logical nodes may be associated with identifiers, such as numbers.

[0010] A distributed database system may be configured to store one or more tables in logical nodes of the distributed database system. To this end, distribution rules may be used to assign each row of the table to one of the logical nodes where it will be stored. After assigning the row to each node, a storage method may be used to store the row in each logical node. A row, or record, is a collection of related data items, such as a particular user's name, date of birth, and class. A row represents an entity, which may be a user, object, or concept, about which information is stored in a record.

[0011] For example, if a table is not yet stored in a distributed database system, distribution rules may be applied to the table, and the storage method requires copying rows from where the table is currently stored to each logical node. This initial storage may result in at least some of the multiple logical nodes each having an initial or original table that stores the rows of the table. The distribution rules for the initial storage method may be referred to as initial distribution rules.

[0012] In another example, if a table is already stored in a distributed storage system, e.g., after an initial store, and the initial distribution rule changes, a new distribution rule may be applied to the original table stored in each of the logical nodes, and the store method may be advantageously implemented such that rows are copied to each logical node. In this case, the newly distributed rows are stored in a table referred to as the new table. That is, a logical node may have an original table with rows according to the initial distribution method and a new table with rows according to another distribution method, which may differ from the initial distribution method. The distribution method may consist of applying a distribution rule and executing the store method. The distribution rule of a distribution method applied after the initial distribution of a table or after a redistribution of a table may be referred to as the new distribution rule.

[0013] A distribution rule may include one or more conditions on one or more attributes of a table to be stored in the distributed storage system. The one or more attributes may be referred to as a distribution key. For example, a distribution rule may require that rows representing entities with names beginning with the letter A be stored in logical node number 1.

[0014] The present subject matter can efficiently store distributed rows as follows: Rather than processing all locally stored rows and distributing them to the desired target nodes, rows to be stored in the current node are selected from all logical nodes and then pulled to the current node. In other words, rather than pushing rows from all logical nodes to the current node, rows are pulled from the source node, and the current logical node is the target node. The present subject matter can save resources compared to the pushing approach. For example, the pushing approach may require one logical node to handle the redistribution. This one node retrieves all rows from all logical nodes. For each row, this one node calculates the target node and sends the row to this target node. Thus, three logical nodes are involved for each row: the source node, the current node handling the redistribution, and the target node. The present method can improve on this pushing approach because the target node and the current node handling the redistribution are the same node, and it is no longer necessary to send rows from the current node to the target node. The rows are already on the target node. The result is that the current node handling the redistribution may not process all rows, but only a subset of the rows that will be stored on this node.

[0015] According to one embodiment, rows of the table are associated with each node of at least a portion of the plurality of nodes according to an initial distribution rule, and the method further includes creating a physical target table at each node of at least a portion of the plurality of logical nodes for storing the rows associated with each node, and retrieving the identified rows is performed from the original table.

[0016] According to one embodiment, the initial distribution rule is different from the new distribution rule or is the same as the new distribution rule. Having the new distribution rule be the same as the initial distribution rule can be advantageous if the structure of the distributed database system changes; for example, if the initial distribution rule requires an even distribution of rows across existing nodes, reapplication of this rule to the changed system, for example with additional nodes, may lead to a different distribution of rows.

[0017] According to one embodiment, identifying the rows includes applying initial distribution rules to determine rows associated with at least some of the plurality of logical nodes without storing the rows. That is, initial storage of the table in an origin table for each of the logical nodes may not be required. For example, creating a physical origin table in the first location may not be necessary because data may be collected from other tables and stored directly in the new table (with new distribution rules).

[0018] According to one embodiment, a distributed database system is configured to distribute table rows across a plurality of logical nodes according to a distribution method. The distribution method includes, in each unique logical node of the plurality of logical nodes, an assigning-rows-to-node step that includes identifying a target node and rows of the unique logical node to be copied to the target node according to a distribution rule, and a pushing step that includes copying rows from the unique logical node to each identified target node. The method further includes adapting the distribution method such that the distribution method includes determining, in each current logical node, candidate source nodes among the plurality of logical nodes, and triggering, on each candidate source node, execution of an assigning-rows-to-node step, where the identified source node is a node of the candidate source node that identified the current logical node as the target node, and replacing the pushing step with a pulling step, where the pulling step is executed at the current logical node to perform retrieval.

[0019] This embodiment can apply new distribution rules to each original table on the candidate node to identify which rows go to which node, and a storage method is performed on the target node (rather than on the source node) to copy the data according to the distribution method. This embodiment can be advantageous because it can be seamlessly integrated into existing systems. For example, the distribution rules can remain unchanged, and existing distribution methods can be adapted according to the improved distribution according to the present subject matter by adapting the storage method.

[0020] According to one embodiment, the candidate source nodes are all logical nodes of the plurality of logical nodes, or nodes of the plurality of logical nodes that are predicted to provide data to the current logical node according to the distribution rules. The current logical node can query the candidate source nodes to identify which rows are to be copied to the current logical node. The candidate logical nodes can be all logical nodes of the distributed database system. This can be advantageous because it can improve distribution efficiency by reducing the probability of missing a node that has data to be copied to the current logical node to nearly zero. In another example, the candidate logical nodes can be nodes of the plurality of logical nodes that are predicted to contain data to be copied to the current logical node, for example, because the original table may not be present on all logical nodes, but only on a true subset of them. This can be predicted by using historical data, including, for example, log data resulting from the execution of the distribution method on a previous table. This can be advantageous because it can save processing resources that would otherwise be required to unnecessarily apply the distribution rules to some nodes that do not contain data to be copied to the current logical node.

[0021] According to one embodiment, performing the step of assigning rows to nodes includes creating a lookup table that includes distinct values ​​of the distribution key of the distribution rule and associated target nodes, and using the created table to identify the target nodes and corresponding rows. For example, the lookup table can be created once and then used by each node.

[0022] This embodiment can be advantageous because, because the lookup table has many fewer columns, building the lookup table can be much faster than copying all rows from the original table to the new table. Therefore, the amount of data in the lookup table is significantly smaller, which means fewer resources are needed to build the lookup table (even though twice as many network communications are required for each lookup row). The lookup table can have significantly fewer rows if the values ​​used in the distribution rule of the new table are not unique but have duplicates. For example, only one row may be created in the lookup table for each distinct value. For example, if the original table has an index on column C and this column C is used in the new distribution rule, it may be sufficient to scan only the index, which can be much faster than scanning the entire table. Therefore, building the lookup table itself can be much faster overall.

[0023] According to one embodiment, the method further includes sorting the retrieved rows and storing the retrieved rows in a target table in the sorted order. This embodiment may allow for physically sorting / ordering the rows to optimize the storage layout. This embodiment may be further advantageous because the sort is performed on all pulled rows at once. This is in contrast to a push approach, where the sort is repeated multiple times for the same number of rows to be stored.

[0024] According to one embodiment, a distributed database system is configured to distribute table rows across a plurality of logical nodes according to a first distribution method, the method being performed in response to receiving a request to redistribute the rows according to a second distribution method including distribution rules.

[0025] FIG. 1 illustratively illustrates a distributed database system 100 according to an example of the present subject matter. Distributed database system 100 includes logical nodes 101.1, 101.2, and 101.3 (collectively referred to as nodes 101). Nodes 101 may be communicatively coupled to one another via a computer network (not shown). Although three nodes are shown in FIG. 1, this is for illustrative purposes only. In reality, there may be hundreds of nodes. Nodes may also be referred to as logical database partitions, where a database partition is a portion of a database that consists of its own data, indexes, configuration files, and transaction logs. Thus, distributed database system 100 enables a partitioned database environment. Logical database partitions differ from physical partitions in that they are not given control of an entire machine. While machines have shared resources, database partitions may not share resources. Processors are shared, but disks and memory are not. For example, two or more database partitions (regardless of the number of processors) may coexist on the same machine.

[0026] The distributed database system 100 may be configured to store data for a table T of an application 103, such as an IBM Db2® Analytics Accelerator (IDAA) appliance. The distributed database system 100 may be configured to implement a data organization scheme according to an initial distribution method in which rows of table T are partitioned across nodes 101 according to values ​​of one or more table columns. As shown in FIG. 1 , each node 101 has an original table (named the “original table”) that stores rows initially assigned to that node according to the initial distribution method. Partitioning or distribution of data may improve performance and simplify data management. The application 103 may be configured to store, manage, and access data in the distributed database system 100. For example, the initially distributed tables in the distributed database system 100 may be created on the fly, e.g., from other existing tables. The source table for each logical node may have its respective set of rows populated based on a pull approach, using, for example, the following SQL statement: INSERT INTO <source_table>; SELECT *; FROM (SELECT data FROM other_table1, other_table2 WHERE...); WHERE <predicate identifying rows to be stored in the current destination node>; ORDER BY...

[0027] This initial storage of table T in each original table of the logical node may be optional. For example, creating a physical "original table" in the first place may not be necessary because data can be collected from other tables and stored directly in the "new table" (with the desired distribution), as described below. In such a situation, the "original table" may be virtual, and its data is the result set of the statement "(SELECT data FROM... WHERE...)". This does not cause the "original table" to be created as an actual table and to have data stored in it.

[0028] After initial storage of table T in distributed database system 100, distributed database system 100 may be configured to (re)distribute rows of table T across multiple logical nodes 101.1 through 101.3 according to a second distribution method. The second distribution method may be executed in each logical node of the multiple logical nodes 101.1 through 101.3. FIG. 1 illustrates execution of the second distribution method in logical node 101.1, which is therefore considered the coordinator node. The second distribution method may include steps of assigning and pushing rows to nodes. The execution of the step of assigning rows to nodes in a specific logical node comprises identifying, according to distribution rules, target nodes and rows of the specific logical node's original table that will be copied to the target nodes. The distribution rules may include, for example, a condition on the distribution key of table T. The distribution key may have one or more attributes of table T. The distribution key of the second distribution method may differ from the distribution key of the initial distribution method. The pushing step involves copying rows of the original table from a unique logical node to each identified target node. This is indicated by the three arrows from coordinator node 101.1 to the new table. Thus, after executing the second distribution method at each of nodes 101.1 through 101.3, the table rows may be stored in a new table (respectively named "new table") across nodes 101.1 through 101.3 according to the distribution rules. Thus, a logical node may have an original table with rows of table T distributed according to the initial distribution method, and a new table with rows of table T distributed according to another, different distribution method.

[0029] For example, assume that the distribution key for the second distribution method is attribute ID of table T. The distribution rule may apply a round-robin algorithm to each value of the distribution key using the following function MOD(ID,3), which provides the value of attribute ID times the remainder of 3, where 3 refers to the number of nodes 101.1 through 101.3. The result of the function MOD(ID,3) may be a number that identifies one of nodes 101.1 through 101.3. For example, execution of the second distribution method on node 101.1 may identify three groups of rows that need to be stored on nodes 101.1, 101.2, and 101.3, respectively. Node 101.1 may then send two groups of rows to the respective nodes for storage, using, for example, INSERT statements, and store the third group of rows, assigned to node 101.1, locally in a new table. Similarly, execution of the second distribution method on node 101.2 may identify three groups of rows that need to be stored on nodes 101.1, 101.2, and 101.3, respectively, and so on. As indicated in FIG. 1, the redistributed rows are stored in a new table in node 101. Thus, after redistribution, each of the nodes may have one original table and one new table, each with different rows of table T, and the original and new tables may be associated with different distribution keys, for example. Nevertheless, these distribution methods can be challenging because connecting to each node and executing INSERT statements on each node results in n INSERT statements running simultaneously on each node, each of which requires space (data pages / extents) to store the rows to be written. This distribution of rows for table T may be further improved by the present subject matter by using another distribution method, such as those described with reference to FIGS. 2A, 2B, 2C, and 2D.

[0030] FIG. 2A is a flowchart of a method for distributing table rows in a distributed database system. The method described in FIG. 2A may be implemented in the system shown in FIG. 1, but is not limited to this implementation. The method of FIG. 2A may be performed for each logical node 101.1, 101.2, and 101.3. Results of these implementations are illustrated using FIGS. 2B, 2C, and 2D. The method of FIG. 2A can provide, for example, an alternative implementation of the initial or second distribution methods described above.

[0031] The application 103 may connect to a current logical node in step 201. The current logical node may therefore be the coordinator node. Since all logical nodes are part of the same database system, the coordinator node may be responsible for the entire processing of an SQL statement, for example, by delegating parts of the statement to other nodes.

[0032] For example, connecting to a unique node can be achieved in ODBC using the attribute "ConnectNode=X," where X is the numeric identifier of the unique node. Database requests from application 103 may be converted into a communications protocol suitable for use by distributed database system 100. These requests are received and processed by the node at the other end of the connection. This can allow application 103 to operate as if it were accessing a local database.

[0033] The current logical node may identify rows from source nodes of multiple logical nodes that will be stored in a new table on the current logical node according to their unique distribution rules in step 203. For example, step 203 may execute an SQL statement that simply selects rows from all logical nodes that will be stored on the current logical node according to their unique distribution rules. Continuing the example of Figure 1, the source table in each logical node may be used to select rows that need to be copied to the current logical node according to distribution rules that include the MOD function.

[0034] The identified rows may be retrieved from the original table and stored in a new table in the current logical node in step 205. This may allow rows to be pulled from the source node to the current logical node. Execution of steps 203 and 205 may be triggered or initiated by application 103. For example, application 103 may control (e.g., through control signals) the current logical node to perform steps 203 and 205.

[0035] The two steps 203 and 205 may be performed using, for example, the following SQL statements: INSERT INTO "new table"; SELECT * FROM "original table"; WHERE <predicate identifying rows to be stored in the current destination node>; ORDER BY...

[0036] The final statement, ORDER BY, allows the selected rows to be sorted before being inserted or stored in the new table according to the sort order. The coordinator node may prepare an SQL statement and send the query portion of the SQL statement (i.e., the SELECT statement with the WHERE clause) to each logical node. Each logical node executes this SELECT statement and produces a (partial) result set of data in which it stores the data itself. Each logical node sends its (partial) result set back to the coordinator node. These are indicated by the black arrows in Figures 2B, 2C, and 2D, pointing from the original table to the coordinator node. The coordinator node combines all partial result sets (including the one it produced), sorts all rows, and then writes all rows to the new table.

[0037] The predicate of the WHERE statement allows you to select the rows that will be copied in the current logical node. The predicate of the WHERE statement identifies all the rows that will be stored in the current logical node.

[0038] In the first predicate example, the predicate may be defined using a distribution rule such as: Following the above distribution rule including the MOD function, the predicate (and therefore the WHERE statement) is defined as WHERE MOD(ID,3) = CURRENT DBPARTITIONNUM, where CURRENT DBPARTITIONNUM refers to the identifier of the current logical node.

[0039] In the second predicate example, the predicate may be defined as follows: A lookup table may be built on each of the nodes as follows: CREATE TABLE "lookup table" (<new distribution key column>) DISTRIBUTE BY (...); INSERT INTO "lookup table"; SELECT UNIQUE <new distribution key column>; FROM "original table".

[0040] The lookup table contains all of the values ​​on which the row distribution is based. Because the lookup table is a regular table and uses the same distribution key as the new table, all rows inserted into the lookup table will already use the target distribution. The benefit is that the lookup table has many fewer columns, so building the lookup table can be much faster than copying all rows from the original table to the new table. Therefore, the amount of data in the lookup table will be significantly smaller, which means fewer resources are needed to build the lookup table, even though twice as much network communication may be required for each lookup row.

[0041] If a lookup table exists, the WHERE clause may be defined as follows: WHERE <distribution key column> IN; (SELECT *; FROM "lookup table"; WHERE DBPARTITIONNUM(id) = CURRENT DBPARTITIONNUM).

[0042] Here, the id argument refers to one of the columns in the "lookup table." The WHERE clause identifies all rows in the "original table" that will be stored in the current logical node according to the new distribution rules. This is done by identifying all values ​​(or combinations) of the distribution key that are actually stored in the current node. Therefore, all rows in the "original table" that have the same value for the distribution key will also be stored in the current logical node. Since each of these rows simply has these columns in the (new) distribution key, each of these rows can be used to identify all rows in the original table that will be copied to the current logical node.

[0043] If the algorithm for performing steps 203 and 205 becomes more complex, the algorithm may be considered to be implemented with a user-defined function rather than native SQL. Thus, in the third example predicate, a user-defined function (e.g., named getTargetLogicalNode) may be used. The distributed database system 100 may already be implementing a distribution method. The user-defined function can be written to take advantage of this. The user-defined function may receive as input the values ​​of the columns involved in the new distribution key. The user-defined function passes the values, along with a list of distribution key columns, to the database system. The database system determines the target node for the received values. The target node is returned by the function. In this case, the SQL statement would be: INSERT INTO "new_table"; SELECT * FROM "original_table"; WHERE getTargetLogicalNode(<distribution_key_column>) = CURRENT_DBPARTITIONNUM; ORDER BY...

[0044] Continuing with the example of the distributed database system 100 of FIG. 1, the method of FIG. 2 may allow steps 201 through 205 to be executed three times in each of the three logical nodes 101; that is, steps 201 through 205 may be executed in each of the three logical nodes 101. This is indicated in FIGS. 2B, 2C, and 2D. FIG. 2B illustrates the results of executing steps 201 through 205 for logical node 101.1, which is considered the coordinator node. The arrows pointing from the original tables to the coordinator node in FIG. 2B indicate the transmission of selected rows from each original table that need to be stored in coordinator node 101.1. All received rows are sorted by coordinator node 101.1 and then stored in a new table in coordinator node 101.1. Similarly, FIG. 2C illustrates the results of executing steps 201 through 205 for logical node 101.2, which is considered the coordinator node. The arrows pointing from the original tables to the coordinator node in Figure 2C indicate the transmission of selected rows from each original table that need to be stored in the coordinator node 101.2. All received rows are sorted by the coordinator node 101.2 and then stored in a new table in the coordinator node 101.2. Figure 2D indicates the result of executing steps 201 to 205 for logical node 101.3, which is considered the coordinator node. The arrows pointing from the original tables to the coordinator node in Figure 2D indicate the transmission of selected rows from each original table that need to be stored in the coordinator node 101.3. All received rows are sorted by the coordinator node 101.3 and then stored in a new table in the coordinator node 101.3.

[0045] Figure 3 is a flowchart of a method for distributing rows of a table in a distributed database system. The method described in Figure 3 may be implemented in the system shown in Figure 1, but is not limited to this implementation. The method of Figure 3 may be implemented by each logical node of logical nodes 101.1 to 101.3, and each logical node may be referred to as a coordinated node.

[0046] In step 301, a coordinated node may receive a request from a coordinator node to select rows to be stored in the coordinator node. Upon receiving the request, the coordinated node may select rows from the coordinated node's origin table to be stored in the coordinator node in step 303. To this end, distribution rules of a distribution method may be applied to rows in the origin table to identify rows to be assigned to the coordinator node. The coordinated node may send the selected rows to the coordinator node in step 305.

[0047] 4 is a flowchart of a method for distributing rows of a table in a distributed database system. The method described in FIG. 4 may be implemented in the system shown in FIG. 1, but is not limited to this implementation. The method of FIG. 4 may be implemented by each of logical nodes 101.1 to 101.3, and each logical node may be referred to as a coordinator node.

[0048] In step 401, the coordinator node may receive a request from an application 103. The request may be to store rows of a table on the coordinator node according to a distribution method. The received request may include, for example, the following SQL statements: INSERT INTO <new table>; SELECT * FROM <old table>; WHERE <predicate identifying rows to be stored on the currently connected node>; ORDER BY...

[0049] The coordinator node may execute the SQL statement in step 403. Because all logical nodes are part of the same database system, the coordinator node is responsible for the overall processing of the SQL statement. The coordinator node delegates this portion to other nodes. More specifically, the coordinator node prepares the SQL statement and sends the query portion (just the lines "SELECT * FROM... WHERE...") to each logical node. Each logical node executes this SELECT statement and produces a (partial) result set for the data it has stored. Each node sends its (partial) result set back to the coordinator node. The coordinator may also execute the SELECT statement locally to produce its own partial results.

[0050] The coordinator node, in step 405, combines all partial result sets (including the one it produced), sorts all rows, and then writes all rows to a new table.

[0051] FIG. 5 depicts a general computerized system 700 suitable for performing at least some of the method steps as included in this disclosure.

[0052] It will be understood that the methods described herein may be at least partially automated by a computerized system, such as a server or embedded system, rather than interactively. However, in exemplary embodiments, the methods described herein may be implemented (in part) in an interactive system. These methods may also be implemented in software 712, 722 (including firmware 722), hardware (processor) 705, or a combination thereof. In exemplary embodiments, the methods described herein are implemented in software, such as an executable program, and executed by a specialized or general-purpose digital computer, such as a personal computer, workstation, minicomputer, or mainframe computer. Thus, the most general system 700 includes a general-purpose computer 701.

[0053] In an exemplary embodiment, from a hardware architecture perspective, as shown in FIG. 5, a computer 701 includes a processor 705, a memory (main memory) 710 coupled to a memory controller 715, and one or more input / output (I / O) devices 10, 745 communicatively coupled via a local I / O controller 735. The I / O controller 735 can be, but is not limited to, one or more buses or other wired or wireless connections as known in the art. The I / O controller 735 may include additional elements, such as controllers, buffers (caches), drivers, repeaters, and receivers, to enable communication; however, these elements are omitted for brevity. Additionally, the local interface includes address, control, and / or data connections to enable appropriate communication between the aforementioned components. As described herein, the I / O devices 10, 745 may generally include any common cryptographic or smart card known in the art.

[0054] Processor 705 is a hardware device for executing software, particularly software stored in memory 710. Processor 705 can be any custom or commercially available processor, a central processing unit (CPU), a coprocessor among several processors associated with computer 701, a semiconductor-based microprocessor (in the form of a microchip or chip set), or generally any device for executing software instructions.

[0055] The memory 710 can include any one or combination of volatile memory elements (e.g., random access memory (RAM, such as DRAM, SRAM, SDRAM, etc.)) and non-volatile memory elements (e.g., ROM, erasable programmable read-only memory (EPROM), electronically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM)). It should be noted that the memory 710 can have a distributed architecture in which various components are located remotely from one another, yet are capable of being accessed by the processor 705.

[0056] The software in memory 710 may include one or more separate programs, each of which comprises an ordered list of executable instructions for performing logical functions, such as functions specifically included in embodiments of the present invention. In the example of Figure 5, the software in memory 710 includes instructions, such as instructions for managing a database, such as a database management system.

[0057] The software in memory 710 will also typically include a suitable operating system (OS) 711. The OS 711 essentially controls the execution of other computer programs, such as software 712, possibly for performing methods as described herein.

[0058] The methods described herein in software 712 may be in the form of a source program, an executable program (object code), a script, or any other entity comprising a set of instructions to be performed. When a source program, the program must be translated via a compiler, assembler, interpreter, or the like to operate properly in connection with OS 711, and these may or may not be contained within memory 710. Furthermore, the methods may be written in an object-oriented programming language with classes of data and methods, or in a procedural programming language with routines, subroutines, or functions, or a combination thereof.

[0059] In an exemplary embodiment, a conventional keyboard 750 and mouse 755 can be coupled to the input / output controller 735. Other output devices, such as I / O devices 745, may include input devices, for example, but not limited to, printers, scanners, microphones, and the like. Finally, I / O devices 10, 745 may further include devices that communicate both input and output, for example, but not limited to, network interface cards (NICs) or modulators / demodulators (for accessing other files, devices, systems, or networks), radio frequency (RF) or other transceivers, telephone interfaces, bridges, routers, and the like. I / O devices 10, 745 can be any common cryptographic or smart card known in the art. System 700 can further include a display controller 725 coupled to a display 730. In an exemplary embodiment, system 700 can further include a network interface for coupling to a network 765. Network 765 may be an IP-based network for communication between computer 701 and any external servers, clients, and the like via a broadband connection. Network 765 transmits and receives data between computer 701 and external systems 30, which may be included to perform some or all of the method steps discussed herein. In an exemplary embodiment, network 765 may be a managed IP network operated by a service provider. Network 765 may also be implemented wirelessly using wireless protocols and technologies such as WiFi, WiMAX, etc. Network 765 may also be a packet-switched network, such as a local area network, wide area network, metropolitan area network, Internet network, or other similar type of network environment.The network 765 may be a fixed wireless network, a wireless local area network (WLAN), a wireless wide area network (WWAN), a personal area network (PAN), a virtual private network (VPN), an intranet, or other suitable network system, and includes equipment for transmitting and receiving signals.

[0060] If computer 701 is a PC, workstation, intelligent device, or the like, the software in memory 710 may further include a basic input / output system (BIOS) contained in firmware 722. The BIOS is a set of fundamental software routines that initializes and tests hardware at startup, starts the OS 711, and supports data transfer between hardware devices. The BIOS is stored in ROM so that the BIOS can be executed when computer 701 is activated.

[0061] When computer 701 is in operation, processor 705 is configured to execute software 712 stored in memory 710, to communicate data to and from memory 710, and to generally control the operation of computer 701 in accordance with the software. The methods and OS 711 described herein are loaded by processor 705, possibly buffered within processor 705, and then executed, in whole or in part, but typically the latter.

[0062] 5, the methods can be stored on any computer-readable medium, such as storage 720, for use by or in connection with any computer-related system or method. Storage 720 may include disk storage, such as HDD storage.

[0063] The present invention may be a system, method, and / or computer program product at any possible level of technical detail of integration. The computer program product may include a computer-readable storage medium (or media) having computer-readable program instructions for causing a processor to carry out aspects of the present invention.

[0064] A computer-readable storage medium can be a tangible device capable of retaining and storing instructions for use by an instruction execution device. A computer-readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of computer-readable storage media includes portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disks (DVDs), memory sticks, floppy disks, mechanically encoded devices such as punch cards or ridge-in-groove structures having instructions recorded thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein should not be construed as signals that are transitory in nature, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., light pulses passing through fiber optic cable), or electrical signals transmitted through wires.

[0065] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device or to an external computer or storage device over a network, such as the Internet, a local area network, a wide area network, or a wireless network, or a combination thereof. The network may comprise copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, or edge servers, or a combination thereof. A network adapter card or network interface within each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage on a computer-readable storage medium within the respective computing / processing device.

[0066] Computer-readable program instructions for carrying out operations of the present invention may be source or object code written in any combination of one or more programming languages, including assembler instructions, instruction set architecture (ISA) instructions, machine language instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, configuration data for integrated circuit devices, or object-oriented programming languages ​​such as Smalltalk®, C++, or the like, and procedural programming languages ​​such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be to an external computer (e.g., through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry devices, including, for example, programmable logic devices, field programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), can execute computer readable program instructions by utilizing state information of the computer readable program instructions to individualize the electronic circuitry devices to implement aspects of the present invention.

[0067] Aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0068] These computer-readable program instructions may be provided to a processor of a computer or other programmable data processing apparatus to produce a machine, the instructions of which execute by the processor of the computer or other programmable data processing apparatus to produce means for performing the functions / acts specified in one or more blocks of the flowcharts and / or block diagrams. These computer-readable program instructions may also be stored on a computer-readable storage medium such that the computer-readable storage medium comprises an article of manufacture including instructions for performing aspects of the functions / acts specified in one or more blocks of the flowcharts and / or block diagrams, and may direct a computer, programmable data processing apparatus, or other device, or combination thereof, to function in a particular manner.

[0069] The computer-readable program instructions may also be loaded into a computer, other programmable data processing apparatus, or other device such that the instructions, executing on the computer, other programmable apparatus, or other device, cause a series of operational steps to be performed on the computer, other programmable apparatus, or other device to produce a computer-executed process to perform the functions / acts specified in one or more blocks of the flowcharts and / or block diagrams.

[0070] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of instructions, including one or more executable instructions for performing specified logical functions. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may actually be performed as a single step performed concurrently, substantially concurrently, partially, or fully in a time-overlapping manner, or the blocks may sometimes be performed in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or acts or executes a combination of dedicated hardware and computer instructions.

Claims

1. 1. A computer-implemented method for copying rows of a table across logical nodes in a distributed database system, comprising, for each logical node of a plurality of logical nodes, performing, by one or more computer processors: connecting to a current logical node of the plurality of logical nodes; selecting one or more rows from one or more source nodes of the plurality of logical nodes to be stored in a target table on the current logical node, the one or more rows being selected based on distribution rules for distributing data in the distributed database system; storing the one or more rows in the target table, wherein the one or more rows are pulled from the one or more source nodes and stored in the current logical node; Including, the one or more candidate source nodes of the plurality of logical nodes are selected from the group consisting of all logical nodes of the plurality of logical nodes and all predicted nodes of the plurality of logical nodes that are predicted to provide data to the current logical node, and the one or more candidate source nodes of the plurality of logical nodes are each node of the one or more candidate source nodes that identified the current logical node as a target node; method.

2. The selecting creating an original table within each current logical node of the plurality of logical nodes to store the one or more rows from the one or more source nodes of the plurality of logical nodes associated with each node; The computer-implemented method of claim 1 further comprising:

3. The selecting applying, by the one or more computer processors, an initial distribution rule to select the one or more rows from the one or more source nodes of the plurality of logical nodes to be stored in the target table, wherein the one or more rows are not stored in the target table. The computer-implemented method of claim 1 further comprising:

4. 4. The computer-implemented method of claim 3, wherein the distribution rule is different from the initial distribution rule, the initial distribution rule being associated with an initial store of the distributed database system.

5. 4. The computer-implemented method of claim 3, wherein the distribution rule is the same as the initial distribution rule, the initial distribution rule being associated with an initial store of the distributed database system.

6. The selecting determining one or more candidate source nodes of the plurality of logical nodes, wherein the candidate source nodes are selected from a group including all logical nodes of the plurality of logical nodes and all predicted nodes of the plurality of logical nodes that are predicted to provide data to the current logical node, and further wherein the one or more candidate source nodes of the plurality of logical nodes have identified the current logical node as the target node; assigning each of the one or more rows to one logical node of the plurality of logical nodes in which each of the one or more rows will be stored, wherein each of the one or more rows is assigned using the distribution rule for distributing the data within the distributed database system; The computer-implemented method of claim 1 further comprising:

7. The storing creating a lookup table containing distinct values ​​of the distribution key for said distribution rule; using the lookup table to identify the target node and one or more corresponding rows; The computer-implemented method of claim 1 further comprising:

8. 2. The computer-implemented method of claim 1, further comprising sorting the one or more rows selected from the one or more source nodes of the plurality of logical nodes and storing the one or more rows in the target table according to the sorted order.

9. 2. The computer-implemented method of claim 1, wherein the distributed database system is configured to distribute the one or more rows of the table across the plurality of logical nodes according to a first distribution method, and further wherein the distribution is performed in response to receiving a request to redistribute rows according to a second distribution method using the distribution rules.

10. 10. The computer-implemented method of claim 9, wherein the first distribution method is an initial distribution method configured to initially distribute rows of the table in the distributed database system, resulting in the plurality of logical nodes having respective rows of the table.

11. The selecting determining one or more candidate source nodes of the plurality of logical nodes; sending a selection request to each candidate source node of the plurality of logical nodes to select a row to be stored in the current logical node; receiving one or more identified rows from the candidate logic node in response to said selection request being sent; The computer-implemented method of claim 1 further comprising:

12. 2. The computer-implemented method of claim 1, wherein the distribution rules include at least one of distributing rows evenly across the plurality of logical nodes, grouping all rows within a specified range of a distribution key within the same logical node, and grouping all rows with similar values ​​of the distribution key within the same logical node.

13. 13. A computer program for copying table rows across logical nodes in a distributed database system, the computer program causing one or more computer processors to perform, for each logical node of a plurality of logical nodes, the steps of the method of any one of claims 1 to 12.

14. 1. A computer system including one or more computer processors and one or more computer-readable storage media, The one or more computer-readable storage media store the computer program of claim 13, execution, by at least one of the one or more computer processors, of the procedures of the computer program to copy the rows of the table across the logical nodes in the distributed database system; Computer systems.

Citation Information

Patent Citations

  • Data processing program and data processing method

    JP2015072629A

  • Control device, distributed database system, method, and program

    JP2016095561A

  • Distributed embedded data and knowledge management system integrated with historians

    JP2019505886A

  • Data transmission method and apparatus

    US20180262590A1