A distributed database data processing method and device

By creating column groups containing columns to be associated and generating sub-tables in a distributed database, the problem of data redistribution during associated queries between two tables is solved, data processing efficiency is improved, and network pressure and time overhead are reduced.

CN112181989BActive Publication Date: 2024-09-03ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011086069.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-12
Publication Date
2024-09-03
Estimated Expiration
2040-10-12

AI Technical Summary

Technical Problem

In the existing technology, when two tables are associated with a query, the data of one table needs to be redistributed, which leads to increased network pressure and time overhead. There is no effective solution yet.

Method used

By receiving business requirements for columns to be correlated that contain the same attributes, create the first column group and the second column group including the columns to be correlated, and distribute the data according to these column groups to generate subtables to reduce data redistribution during correlation queries. need.

Benefits of technology

Through this method, the data redistribution process during related queries is reduced, data processing efficiency is improved, and network pressure and time overhead are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112181989B
    Figure CN112181989B
Patent Text Reader

Abstract

The present invention provides a data processing method and device for a distributed database, wherein the method comprises: receiving a business demand for columns to be associated including the same attributes in a first table and a second table, wherein the first table and the second table at least include one column of data with the same attributes; creating the first table including a first column group and the second table including a second column group according to the business demand, wherein the first column group and the second column group both include the column to be associated; distributing data in the first table according to the first column group, and distributing data in the second table according to the second column group, which can solve the problem in the related art that the data of one table needs to be redistributed when two tables are associated and queried, thereby increasing network pressure and time overhead. According to actual business use requirements, multiple column groups are included when creating a table to control the distribution method of data, so that there is no need to redistribute the data of the table during the associated query, thereby accelerating the efficiency of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a method and device for processing data in a distributed database. Background Art

[0002] In the current open source database Greenplum, in order to implement a join query between two tables, if the column to be joined (associated) in the where condition is different from the distribution key of a table, the data of the table needs to be redistributed according to the associated columns (i.e. data redistribution), which is similar to the Shuffle mechanism in the Hadoop ecosystem.

[0003] The data processing methods for distributed relational databases proposed in related technologies are time-consuming to calculate data distribution and formulate data redistribution plans. If they are performed on one node, the process will be serialized, resulting in low efficiency. Existing data migration algorithms generally seek to redistribute the data of each table to each node, which makes the cost of data redistribution too high. Data processing allows only one table to be redistributed when the two tables are associated and the connection conditions are not distribution keys.

[0004] In the related art, when querying two tables in association, the data of one table needs to be redistributed, which increases network pressure and time overhead. No solution has been proposed yet. Summary of the invention

[0005] The embodiment of the present invention provides a data processing method and device for a distributed database, so as to at least solve the problem in the related art that when two tables are associated for query, data of one table needs to be redistributed, which increases network pressure and time overhead.

[0006] According to an embodiment of the present invention, a data processing method of a distributed database is provided, comprising:

[0007] Receiving a business requirement including columns to be associated with the same attribute in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attribute;

[0008] Creating the first table including the first column group and the second table including the second column group according to the business requirements, wherein both the first column group and the second column group include the column to be associated;

[0009] The first table distributes data according to the first column group, and the second table distributes data according to the second column group.

[0010] Optionally, after creating the first table including the first column group and the second table including the second column group according to the business requirement, the method further includes:

[0011] Creating a corresponding first sub-table for the first column group, and sending the first sub-table to a plurality of data nodes, wherein the plurality of data nodes are used to store the first sub-table;

[0012] A corresponding second sub-table is created for the second column group, and the second sub-table is sent to the multiple data nodes, wherein the multiple data nodes are used to store the second sub-table.

[0013] Optionally, distributing data in the first table according to the first column group, and distributing data in the second table according to the second column group includes:

[0014] Determine a first hash value corresponding to the data in the first table according to the first column group, and insert the data in the first table into the first sub-tables of the multiple data nodes according to the first hash value;

[0015] The second hash value corresponding to the data in the second table is determined according to the second column group, and the data in the second table is inserted into the second sub-tables of the multiple data nodes according to the second hash value.

