Data distribution rule recommendation method and device
By obtaining and dividing the association relationships of table groups, data distribution rules are recommended, which solves the problem of difficult selection of data distribution rules in complex association scenarios, and improves system performance and stability.
Patent Information
- Application Number
- CN202411502229.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-11
AI Technical Summary
In complex association scenarios, it is difficult for existing data distribution rules to choose appropriate association table distribution rules, especially when the public fields do not exist.
By obtaining the table group with association from the source library, selecting the target table and obtaining its subtable group, and recommending data distribution rules based on the type of the subtable group. Specific methods include dividing foreign key related subtable groups and non-foreign key related subtable groups, and recommending data distribution rules based on the characteristics of these subtable groups.
This method can recommend more appropriate data distribution rules in complex correlation scenarios, solve the difficulty of data distribution when the public field does not exist, and improve the overall performance and stability of the system.
Smart Images

Figure CN119415563A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to a method and device for recommending data distribution rules. Background Art
[0002] With the rapid development of online business on the Internet, the concurrency of business access has gradually increased, and with it comes an increasingly urgent need to process and analyze massive amounts of data. Traditional stand-alone systems have become unable to cope with the expansion of business scale, cost control, and system openness. Distributed databases have shown significant advantages in meeting these challenges with their performance and scalability, and have gradually gained wide recognition. As the application scope of distributed databases expands, data interaction between them and other types of databases is becoming increasingly frequent, and the need to migrate data to distributed databases has become increasingly common.
[0003] For distributed databases, the reasonable distribution of data is not only related to the performance and efficiency of the system, but also directly affects the availability and reliability of data. Therefore, how to formulate reasonable data distribution rules has become a very important issue in the process of data migration to distributed databases. A scientific and reasonable data distribution rule can ensure that data is stored efficiently and evenly in a distributed database, thereby further improving the overall performance and stability of the system.
[0004] In the related art, the existing data distribution rule recommendation needs to be made based on the common fields of each table in the table group. When dealing with simple association scenarios, the selection of common fields is relatively simple, but when dealing with complex association scenarios, the common fields of each table may not exist, which has certain limitations. Therefore, when faced with the situation where the common fields do not exist, the data distribution rules cannot be determined. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a data distribution rule recommendation method and device to recommend a data distribution rule based on an association relationship. The specific technical solution is as follows:
[0006] In a first aspect of an embodiment of the present application, a data distribution rule recommendation method is first provided, the method comprising:
[0007] Obtain a table group from the source database, where the table group is a collection of tables with association relationships, where the association relationship is a direct or indirect association between tables;
[0008] Select a target table from the table group, and obtain a sub-table group of the target table, wherein the sub-table group is obtained by dividing according to the association relationship between the target table and other tables in the table group;
[0009] According to the type of the sub-table group, a data distribution rule for each table in the table group is recommended.
[0010] In an optional implementation, obtaining the table group from the source database includes:
[0011] Obtaining basic information of a table from the source database, wherein the basic information of the table includes basic structure information, storage status, and association relationship;
[0012] The table group is obtained according to the basic information, and the number of tables in the table group is greater than a first preset value.
[0013] In an optional implementation, the sub-table group is obtained by dividing according to the association relationship between the target table and other tables in the table group, including:
[0014] The association relationship includes foreign key association and non-foreign key association;
[0015] Divide the sub-table group whose association relationship with the target table is the foreign key association into a foreign key associated sub-table group;
[0016] The sub-table group whose association relationship with the target table is the non-foreign key association is classified as a non-foreign key association sub-table group.
[0017] In an optional implementation, the recommending a data distribution rule for each table in the table group according to the type of the sub-table group includes:
[0018] The types of the sub-table groups include foreign key associated sub-table groups and non-foreign key associated sub-table groups;
[0019] When the sub-table group includes a foreign key associated sub-table group, recommending the data distribution rule for each table in the table group;
[0020] When the sub-table group includes a plurality of the foreign key associated sub-table groups, recommending the data distribution rule of all tables in the table group as single-node replication;
[0021] When the sub-table group does not include the foreign key associated sub-table group, the data distribution rule of each table in the table group is recommended.
[0022] In an optional implementation, when the sub-table group includes a foreign key associated sub-table group, recommending the data distribution rule for each table in the table group includes:
[0023] When the sub-table group includes one of the foreign key associated sub-table groups, comparing the total value of the first data of the non-foreign key associated sub-table group in the sub-table group with a first threshold;
[0024] The data distribution rule for each table in the table group is recommended according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the first threshold.
[0025] In an optional implementation, when the sub-table group does not include the foreign key associated sub-table group, recommending the data distribution rule for each table in the table group includes:
[0026] When the sub-table group does not include the foreign key associated sub-table group, comparing the total value of the first data of the non-foreign key associated sub-table group in the sub-table group with a second threshold;
[0027] The data distribution rule for each table in the table group is recommended according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the second threshold.
[0028] In an optional implementation, the recommending the data distribution rule for each table in the table group according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the first threshold value includes:
[0029] When the total value of the first data of each of the non-foreign key associated sub-table groups does not exceed the first threshold, the foreign key associated sub-table groups are used as distribution key filtering table groups, and the data distribution rule for each table in the distribution key filtering table groups is recommended;
[0030] When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication;
[0031] When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication;
[0032] When the total value of the first data in the non-foreign key associated sub-table group exceeds the first threshold, the data distribution rule for all tables in the table group is recommended to be single-node replication.
[0033] In an optional implementation, the recommending the data distribution rule for each table in the table group according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the second threshold value includes:
[0034] When the total value of the first data of each of the non-foreign key associated sub-table groups does not exceed the second threshold, the non-foreign key associated sub-table group with the largest total value of the first data is used as a distribution key filtering table group, and the data distribution rule for each table in the distribution key filtering table group is recommended;
[0035] When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication;
[0036] When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication;
[0037] When only one of the non-foreign key associated sub-table groups has a total value of the first data exceeding the second threshold, the non-foreign key associated sub-table group whose total value of the first data exceeds the second threshold is used as the distribution key filtering table group, and the data distribution rule of the distribution key filtering table group is recommended;
[0038] When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication;
[0039] When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication;
[0040] When there are two or more of the non-foreign key associated sub-table groups and the total value of the first data exceeds the second threshold, the data distribution rule for all tables in the table group is recommended to be single-node replication.
[0041] In an optional implementation, the recommending the data distribution rules for all tables in the distribution key screening table group includes:
[0042] Filter the table group according to the distribution key to determine the target association link, wherein the target association link is divided according to the association column between the target table and other tables, and when the association column changes, the target association link will also change in turn;
[0043] According to the target association link, the data distribution rule recommendation for all tables in the distribution key screening table group is performed.
[0044] In an optional implementation, the recommending of the data distribution rule for all tables in the distribution key filtering table group according to the target association link includes:
[0045] Traversing the tables of the target association link in sequence, detecting whether the currently traversed table has other columns other than the external association columns in the target association link that are externally associated with other tables; if the currently traversed table has other columns other than the external association columns in the target association link that are externally associated with other tables, determining whether the total value of the second data of the other tables exceeds a third threshold;
[0046] When the total value of the second data of other tables exceeds the third threshold, recommending the data distribution rule of all tables in the distribution key screening table group as single-node replication;
[0047] When the total value of the second data of other tables does not exceed the third threshold, the data distribution rule of the other tables is recommended to be multi-node replication, the data distribution rule of the currently traversed table is recommended to be hash replication, and the distribution key is the external association column of the current table in the association link;
[0048] If the currently traversed table does not have any other columns other than the externally associated columns in the associated link that are externally associated with other tables, determine whether the currently traversed table is the last table of the target associated link; if the currently traversed table is not the last table of the target associated link, recommend the data distribution rule of the currently traversed table as hash replication, with the distribution key being the externally associated columns of the currently traversed table in the target associated link, and continue to traverse other tables of the target associated link;
[0049] If the table currently traversed is the last table of the target association link, the data distribution rule of the table currently traversed is recommended as hash replication, and the distribution key is the external association column of the table currently traversed in the target association link, and the traversal is ended to complete the recommendation of the data distribution rule for all tables in the distribution key filtering table group;
[0050] The distribution key is used to recommend that the data distribution rule be used when hash replication is used.
[0051] In a second aspect of the embodiments of the present application, a data distribution rule recommendation device is further provided, the device comprising:
[0052] A table group acquisition module acquires a table group from a source database, wherein the table group is a collection of tables with association relationships, and the association relationship is a direct or indirect association between tables;
[0053] A sub-table group acquisition module selects a target table from the table group and acquires a sub-table group of the target table, wherein the sub-table group is obtained by dividing according to the association relationship between the target table and other tables in the table group;
[0054] The distribution rule recommendation module recommends data distribution rules for each table in the table group according to the type of the sub-table group.
[0055] In a third aspect of an embodiment of the present invention, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0056] Memory, used to store computer programs;
[0057] The processor is used to implement the steps of the data distribution rule recommendation method described in any one of the first aspects above when executing the program stored in the memory.
[0058] In a fourth aspect of an embodiment of the present invention, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the storage medium is executed on a computer, the computer executes the steps of the data distribution rule recommendation method described in any one of the first aspects above.
[0059] In a fifth aspect of the embodiments of the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the data distribution rule recommendation methods described in the first aspect above.
[0060] The above technical solution provided by the embodiment of the present invention obtains a table group from a source library. The table group is a collection of tables with association relationships. The association relationship is a direct or indirect association between tables. A target table is selected from the table group to obtain a sub-table group of the target table. The sub-table group is obtained based on the association relationship between the target table and other tables in the table group. According to the type of the sub-table group, a data distribution rule for each table in the table group is recommended. In this way, the data distribution rules of the table are recommended based on the association relationship of the tables in the table group, which can solve the problem of difficulty in selecting the distribution rules of the association tables in complex association scenarios and recommend more appropriate data distribution rules. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0062] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0063] Figure 1 A schematic diagram of an implementation flow of a data distribution rule recommendation method provided in an embodiment of the present application;
[0064] Figure 2 A schematic diagram of the association relationship between various tables in a table group provided in an embodiment of the present application;
[0065] Figure 3 A schematic diagram of an implementation flow of another data distribution rule recommendation method provided in an embodiment of the present application;
[0066] Figure 4 A schematic diagram of an implementation flow of another data distribution rule recommendation method provided in an embodiment of the present application;
[0067] Figure 5 A schematic diagram of an implementation flow of a method for recommending data distribution rules based on a first threshold provided in an embodiment of the present application;
[0068] Figure 6 A schematic diagram of an implementation flow of another data distribution rule recommendation method provided in an embodiment of the present application;
[0069] Figure 7 A schematic diagram of an implementation flow of a method for recommending data distribution rules based on a second threshold value provided in an embodiment of the present application;
[0070] Figure 8 A schematic diagram of the structure of a data distribution rule recommendation device provided in an embodiment of the present application;
[0071] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0073] To facilitate understanding of the embodiments of the present application, further explanation will be given below with reference to specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present application.
[0074] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a data distribution rule recommendation method provided in an embodiment of the present application. The method may specifically include the following steps:
[0075] S101, obtaining a table group from a source database. The table group is a collection of tables with association relationships. The association relationship is a direct or indirect association between tables.
[0076] In an embodiment of the present application, basic information of a table is obtained from a source database, and the basic information of a table generally includes basic structure information, storage status, and association relationship. An association relationship refers to a direct or indirect association between tables. A set of tables with an association relationship is obtained based on the association relationship of the tables, and the set of tables with an association relationship is taken as a table group. In addition, the number of tables in the table group is greater than a first preset value.
[0077] For example, Figure 2 As shown, it is a schematic diagram of the implementation process of the association relationship between each table in a table group shown in an embodiment of the present application. The tables in the table group include Table 1, Table 2, Table 3, Table 4, Table 5, and Table 6. The a1 column of Table 1 is directly associated with the a2 column of Table 2, and the a5 column of Table 5 is directly associated with the a2 column of Table 2, so Table 5 is indirectly associated with Table 1. Similarly, the b4 column of Table 4 is directly associated with the b1 column of Table 1, and the b6 column of Table 6 is directly associated with the b4 column of Table 4, so Table 6 is indirectly associated with Table 1.
[0078] S102, selecting a target table from the table group, and obtaining a sub-table group of the target table, where the sub-table group is obtained based on the association relationship between the target table and other tables in the table group.
[0079] In an embodiment of the present application, a target table is selected from a table group as a starting point, and a sub-table group of the target table is obtained based on the association relationship between the target table and other tables in the table group, wherein the target table may be a table with the largest data storage volume in the table group, and the association relationship includes foreign key association and non-foreign key association, and different association relationships correspond to different sub-table groups. The sub-table group in which the association relationship between the tables in the sub-table group and the target table is a foreign key-associated sub-table group is taken as a foreign key-associated sub-table group, and the sub-table group in which the association relationship between the tables in the sub-table group and the target table is a non-foreign key-associated sub-table group is taken as a non-foreign key-associated sub-table group.
[0080] For example, Figure 2 As shown, the tables in the table group include Table 1, Table 2, Table 3, Table 4, Table 5, and Table 6, among which Table 1 is the table with the largest data storage volume. Table 1 is taken as the target table. The associated columns in Table 1 are a1 and b1. The sub-table group of Table 1 regarding a1 is a set consisting of Table 2, Table 3, and Table 5. The sub-table group of Table 1 regarding b1 is a set consisting of Table 4 and Table 6. If Table 1 is associated with Table 2 by a foreign key with respect to the a1 column, and Table 1 is associated with Table 4 by a non-foreign key with respect to the b1 column, then the foreign key associated sub-table group of Table 1 is a set consisting of Table 2, Table 3, and Table 5, and the non-foreign key associated sub-table group of Table 1 is a set consisting of Table 4 and Table 6.
[0081] S103: Recommend data distribution rules for each table in the table group according to the type of the sub-table group.
[0082] In an embodiment of the present application, the types of sub-table groups include foreign key-associated sub-table groups and non-foreign key-associated sub-table groups. Data distribution rules are recommended based on the number of foreign key-associated sub-table groups and non-foreign key-associated sub-table groups included in the sub-table groups. The data distribution rules may include distribution methods, distribution ranges, and distribution keys, which are not limited in the present application examples.
[0083] Through the above description of the technical solution provided by the embodiment of the present application, a table group is obtained from the source library. The table group is a collection of tables with association relationships. The association relationship is a direct or indirect association between tables. The target table is selected from the table group to obtain a sub-table group of the target table. The sub-table group is obtained based on the association relationship between the target table and other tables in the table group. According to the type of the sub-table group, the data distribution rules for each table in the table group are recommended. In this way, the data distribution rules of the table are recommended based on the association relationship of the tables in the table group, which can solve the problem of difficulty in selecting the distribution rules of the association tables in complex association scenarios and recommend more appropriate data distribution rules.
[0084] like Figure 3 FIG. 1 is a schematic diagram of an implementation flow of another data distribution rule recommendation method provided in an embodiment of the present application, which may specifically include the following contents:
[0085] S301, obtaining a table group from a source database. The table group is a collection of tables with association relationships. The association relationship is a direct or indirect association between tables.
[0086] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.
[0087] S302, selecting a target table from the table group, and obtaining a sub-table group of the target table, where the sub-table group is obtained based on the association relationship between the target table and other tables in the table group.
[0088] In the embodiment of the present application, this step is similar to the above-mentioned step S102, and the embodiment of the present application will not be described one by one here.
[0089] S303: When the sub-table group includes a foreign key associated sub-table group, recommend a data distribution rule for each table in the table group.
[0090] The number of foreign key-related sub-table groups and non-foreign key-related sub-table groups in the sub-table group is judged. When there is only one foreign key-related sub-table group, the data distribution rule for each table in the table group is recommended. For example, Figure 2 As shown in the figure, if the foreign key associated sub-table group of table 1 is a set consisting of table 2, table 3, and table 5, and the non-foreign key associated sub-table group of table 1 is a set consisting of table 4 and table 6. At this time, the sub-table group contains one foreign key associated sub-table group, that is, a set consisting of table 2, table 3, and table 5, which satisfies the situation that the sub-table group contains only one foreign key associated sub-table group.
[0091] When a sub-table group contains a foreign key associated sub-table group, the data distribution rules for each table in the table group are recommended. For details, please refer to the following Figure 4 As shown in the method. Figure 4 FIG. 1 is a schematic diagram of an implementation flow of another data distribution rule recommendation method provided in an embodiment of the present application, which may specifically include the following steps:
[0092] S401: When a sub-table group includes a foreign key associated sub-table group, a total value of first data of a non-foreign key associated sub-table group in the sub-table group is compared with a first threshold.
[0093] In the embodiment of the present application, the total value of the first data of the non-foreign key associated sub-table group in the sub-table group may be the total storage capacity of the data in the table in the non-foreign key associated sub-table group, and the first threshold may be a parameter manually configured according to the situation, which is not limited in the embodiment of the present application. Figure 2 As shown, the foreign key associated sub-table group is a set consisting of Table 2, Table 3, and Table 5, and the non-foreign key associated sub-table group is a set consisting of Table 4 and Table 6. The total value of the first data of Table 4 and Table 6 is compared with the first threshold.
[0094] S402: recommending a data distribution rule for each table in the table group according to a comparison result between the first data total value of the non-foreign key associated sub-table group and the first threshold.
[0095] Specifically, according to the comparison result between the total value of the first data of the non-foreign key associated sub-table group and the first threshold, a data distribution rule for each table in the table group is recommended, such as Figure 5 As shown, it is a schematic diagram of an implementation process of a method for recommending data distribution rules based on a first threshold provided in an embodiment of the present application, which may include the following steps:
[0096] S501, when the total value of the first data of each non-foreign key associated sub-table group does not exceed the first threshold, the foreign key associated sub-table group is used as a distribution key filter table group, and a data distribution rule for each table in the distribution key filter table group is recommended.
[0097] In the embodiment of the present application, if Figure 2 The foreign key associated sub-table group is a set consisting of Table 2, Table 3, and Table 5, the non-foreign key associated sub-table group is a set consisting of Table 4 and Table 6, and the total value of the first data of the non-foreign key associated sub-table group does not exceed the first threshold, then the foreign key associated sub-table group (the set consisting of Table 2, Table 3, and Table 5) is used as the distribution key filter table group, and data distribution rules for each table in the distribution key filter table group are recommended.
[0098] Specifically, when the total value of the first data of each non-foreign key associated sub-table group does not exceed the first threshold, the foreign key associated sub-table group is used as a distribution key filter table group, and a data distribution rule for each table in the distribution key filter table group is recommended, which may specifically include the following steps:
[0099] Step 1: Filter the table group according to the distribution key to determine the target association link.
[0100] In the embodiment of the present application, the target association link is divided according to the association column between the target table and other tables. When the association column changes, the target association link will also change accordingly. Figure 2 As shown, the filter table group of the distribution key is a set consisting of Table 1, Table 2, Table 3, and Table 5. The a1 column in Table 1 is directly or indirectly associated with Table 2, Table 3, and Table 5, and the associated column has not changed. The target association link is Table 1, Table 2, Table 3, and Table 5.
[0101] Step 2: According to the target association link, data distribution rules for all tables in the distribution key filtering table group are recommended.
[0102] Specifically, according to the target association link, data distribution rules for all tables in the distribution key filtering table group are recommended, including:
[0103] Traversing the tables of the target association link in sequence, detecting whether the currently traversed table has other columns other than the external association columns in the association link that are externally associated with other tables; if the currently traversed table has other columns other than the external association columns in the association link that are externally associated with other tables, determining whether the total value of the second data of the other tables exceeds a third threshold;
[0104] When the total value of the second data of other tables exceeds the third threshold, the data distribution rule of all tables in the distribution key filtering table group is recommended to be single-node replication;
[0105] When the total value of the second data of other tables does not exceed the third threshold, the data distribution rule of other tables is recommended to be multi-node replication, the data distribution rule of the currently traversed table is recommended to be hash replication, and the distribution key is the external association column of the current table in the association link;
[0106] If the currently traversed table does not have any columns other than the externally associated columns in the associated link that are externally associated with other tables, determine whether the currently traversed table is the last table of the target associated link; if the currently traversed table is not the last table of the target associated link, recommend the data distribution rule of the currently traversed table as hash replication, with the distribution key being the externally associated column of the currently traversed table in the target associated link, and continue to traverse other tables of the target associated link;
[0107] If the table currently traversed is the last table of the target association link, the data distribution rule of the table currently traversed is recommended as hash replication, and the distribution key is the external association column of the table currently traversed in the target association link. The traversal ends and the data distribution rule recommendation for all tables in the distribution key filtering table group is completed.
[0108] In an embodiment of the present application, other columns other than the externally associated columns in the target associated link may be externally associated columns of the table in the target associated link and other columns associated with other tables, and the other associated columns with the target table are different. The second total data value may be the total storage capacity of the table associated with other columns of the table in the target associated link. The third threshold may be a parameter manually configured according to the situation, and the embodiment of the present application does not limit this. The distribution key is used to recommend that the data distribution rule be used when hash replication is used.
[0109] For example, for the target association link tables 1, 2, 3, and 5, first check whether Table 1 has other columns associated with other tables externally. If Table 1 does not have other columns associated with other tables externally, then check whether Table 2 has other columns associated with other tables externally. If Table 2 has column b2 associated with Table 7 and Table 8 externally, then Table 2 has other columns associated with other tables externally, and at the same time, the total value of the second data of Table 7 and Table 8 exceeds the third threshold. The data distribution rule for all tables in the distribution key filtering table group (Table 1, Table 2, Table 3, and Table 5) is single-node replication, and there is no need to traverse other tables.
[0110] If Table 2 has other columns that are externally associated with other tables, but the total value of the second data in Tables 7 and 8 does not exceed the third threshold, then the data distribution rules for Tables 7 and 8 are multi-node replication, and the data distribution rule for Table 2 is hash replication. Since hash replication requires a distribution key, the distribution key for hash replication of Table 2 is the externally associated column of Tables 2 and 3. Traverse the other tables (Tables 3 and 5) of the target association link in sequence.
[0111] Table 5 is the last table in the current link (Table 5 has no other columns associated with other tables externally). The recommended data distribution rule for Table 5 is hash replication. The distribution key is the externally associated column (a5) of Table 5 in the target associated link. The traversal ends and the data distribution rule recommendation for all tables in the distribution key filtering table group is completed.
[0112] S502: When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication.
[0113] For example, if table 2 has column b2 that is externally associated with table 7 and table 8, and table 2 has other columns that are externally associated with other tables, and the total value of the second data of table 7 and table 8 exceeds the third threshold, the data distribution rule for all tables in the distribution key filtering table group (table 1, table 2, table 3, and table 5) is single-node replication, and the data distribution rule for other tables in the entire table group is single-node replication.
[0114] S503: When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication.
[0115] For example, the data distribution rules for all tables in the distribution key filtering table group are not single-node replication, and the data distribution rules for tables in other non-foreign key-related sub-table groups in the sub-table group are recommended to be multi-node replication.
[0116] S504: When the total value of the first data in the non-foreign key associated sub-table group exceeds the first threshold, recommending the data distribution rule of all tables in the table group as single-node replication.
[0117] For example, Figure 2 As shown, Figure 2 The foreign key associated sub-table group is a set consisting of Table 2, Table 3, and Table 5, and the non-foreign key associated sub-table group is a set consisting of Table 4 and Table 6. The total value of the first data of the non-foreign key associated sub-table group exceeds the first threshold. At this time, the data distribution rule for all tables in the table group (Table 1-Table 6) is recommended to be single-node replication.
[0118] The above describes the case where a sub-table group includes one foreign key associated sub-table group. For the case where a sub-table group includes multiple foreign key associated sub-table groups, step 304 will be adopted:
[0119] S304: When a sub-table group includes multiple foreign key-associated sub-table groups, the data distribution rule for all tables in the table group is recommended to be single-node replication.
[0120] For example, Figure 2 As shown in the figure, if the foreign key associated sub-table group of table 1 is a set consisting of table 2, table 3, table 5 and a set consisting of table 4 and table 6. At this time, the sub-table group contains two foreign key associated sub-table groups, namely, a set consisting of table 2, table 3, table 5 and a set consisting of table 4 and table 6. At this time, the data distribution rule for all tables in the table group is recommended to be single-node replication.
[0121] The above describes the case where a sub-table group contains multiple foreign key-associated sub-table groups. When a sub-table group does not contain a foreign key-associated sub-table group, step 305 is adopted:
[0122] S305: When the sub-table group does not contain a foreign key associated sub-table group, recommend a data distribution rule for each table in the table group.
[0123] The data of the foreign key-related sub-table groups and the non-foreign key-related sub-table groups in the sub-table group are judged. When the foreign key-related sub-table group is not included, the data distribution rule for each table in the table group is recommended. For example, Figure 2 As shown in the figure, if the non-foreign key associated sub-table group of table 1 is a set consisting of table 2, table 3, and table 5, and the non-foreign key associated sub-table group of table 1 is a set consisting of table 4 and table 6. At this time, the sub-table group contains two non-foreign key associated sub-table groups, but does not contain a foreign key associated sub-table group, satisfying the condition that the sub-table group does not contain a foreign key associated sub-table group.
[0124] When the sub-table group does not contain foreign key associated sub-table groups, the data distribution rules for each table in the table group are recommended. For details, please refer to the following Figure 6 As shown in the method. Figure 6 FIG. 1 is a schematic diagram of an implementation flow of another data distribution rule recommendation method provided in an embodiment of the present application, which may specifically include the following steps:
[0125] S601: When the sub-table group does not include a foreign key associated sub-table group, compare the total value of first data of non-foreign key associated sub-table groups in the sub-table group with a second threshold.
[0126] In the embodiment of the present application, the total value of the first data of the non-foreign key associated sub-table group in the sub-table group may be the total storage capacity of the data in the table in the non-foreign key associated sub-table group, and the second threshold may be a parameter manually configured according to the situation, which is not limited in the embodiment of the present application. Figure 2 As shown, the non-foreign key associated sub-table group is a set consisting of Table 2, Table 3, and Table 5 and a set consisting of Table 4 and Table 6, and the total value of the first data of Table 2, Table 3, and Table 5 and the total value of the first data of Table 4 and Table 6 are compared with the second threshold respectively.
[0127] S602: Recommend a data distribution rule for each table in the table group according to a comparison result between the first data total value of the non-foreign key associated sub-table group and the second threshold.
[0128] Specifically, according to the comparison result of the first data total value of the non-foreign key associated sub-table group and the second threshold, the data distribution rule for each table in the table group is recommended, such as Figure 7 As shown, it is a schematic diagram of an implementation flow of a method for recommending a data distribution rule based on a second threshold provided in an embodiment of the present application, which may include the following steps:
[0129] S701, when the total value of the first data of each non-foreign key associated sub-table group does not exceed the second threshold, the non-foreign key associated sub-table group with the largest total value of the first data is used as the distribution key filter table group, and a data distribution rule for each table in the distribution key filter table group is recommended.
[0130] The total value of the first data of each non-foreign key associated sub-table group does not exceed the second threshold, that is, Figure 2 The total value of the first data of Table 2, Table 3, and Table 5 and the total value of the first data of Table 4 and Table 6 do not exceed the second threshold value. The total value of the first data of Table 2, Table 3, and Table 5 in the sub-table group is the largest. The non-foreign key associated sub-table group composed of Table 2, Table 3, and Table 5 is used as the distribution key filter table group, and the data distribution rules for each table in the distribution key filter table group are recommended.
[0131] Specifically, when the total value of the first data of each non-foreign key associated sub-table group does not exceed the second threshold, the foreign key associated sub-table group is used as a distribution key filter table group, and a data distribution rule for each table in the distribution key filter table group is recommended, which may specifically include the following steps:
[0132] Step 1: Filter the table group according to the distribution key to determine the target association link.
[0133] In the embodiment of the present invention, the target association link is divided according to the association column between the target table and other tables. When the association column changes, the target association link will also change accordingly; for example, Figure 2 As shown, Table 1 has two external association columns, namely, column a1 and column b1, and the target association links of Table 1 are Table 1, Table 2, Table 3, Table 5 and Table 1, Table 4, Table 6.
[0134] Step 2: According to the target association link, data distribution rules for all tables in the distribution key filtering table group are recommended.
[0135] Specifically, according to the target association link, data distribution rules for all tables in the distribution key filtering table group are recommended, including:
[0136] Traversing the tables of the target association link in sequence, detecting whether the currently traversed table has other columns other than the external association columns in the association link that are externally associated with other tables; if the currently traversed table has other columns other than the external association columns in the association link that are externally associated with other tables, determining whether the total value of the second data of the other tables exceeds a third threshold;
[0137] When the total value of the second data of other tables exceeds the third threshold, the data distribution rule of all tables in the distribution key filtering table group is recommended to be single-node replication;
[0138] When the total value of the second data of other tables does not exceed the third threshold, the data distribution rule of other tables is recommended to be multi-node replication, the data distribution rule of the currently traversed table is recommended to be hash replication, and the distribution key is the external association column of the current table in the association link;
[0139] If the currently traversed table does not have any columns other than the externally associated columns in the associated link that are externally associated with other tables, determine whether the currently traversed table is the last table of the target associated link; if the currently traversed table is not the last table of the target associated link, recommend the data distribution rule of the currently traversed table as hash replication, with the distribution key being the externally associated column of the currently traversed table in the target associated link, and continue to traverse other tables of the target associated link;
[0140] If the table currently traversed is the last table of the target association link, the data distribution rule of the table currently traversed is recommended as hash replication, and the distribution key is the external association column of the table currently traversed in the target association link. The traversal ends and the data distribution rule recommendation for all tables in the distribution key filtering table group is completed.
[0141] In the embodiment of the present application, the second data total value may be the total data storage capacity of the table, and the third threshold may be a parameter manually configured according to the situation, which is not limited in the embodiment of the present application. The distribution key is used when the recommended data distribution rule is hash replication. This step is similar to the above step S501, and the embodiment of the present application will not be repeated here one by one.
[0142] S702: When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication.
[0143] In the embodiment of the present application, this step is similar to the above-mentioned step S502, and the embodiment of the present application will not be described one by one here.
[0144] S703: When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication.
[0145] In the embodiment of the present application, this step is similar to the above-mentioned step S503, and the embodiment of the present application will not be described one by one here.
[0146] The above describes the case where the total value of the first data of each non-foreign key associated sub-table group does not exceed the second threshold value. When the total value of the first data of only one non-foreign key associated sub-table group exceeds the second threshold value, the following steps 704 may be performed:
[0147] S704, when only one non-foreign key associated sub-table group has a first data total value exceeding the second threshold, the non-foreign key associated sub-table group whose first data total value exceeds the second threshold is used as a distribution key filter table group, and a data distribution rule for the distribution key filter table group is recommended.
[0148] Only one non-foreign key associated sub-table group has a total value of the first data that exceeds the second threshold, that is Figure 2In the example, the total value of the first data of Table 2, Table 3, and Table 5 exceeds the second threshold, while the total value of the first data of Table 4 and Table 6 does not exceed the second threshold. The non-foreign key associated sub-table group composed of Table 2, Table 3, and Table 5 is used as the distribution key filter table group, and the data distribution rules for each table in the distribution key filter table group are recommended.
[0149] Specifically, when only one non-foreign key associated sub-table group has a total first data value exceeding a second threshold, the non-foreign key associated sub-table group whose total first data value exceeds the second threshold is used as a distribution key filter table group, and a data distribution rule for the distribution key filter table group is recommended, which may specifically include the following steps:
[0150] Step 1: Filter the table group according to the distribution key to determine the target association link.
[0151] In the embodiment of the present invention, the target association link is divided according to the association column between the target table and other tables. When the association column changes, the target association link will also change accordingly; for example, Figure 2 As shown, Table 1 has two external association columns, namely, column a1 and column b1, and the target association links of Table 1 are Table 1, Table 2, Table 3, Table 5 and Table 1, Table 4, Table 6.
[0152] Step 2: According to the target association link, data distribution rules for all tables in the distribution key filtering table group are recommended.
[0153] Specifically, according to the target association link, data distribution rules for all tables in the distribution key filtering table group are recommended, including:
[0154] Traversing the tables of the target association link in sequence, detecting whether the currently traversed table has other columns other than the external association columns in the association link that are externally associated with other tables; if the currently traversed table has other columns other than the external association columns in the association link that are externally associated with other tables, determining whether the total value of the second data of the other tables exceeds a third threshold;
[0155] When the total value of the second data of other tables exceeds the third threshold, the data distribution rule of all tables in the distribution key filtering table group is recommended to be single-node replication;
[0156] When the total value of the second data of other tables does not exceed the third threshold, the data distribution rule of other tables is recommended to be multi-node replication, the data distribution rule of the currently traversed table is recommended to be hash replication, and the distribution key is the external association column of the current table in the association link;
[0157] If the currently traversed table does not have any columns other than the externally associated columns in the associated link that are externally associated with other tables, determine whether the currently traversed table is the last table of the target associated link; if the currently traversed table is not the last table of the target associated link, recommend the data distribution rule of the currently traversed table as hash replication, with the distribution key being the externally associated column of the currently traversed table in the target associated link, and continue to traverse other tables of the target associated link;
[0158] If the table currently traversed is the last table of the target association link, the data distribution rule of the table currently traversed is recommended as hash replication, and the distribution key is the external association column of the table currently traversed in the target association link. The traversal ends and the data distribution rule recommendation for all tables in the distribution key filtering table group is completed.
[0159] In the embodiment of the present application, the second data total value may be the total data storage capacity of the table, and the third threshold may be a parameter manually configured according to the situation, which is not limited in the embodiment of the present application. The distribution key is used when the recommended data distribution rule is hash replication. This step is similar to the above step S501, and the embodiment of the present application will not be repeated here one by one.
[0160] S705: When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication.
[0161] In the embodiment of the present application, this step is similar to the above-mentioned step S502, and the embodiment of the present application will not be described one by one here.
[0162] S706: When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication.
[0163] In the embodiment of the present application, this step is similar to the above-mentioned step S503, and the embodiment of the present application will not be described one by one here.
[0164] The above describes the case where the total value of the first data of only one non-foreign key associated sub-table group exceeds the second threshold. However, when the total value of the first data of two or more non-foreign key associated sub-table groups exceeds the second threshold, the following steps 707 may be performed:
[0165] S707: When the total value of the first data of two or more non-foreign key associated sub-table groups exceeds the second threshold, the data distribution rule of all tables in the table group is recommended to be single-node replication.
[0166] When there are two or more non-foreign key associated sub-table groups, the total value of the first data exceeds the second threshold. Figure 2In the example, the total value of the first data of the non-foreign key associated sub-table group (the set consisting of Table 2, Table 3, and Table 5) exceeds the second threshold, and the total value of the first data of the non-foreign key associated sub-table group (the set consisting of Table 4 and Table 6) also exceeds the second threshold. At this time, the data distribution rule for all tables in the table group is recommended to be single-node replication.
[0167] Corresponding to the above method embodiment, the present application embodiment also provides a data distribution rule recommendation device, such as Figure 8 As shown, the device may include a table group acquisition module 801 , a sub-table group acquisition module 802 , and a distribution rule recommendation module 803 .
[0168] The table group acquisition module 801 acquires a table group from a source database. The table group is a collection of tables with association relationships. The association relationship is a direct or indirect association between tables.
[0169] The sub-table group acquisition module 802 selects a target table from the table group and acquires a sub-table group of the target table. The sub-table group is obtained based on the association relationship between the target table and other tables in the table group.
[0170] The distribution rule recommendation module 803 recommends data distribution rules for each table in the table group according to the type of the sub-table group.
[0171] The embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, it includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0172] Memory 903, used for storing computer programs;
[0173] In one embodiment of the present invention, the processor 901, when used to execute the program stored in the memory 903, implements the following steps:
[0174] A table group is obtained from a source-end library, where the table group is a collection of tables with association relationships, where the association relationship is a direct or indirect association between tables; a target table is selected from the table group, and a sub-table group of the target table is obtained, where the sub-table group is obtained based on the association relationship between the target table and other tables in the table group; and a data distribution rule for each table in the table group is recommended based on the type of the sub-table group.
[0175] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0176] The communication interface is used for communication between the above electronic device and other devices.
[0177] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0178] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0179] In another embodiment of the present invention, a storage medium is provided. The storage medium stores instructions. When the storage medium is executed on a computer, the computer executes the data distribution rule recommendation method described in any one of the above embodiments.
[0180] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is executed on a computer, the computer executes the data distribution rule recommendation method described in any one of the above embodiments.
[0181] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a storage medium, or transmitted from one storage medium to another storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0182] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0183] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0184] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A data distribution rule recommendation method, characterized in that: The method comprises: Obtain a table group from the source database, where the table group is a collection of tables with association relationships, where the association relationship is a direct or indirect association between tables; Select a target table from the table group, and obtain a sub-table group of the target table, wherein the sub-table group is obtained by dividing according to the association relationship between the target table and other tables in the table group; According to the type of the sub-table group, a data distribution rule for each table in the table group is recommended.
2. The method according to claim 1, characterized in that The sub-table group is obtained by dividing according to the association relationship between the target table and other tables in the table group, and includes: The association relationship includes foreign key association and non-foreign key association; Divide the sub-table group whose association relationship with the target table is the foreign key association into a foreign key associated sub-table group; The sub-table group whose association relationship with the target table is the non-foreign key association is classified as a non-foreign key association sub-table group.
3. The method according to claim 1, characterized in that The recommending, according to the type of the sub-table group, a data distribution rule for each table in the table group includes: The types of the sub-table groups include foreign key associated sub-table groups and non-foreign key associated sub-table groups; When the sub-table group includes a foreign key associated sub-table group, recommending the data distribution rule for each table in the table group; When the sub-table group includes a plurality of the foreign key associated sub-table groups, recommending the data distribution rule of all tables in the table group as single-node replication; When the sub-table group does not include the foreign key associated sub-table group, the data distribution rule of each table in the table group is recommended.
4. The method according to claim 3, characterized in that When the sub-table group includes a foreign key associated sub-table group, recommending the data distribution rule for each table in the table group includes: When the sub-table group includes one of the foreign key associated sub-table groups, comparing the total value of the first data of the non-foreign key associated sub-table group in the sub-table group with a first threshold; The data distribution rule for each table in the table group is recommended according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the first threshold.
5. The method according to claim 3, characterized in that: When the sub-table group does not include the foreign key associated sub-table group, recommending the data distribution rule for each table in the table group includes: When the sub-table group does not include the foreign key associated sub-table group, comparing the total value of the first data of the non-foreign key associated sub-table group in the sub-table group with a second threshold; The data distribution rule for each table in the table group is recommended according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the second threshold.
6. The method according to claim 4, characterized in that The recommending the data distribution rule for each table in the table group according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the first threshold value comprises: When the total value of the first data of each of the non-foreign key associated sub-table groups does not exceed the first threshold, the foreign key associated sub-table groups are used as distribution key filtering table groups, and the data distribution rule for each table in the distribution key filtering table groups is recommended; When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication; When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication; When the total value of the first data in the non-foreign key associated sub-table group exceeds the first threshold, the data distribution rule for all tables in the table group is recommended to be single-node replication.
7. The method according to claim 5, characterized in that The recommending the data distribution rule for each table in the table group according to the comparison result between the first data total value of the non-foreign key associated sub-table group and the second threshold value comprises: When the total value of the first data of each of the non-foreign key associated sub-table groups does not exceed the second threshold, the non-foreign key associated sub-table group with the largest total value of the first data is used as a distribution key filtering table group, and the data distribution rule for each table in the distribution key filtering table group is recommended; When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication; When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication; When only one of the non-foreign key associated sub-table groups has a total value of the first data exceeding the second threshold, the non-foreign key associated sub-table group whose total value of the first data exceeds the second threshold is used as the distribution key filtering table group, and the data distribution rule of the distribution key filtering table group is recommended; When the data distribution rule of each table in the distribution key screening table group is recommended as single-node replication, the data distribution rules of other tables in the table group are recommended as single-node replication; When the data distribution rule recommendation for each table in the distribution key screening table group is not single-node replication, the data distribution rule for tables in other non-foreign key associated sub-table groups in the sub-table group is recommended as multi-node replication; When there are two or more of the non-foreign key associated sub-table groups and the total value of the first data exceeds the second threshold, the data distribution rule for all tables in the table group is recommended to be single-node replication.
8. The method according to claim 6 or 7, characterized in that: The recommending the data distribution rules for all tables in the distribution key screening table group includes: Filter the table group according to the distribution key to determine the target association link, wherein the target association link is divided according to the association column between the target table and other tables, and when the association column changes, the target association link will also change in turn; According to the target association link, the data distribution rule recommendation for all tables in the distribution key screening table group is performed.
9. The method according to claim 8, characterized in that The recommending of the data distribution rule for all tables in the distribution key filtering table group according to the target association link includes: Traversing the tables of the target association link in sequence, detecting whether the currently traversed table has other columns other than the external association columns in the target association link that are externally associated with other tables; if the currently traversed table has other columns other than the external association columns in the target association link that are externally associated with other tables, determining whether the total value of the second data of the other tables exceeds a third threshold; When the total value of the second data of other tables exceeds the third threshold, recommending the data distribution rule of all tables in the distribution key screening table group as single-node replication; When the total value of the second data of other tables does not exceed the third threshold, the data distribution rule of the other tables is recommended to be multi-node replication, the data distribution rule of the currently traversed table is recommended to be hash replication, and the distribution key is the external association column of the current table in the association link; If the currently traversed table does not have any other columns other than the externally associated columns in the associated link that are externally associated with other tables, determine whether the currently traversed table is the last table of the target associated link; if the currently traversed table is not the last table of the target associated link, recommend the data distribution rule of the currently traversed table as hash replication, with the distribution key being the externally associated column of the currently traversed table in the target associated link, and continue to traverse other tables of the target associated link; If the table currently traversed is the last table of the target association link, the data distribution rule of the table currently traversed is recommended as hash replication, and the distribution key is the external association column of the table currently traversed in the target association link, and the traversal is ended to complete the recommendation of the data distribution rule for all tables in the distribution key filtering table group; The distribution key is used to recommend that the data distribution rule be used when hash replication is used.
10. A data distribution rule recommendation device, characterized in that: The device comprises: A table group acquisition module acquires a table group from a source database, wherein the table group is a collection of tables with association relationships, and the association relationship is a direct or indirect association between tables; A sub-table group acquisition module selects a target table from the table group and acquires a sub-table group of the target table, wherein the sub-table group is obtained by dividing according to the association relationship between the target table and other tables in the table group; The distribution rule recommendation module recommends data distribution rules for each table in the table group according to the type of the sub-table group.