[0016] Optionally, the method further comprises:

[0017] When the first column group or the second column group includes at least two column groups and it is detected that a first target column group in the first column group or the second column group is deleted, a sub-table corresponding to the first target column group is deleted.

[0018] Optionally, after distributing data in the first table according to the first column group and distributing data in the second table according to the second column group, the method further includes:

[0019] Data association processing is performed on the first table and the second table according to a first sub-table corresponding to the first column group and a second sub-table corresponding to the second column group.

[0020] Optionally, performing data association processing on the first table and the second table according to the first sub-table corresponding to the first column group and the second sub-table corresponding to the second column group includes:

[0021] receiving an association query instruction, wherein the association query instruction includes an association condition between the first table and the second table, and the association condition includes the to-be-associated column;

[0022] determining a second target column group from the first column group according to the association condition;

[0023] Data association processing is performed between the subtable corresponding to the second target column group and the second table.

[0024] According to another embodiment of the present invention, there is also provided a data processing device for a distributed database, comprising:

[0025] A receiving module, configured to receive a business requirement including columns to be associated with the same attributes in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attributes;

[0026] A creation module, configured to create the first table including a first column group and the second table including a second column group according to the business requirements, wherein both the first column group and the second column group include the column to be associated;

[0027] The data distribution module is used to distribute the data in the first table according to the first column group, and to distribute the data in the second table according to the second column group.

[0028] Optionally, the device further comprises:

[0029] A first sending module, configured to create a corresponding first sub-table for the first column group, and send the first sub-table to a plurality of data nodes, wherein the plurality of data nodes are used to store the first sub-table;

[0030] The second sending module is configured to create a corresponding second sub-table for the second column group, and send the second sub-table to the multiple data nodes, wherein the multiple data nodes are configured to store the second sub-table.

[0031] Optionally, the distribution data module includes:

[0032] a first inserting submodule, configured to determine a first hash value corresponding to the data in the first table according to the first column group, and insert the data in the first table into the first subtables of the plurality of data nodes according to the first hash value;

[0033] The second insertion submodule is used to determine the corresponding second Hash value of the data in the second table according to the second column group, and insert the data in the second table into the second sub-tables of the multiple data nodes according to the second Hash value.

[0034] Optionally, the device further comprises:

[0035] The deleting module is configured to, when the first column group or the second column group includes at least two column groups and it is detected that a first target column group in the first column group or the second column group is to be deleted, delete the subtable corresponding to the first target column group.

[0036] Optionally, the device further comprises:

[0037] The association processing module is used to perform data association processing on the first table and the second table according to the first sub-table corresponding to the first column group and the second sub-table corresponding to the second column group.

[0038] Optionally, the association processing module includes:

[0039] A receiving submodule, configured to receive an association query instruction, wherein the association query instruction includes an association condition between the first table and the second table, and the association condition includes the to-be-associated column;

[0040] a determination submodule, configured to determine a second target column group from the first column group according to the association condition;

[0041] The association processing submodule is used to perform data association processing on the second table according to the subtable corresponding to the second target column group.

[0042] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0043] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0044] Through the present invention, after receiving a business demand for columns to be associated including the same attributes, a first table including a first column group and a second table including a second column group are created according to the business demand, data of the first table is distributed according to the first column group, and data of the second table is distributed according to the second column group. Since both the first column group and the second column group include columns to be associated, the first table distributes data according to the first column group, and the second table distributes data according to the second column group, so that the associated columns or column groups can be directly queried during an associated query, which can solve the problem in the related art that the data of one table needs to be redistributed during an associated query between two tables, thereby increasing network pressure and time overhead. According to actual business usage requirements, multiple column groups are included when creating a table to control the distribution method of data, so that there is no need to redistribute the data of the table during an associated query, thereby accelerating the efficiency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0046] Figure 1It is a hardware structure block diagram of a mobile terminal of a distributed database data processing method according to an embodiment of the present invention;

[0047] Figure 2 is a flow chart of a data processing method of a distributed database according to an embodiment of the present invention;

[0048] Figure 3 is a schematic diagram of a Greenplum distributed database according to an embodiment of the present invention;

[0049] Figure 4 is a schematic diagram of data distribution of an stu table according to an embodiment of the present invention;

[0050] Figure 5 is a block diagram of a data processing device for a distributed database according to an embodiment of the present invention;

[0051] Figure 6 It is a block diagram of a data processing device for a distributed database according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0052] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0053] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0054] Example 1

[0055] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal of a distributed database data processing method according to an embodiment of the present invention, such as Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0056] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data processing method of the distributed database in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0057] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0058] In this embodiment, a data processing method of a distributed database running on the above mobile terminal or network architecture is provided. Figure 2 is a flow chart of a data processing method of a distributed database according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0059] Step S202, receiving a business requirement including columns to be associated with the same attributes in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attributes;

[0060] Figure 3 is a schematic diagram of a Greenplum distributed database according to an embodiment of the present invention, such as Figure 3As shown in the figure, the master node receives the business requirements sent by the upper layer. The Greenplum architecture adopts MPP (massive parallel processing). In the MPP system, each physical node has its own operating system, database, etc. In other words, the CPU in each node cannot access the memory of another node. The information exchange between nodes is realized through the network interconnection between nodes. The Master node is also called the management node, which is responsible for cluster management, storing cluster metadata, and client interaction. The Segment node is also called the data node, and each data node only stores a part of the data.

[0061] The distribution strategy adopted in the embodiment of the present invention is DISTRIBUTED BY (column, […]), which calculates the corresponding hash value based on the specified column or columns as a whole to determine which segment node the data is distributed on.

[0062] In an embodiment of the present invention, the business requirement may be sent by an upper layer, and the business requirement may indicate the columns in two tables (the first table and the second table) that need to be associated. For example, the first table is the Stu table, and the second table is the Course table. The business requirement indicates that course_no in the student table is associated with course_no in the course table.

[0063] The table structure of the Stu table is as follows:

[0064] stu_no int Student ID Distribution Key stu_name text Student Name course_no int Elective course number

[0065] The table structure of the Course table is as follows:

[0066] course_no int Course Code Distribution Key course_name text Course Title tech_no int Teacher ID

[0067] Step S204, creating the first table including the first column group and the second table including the second column group according to the business requirements, wherein both the first column group and the second column group include the column to be associated;

[0068] Step S206: distribute data in the first table according to the first column group, and distribute data in the second table according to the second column group.

[0069] Through the above steps S202 to S206, the problem in the related art that the data of one table needs to be redistributed when two tables are associated for query, which increases network pressure and time overhead, can be solved. According to actual business usage requirements, multiple column groups are included when creating a table to control the distribution method of data, so that there is no need to redistribute the data of the table during associated query, thereby speeding up the efficiency of data processing.

[0070] In an optional embodiment, after the above step S204, a corresponding first sub-table is created for the first column group, and the first sub-table is sent to multiple data nodes, wherein the multiple data nodes are used to store the first sub-table; a corresponding second sub-table is created for the second column group, and the second sub-table is sent to the multiple data nodes, wherein the multiple data nodes are used to store the second sub-table.

[0071] In an embodiment of the present invention, the above-mentioned step S206 may specifically include: determining a corresponding first hash value for the data of the first table according to the first column group, and inserting the data of the first table into the first sub-table of the multiple data nodes according to the first hash value; determining a corresponding second hash value for the data of the second table according to the second column group, and inserting the data of the second table into the second sub-table of the multiple data nodes according to the second hash value.

[0072] In another optional embodiment, when the first column group or the second column group includes at least two column groups and deletion of a first target column group in the first column group or the second column group is detected, the subtable corresponding to the first target column group is deleted.

[0073] In another optional embodiment, after distributing data in the first table according to the first column group and distributing data in the second table according to the second column group, data association processing is performed on the first table and the second table according to a first sub-table corresponding to the first column group and a second sub-table corresponding to the second column group. Specifically, an association query instruction is received, wherein the association query instruction carries an association condition between the first table and the second table, and the association condition includes the column to be associated; a second target column group is determined from the first column group according to the association condition; and data association processing is performed on the second table according to the sub-table corresponding to the second target column group.

[0074] The following takes the case where the first table is the Stu table and the second table is the Course table as an example to illustrate the embodiment of the present invention.

[0075] The embodiment of the present invention specifies one or more {column groups} by extending the syntax of the distributed by clause of the table creation statement option, and implements multiple distribution strategies at the same time. By querying the {column group} of the table and the metadata information of the related sub-table, the data is inserted into the corresponding sub-table when the data is inserted. 3. By querying the {column group} of the table and the metadata information of the related sub-table, the appropriate sub-table is automatically selected for real data association during the association query. By adjusting (adding / deleting) the {column group} setting of the table, the distribution strategy of the table can be dynamically adjusted.

[0076] During the data storage phase, when building a table, the DISTRIBUTED BY (column, […]) distribution strategy is also used, but this embodiment designs the table to be distributed according to {column group}. Using this syntax DISTRIBUTED BY ({column, […]}, […]), in layman's terms, a table can distribute data according to multiple {column groups} at the same time. Based on this fact, a table may have N fields, but in the actual business use process, only a few columns (also called fields) are often used when associated with other tables for query, and a large part of the columns are only for data storage and display purposes. Therefore, only those columns that often need to be associated with other tables can be set as distributed {column groups}.

[0077] The format of the table creation statement for the Stu table is as follows:

[0078] Create a student table create table stu(

[0079] Student number stu_no int,

[0080] Student name stu_name text,

[0081] Elective course number (course_no int)

[0082] The data is distributed in the form of columns including student number and elective course number Distributed by ({stu_no}, {course_no}).

[0083] The format of the table creation statement for the Course table is as follows:

[0084] Create a course tablecreate table course(

[0085] Course number course_no int,

[0086] Course name course_name text,

[0087] Teacher number tech_no int)

[0088] The data is distributed in the form of columns including course number and tech number. Distributed by({course_no},{tech_no}).

[0089] If the stu table is the first table mentioned above, and the course table is the second table mentioned above, the first column group mentioned above may be a column group including student ID and elective course ID, the second column group mentioned above may be a column group including course ID and teacher ID, and the column to be associated may be course_no of the same attribute. It should be noted that the column to be associated in the embodiment of the present invention may be one or more columns. If one or more columns are used as the columns to be associated when creating a table, one or more columns in the columns to be associated may be included in the association condition when querying.

[0090] When a table has a {column group}, the corresponding sub-table will be automatically created based on the {column group} information. The naming rule can be: [table name]_g[column group number]. The column group numbers start from 1 and are arranged in the order in which they appear in the Distributed by clause. Similarly, when a {column group} is deleted, the corresponding sub-table will be automatically deleted. The metadata information of a table {column group} and its sub-tables is stored in the Master node. For a table with {column group} set, when inserting data, the data will be automatically inserted into the corresponding sub-table based on the {column group} information.

[0091] When querying data, if the master node receives the following SQL query: select * from stu,course where stu.course_no = course.course_no. When querying, the corresponding distribution {column group} is automatically selected according to the associated condition column, that is, the data distributed according to the column group course_no in the first table is selected and associated with the data distributed according to the column group course_no in the second table, so as to achieve the purpose of not requiring data redistribution. After using the SQL execution plan after {column group} distribution, it can be seen that there is no data redistribution (Redistribute Motion).

[0092] The query statement format is as follows:

[0093] QUERY PLAN (SQL statement execution plan)

[0094] Gather Motion 4:1(slice1;segments:4)(cost=1.01..743.60rows=47width=80)

[0095] #Data is aggregated to the master node, cost=xx is the estimated cost of execution

[0096] ->Hash Join(cost=1.01..743.60rows=12width=80)

[0097] #Perform a hash join

[0098] Hash Cond:(course.course_no=stu_g2.course_no)

[0099] #Hash join condition

[0100] ->Seq Scan on course(cost=0.00..567.00rows=11675width=40) performs a sequential scan on the course table

[0101] ->Hash(cost=1.00..1.00rows=1width=40)

[0102] #Put the data scanned by the stu table into the hash list

[0103] ->Seq Scan on stu(cost=0.00..1.00rows=1width=40)

[0104] #Perform a sequential scan on the stu table

[0105] Optimizer: Postgres query optimizer

[0106] #Describes the execution plan generated by the traditional optimizer

[0107] (7 rows)

[0108] #The number of rows executed by the entire plan

[0109] When implementing a query, if the stu table is associated with other tables, and the course_no column is used as the association condition in the where clause, the database will choose to use the stu_g2 subtable to perform the actual data association query based on the {column group} information of the table distribution, so as to achieve the purpose of not redistributing the data. Of course, if the stu_name column of the stu table is used to associate with other tables, data redistribution will still be required because no separate {column group} is set for the stu_name column above. Therefore, whether it is necessary to set a {column group} for a column needs to be considered based on the actual business situation, weighing the space occupation and time benefits of the data.

[0110] Data space usage: If n {column groups} are set when creating a table, the data space usage of the table will be n-1 times larger than the original storage space. This is the same as exchanging space for time. As for how many {column groups} to set for each table, a comprehensive balance should be made based on business usage and space configuration. In a production environment, due to temporary space shortage, you can use the syntax of modifying the table structure to temporarily delete a {column group} and temporarily deal with the disk space problem. However, it must be ensured that a table has at least one {column group}.

[0111] Figure 4 Schematic diagram of data distribution of the stu table according to an embodiment of the present invention, such as Figure 4 As shown in the figure, the data space storage is set to be distributed in two column groups, stu_no and course_no. Two {column groups} are set for the Stu table, so the data of the Stu table is stored twice in the cluster.

[0112] The embodiment of the present invention can set multiple data distribution modes on a table at the same time, that is, store data based on multiple column groups, dynamically manage (add / delete) {column groups} according to actual business usage requirements, and dynamically control data distribution strategies. The adjustment of the underlying {column groups} is unaware of the upper-layer business.

[0113] Example 2

[0114] According to another embodiment of the present invention, a data processing device for a distributed database is provided. Figure 5 is a block diagram of a data processing device for a distributed database according to an embodiment of the present invention. Figure 5 As shown, including:

[0115] A receiving module 52, configured to receive a business requirement including columns to be associated with the same attributes in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attributes;

[0116] A creation module 54, configured to create the first table including a first column group and the second table including a second column group according to the business requirements, wherein both the first column group and the second column group include the to-be-associated column;

[0117] The data distribution module 56 is configured to distribute data in the first table according to the first column group, and distribute data in the second table according to the second column group.

[0118] Figure 6 is a block diagram of a data processing device for a distributed database according to a preferred embodiment of the present invention. Figure 6 As shown, the device also includes:

[0119] A first sending module 62, configured to create a corresponding first sub-table for the first column group, and send the first sub-table to a plurality of data nodes, wherein the plurality of data nodes are used to store the first sub-table;

[0120] The second sending module 64 is configured to create a corresponding second sub-table for the second column group, and send the second sub-table to the multiple data nodes, wherein the multiple data nodes are configured to store the second sub-table.

[0121] Optionally, the distribution data module 56 includes:

[0122] a first inserting submodule, configured to determine a first hash value corresponding to the data in the first table according to the first column group, and insert the data in the first table into the first subtables of the plurality of data nodes according to the first hash value;

[0123] The second insertion submodule is used to determine the corresponding second Hash value of the data in the second table according to the second column group, and insert the data in the second table into the second sub-tables of the multiple data nodes according to the second Hash value.

[0124] Optionally, the device further comprises:

[0125] The deleting module is configured to, when the first column group or the second column group includes at least two column groups and it is detected that a first target column group in the first column group or the second column group is to be deleted, delete the subtable corresponding to the first target column group.

[0126] Optionally, the device further comprises:

[0127] The association processing module is used to perform data association processing on the first table and the second table according to the first sub-table corresponding to the first column group and the second sub-table corresponding to the second column group.

[0128] Optionally, the association processing module includes:

[0129] A receiving submodule, configured to receive an association query instruction, wherein the association query instruction includes an association condition between the first table and the second table, and the association condition includes the to-be-associated column;

[0130] a determination submodule, configured to determine a second target column group from the first column group according to the association condition;

[0131] The association processing submodule is used to perform data association processing on the second table according to the subtable corresponding to the second target column group.

[0132] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0133] Example 3

[0134] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0135] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0136] S1, receiving a business requirement including columns to be associated with the same attributes in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attributes;

[0137] S2, creating the first table including the first column group and the second table including the second column group according to the business requirements, wherein both the first column group and the second column group include the column to be associated;

[0138] S3, distributing data in the first table according to the first column group, and distributing data in the second table according to the second column group.

[0139] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0140] Example 4

[0141] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0142] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0143] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0144] S1, receiving a business requirement including columns to be associated with the same attributes in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attributes;

[0145] S2, creating the first table including the first column group and the second table including the second column group according to the business requirements, wherein both the first column group and the second column group include the column to be associated;

[0146] S3, distributing data in the first table according to the first column group, and distributing data in the second table according to the second column group.

[0147] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0148] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0149] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data processing method for a distributed database, characterized in that: include: Receiving a business requirement including columns to be associated with the same attribute in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attribute; Creating the first table including the first column group and the second table including the second column group according to the business requirements, wherein both the first column group and the second column group include the column to be associated; Creating a corresponding first sub-table for the first column group, and sending the first sub-table to a plurality of data nodes, wherein the plurality of data nodes are used to store the first sub-table; Creating a corresponding second sub-table for the second column group, and sending the second sub-table to the multiple data nodes, wherein the multiple data nodes are used to store the second sub-table; Distributing data in the first table according to the first column group, and distributing data in the second table according to the second column group, includes: determining a corresponding first hash value for the data in the first table according to the first column group, and inserting the data in the first table into the first sub-table of the multiple data nodes according to the first hash value; determining a corresponding second hash value for the data in the second table according to the second column group, and inserting the data in the second table into the second sub-table of the multiple data nodes according to the second hash value.

2. The method according to claim 1, characterized in that The method further comprises: When the first column group or the second column group includes at least two column groups and it is detected that a first target column group in the first column group or the second column group is deleted, a sub-table corresponding to the first target column group is deleted.

3. The method according to claim 1, characterized in that After distributing data in the first table according to the first column group and distributing data in the second table according to the second column group, the method further includes: Data association processing is performed on the first table and the second table according to a first sub-table corresponding to the first column group and a second sub-table corresponding to the second column group.

4. The method according to claim 3, characterized in that Performing data association processing on the first table and the second table according to the first sub-table corresponding to the first column group and the second sub-table corresponding to the second column group includes: receiving an association query instruction, wherein the association query instruction includes an association condition between the first table and the second table, and the association condition includes the to-be-associated column; determining a second target column group from the first column group according to the association condition; Data association processing is performed between the subtable corresponding to the second target column group and the second table.

5. A data processing device for a distributed database, characterized in that: include: A receiving module, configured to receive a business requirement including columns to be associated with the same attributes in a first table and a second table, wherein the first table and the second table include at least one column of data with the same attributes; A creation module, configured to create, according to the business requirement, the first table including a first column group and the second table including a second column group, wherein both the first column group and the second column group include the column to be associated; A first sending module, configured to create a corresponding first sub-table for the first column group, and send the first sub-table to a plurality of data nodes, wherein the plurality of data nodes are used to store the first sub-table; A second sending module, configured to create a corresponding second sub-table for the second column group, and send the second sub-table to the multiple data nodes, wherein the multiple data nodes are used to store the second sub-table; a data distribution module, configured to distribute data in the first table according to the first column group, and distribute data in the second table according to the second column group; Wherein, the distribution data module includes: a first inserting submodule, configured to determine a first hash value corresponding to the data in the first table according to the first column group, and insert the data in the first table into the first subtables of the plurality of data nodes according to the first hash value; The second insertion submodule is used to determine the corresponding second Hash value of the data in the second table according to the second column group, and insert the data in the second table into the second sub-tables of the multiple data nodes according to the second Hash value.

6. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 4 when executed.

7. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 4.