A method for determining table management information of a relational database and related equipment
By obtaining detailed table information at different time points in the relational database and automatically determining the table's space usage, the problem of difficult manual analysis is solved, more accurate management strategy generation is achieved, and the efficiency and accuracy of database management are improved.
Patent Information
- Application Number
- CN202110290171.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2041-03-18
AI Technical Summary
When the space usage of a relational database increases, managers cannot manually analyze the cause from a large number of tables, resulting in an inability to determine effective management strategies.
By obtaining detailed table information of the relational database at different time points, the space usage information of the table is automatically determined, and table management information is generated based on this information to guide management strategies.
It realizes the automatic determination of table management information, improves the management accuracy of relational database, and ensures that appropriate management measures are taken according to actual conditions.
Smart Images

Figure CN112988748B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method for determining table management information of a relational database and related equipment. Background Art
[0002] Large computer systems usually use relational databases for data storage, wherein data in relational databases are stored in the form of tables.
[0003] Currently, when the space usage of a relational database increases, an administrator needs to manually analyze the reasons for the increase in the space usage of the relational database and determine a solution for cleaning up or expanding the relational database based on the reasons for the increase.
[0004] However, for a relational database with a large number of tables, when the relational database space usage increases, the administrator cannot manually analyze the reason for the increase in the relational database space usage from these large number of tables. As a result, the administrator does not know what management strategy to adopt to manage the relational database (such as cleaning up the relational database, expanding its capacity, or doing nothing). Summary of the Invention
[0005] In order to solve the above technical problems existing in the prior art, the present application provides a method for determining table management information of a relational database and related equipment, which can automatically determine the table management information of a relational database so that the table management information can accurately represent the management strategy required for the table in the relational database, which is conducive to improving the management accuracy of the relational database.
[0006] In order to achieve the above objectives, the technical solutions provided in the embodiments of the present application are as follows:
[0007] An embodiment of the present application provides a method for determining table management information of a relational database, the method comprising:
[0008] Obtaining first table detail information and second table detail information; wherein the first table detail information includes space occupancy information of each table in the relational database collected at a first time point; the second table detail information includes space occupancy information of each table in the relational database collected at a second time point; the first time point is later than the second time point by a preset time period;
[0009] Determining space usage information corresponding to the relational database at a first point in time based on the first table detailed information;
[0010] determining, based on the detailed information of the second table, space usage information corresponding to the relational database at a second point in time;
[0011] Based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, the table management information corresponding to the relational database is determined, so that the table management information corresponding to the relational database is used to describe the management strategy adopted for the table in the relational database at the first time point.
[0012] In a possible implementation, determining, based on the first table detailed information, the space usage information corresponding to the relational database at the first time point includes:
[0013] Determining a first fragmented table set and a first non-fragmented table set based on the first table detail information; wherein the first fragmented table set is used to record each fragmented table of the relational database at a first point in time; and the first non-fragmented table set is used to record each non-fragmented table of the relational database at the first point in time;
[0014] Determining the preset space usage information as the space usage information corresponding to the first fragment table set;
[0015] Determining space usage information corresponding to the first non-fragmented table set based on the first table detail information;
[0016] The space usage information corresponding to the first fragmented table set and / or the space usage information corresponding to the first non-fragmented table set is determined as the space usage information corresponding to the relational database at the first time point.
[0017] In a possible implementation, determining, based on the second table detailed information, the space usage information corresponding to the relational database at the second time point includes:
[0018] Determining a second fragmented table set and a second non-fragmented table set based on the second table details; wherein the second fragmented table set is used to record each fragmented table of the relational database at the second time point; and the second non-fragmented table set is used to record each non-fragmented table of the relational database at the second time point;
[0019] Determining the preset space usage information as the space usage information corresponding to the second fragment table set;
[0020] Determining space usage information corresponding to the second non-fragmented table set according to the second table detail information;
[0021] The space usage information corresponding to the second fragmented table set and / or the space usage information corresponding to the second non-fragmented table set is determined as the space usage information corresponding to the relational database at the second time point.
[0022] In a possible implementation, if the space usage information corresponding to the relational database at the second time point includes space usage information corresponding to the first fragmented table set and space usage information corresponding to the first non-fragmented table set, and the space usage information corresponding to the relational database at the second time point includes space usage information corresponding to the second non-fragmented table set, then the process of determining the table management information corresponding to the relational database includes:
[0023] When it is determined that the space usage information corresponding to the first fragmented table set corresponds to the first table management policy, determining table management information corresponding to the first fragmented table set according to the first table management policy;
[0024] Comparing the space usage information corresponding to the first non-fragmented table set with the space usage information corresponding to the second non-fragmented table set to obtain table management information corresponding to the first non-fragmented table set;
[0025] The table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set are determined as the table management information corresponding to the relational database.
[0026] In a possible implementation, comparing the space usage information corresponding to the first non-fragmented table set with the space usage information corresponding to the second non-fragmented table set to obtain the table management information corresponding to the first non-fragmented table set includes:
[0027] Aggregating all sub-tables in the first non-fragmented table set to obtain N first combined tables, identifiers of the first combined tables, and the number of sub-tables corresponding to the first combined tables; where N is a positive integer;
[0028] Aggregating all sub-tables in the second non-fragmented table set to obtain M second combined tables, identifiers of the second combined tables, and the number of sub-tables corresponding to the second combined tables; where M is a positive integer;
[0029] Determining space usage information corresponding to each first combined table based on space usage information corresponding to the first non-fragmented table set;
[0030] determining, based on the space usage information corresponding to the second non-fragmented table set, space usage information corresponding to each second combined table;
[0031] When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, and the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table meet a first condition, determining table management information corresponding to each sub-table in the i-th first combined table according to a second table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M;
[0032] When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table do not satisfy the first condition, and it is determined that the space usage information corresponding to the i-th first combined table and the space usage information corresponding to the j-th second combined table satisfy the second condition, determining the table management information corresponding to each sub-table in the i-th first combined table according to the third table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M;
[0033] The table management information corresponding to the first non-fragmented table set is determined according to the table management information corresponding to each sub-table in the i-th first combined table.
[0034] In one possible implementation, the method further includes:
[0035] Sorting the N first combined table sets according to space usage information corresponding to the N first combined table sets to obtain a sorted list of tables corresponding to the relational database at a first time point;
[0036] The sorted list of tables corresponding to the relational database at the first time point is sent to the user.
[0037] The embodiment of the present application further provides a device for determining table management information of a relational database, comprising:
[0038] an information acquisition unit, configured to acquire first table detail information and second table detail information; wherein the first table detail information includes space occupancy information of each table in the relational database collected at a first time point; the second table detail information includes space occupancy information of each table in the relational database collected at a second time point; the first time point is later than the second time point by a preset time period;
[0039] A first determining unit is configured to determine space usage information corresponding to the relational database at a first time point based on the first table detailed information;
[0040] A second determining unit is configured to determine space usage information corresponding to the relational database at a second time point based on the detailed information of the second table;
[0041] The third determination unit is used to determine the table management information corresponding to the relational database based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe the management strategy adopted for the table in the relational database at the first time point.
[0042] The present invention also provides a device comprising a processor and a memory.
[0043] The memory is used to store computer programs;
[0044] The processor is configured to execute any implementation of the method for determining table management information of a relational database provided in the embodiments of the present application according to the computer program.
[0045] An embodiment of the present application further provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute any implementation of the method for determining table management information of a relational database provided in the embodiment of the present application.
[0046] The embodiments of the present application also provide a computer program product. When the computer program product is run on a terminal device, the terminal device executes any implementation of the method for determining table management information of a relational database provided in the embodiments of the present application.
[0047] Compared with the prior art, the embodiments of the present application have at least the following advantages:
[0048] In a method for determining table management information for a relational database provided in an embodiment of the present application, after obtaining first table details and second table details, the method can first determine the space usage information corresponding to the relational database at a first time point based on the first table details, and then determine the space usage information corresponding to the relational database at a second time point based on the second table details. The method then determines the table management information corresponding to the relational database based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe the management policy adopted for the tables in the relational database at the first time point. The first table details include space occupancy information for each table in the relational database collected at the first time point; the second table details include space occupancy information for each table in the relational database collected at the second time point; and the first time point is later than the second time point by a preset amount. This method automatically determines the table management information for the relational database, so that the table management information accurately represents the management policy to be adopted for the tables in the relational database, thereby improving the management accuracy of the relational database. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 A flowchart of a method for determining table management information of a relational database provided in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of a process for determining table management information of a relational database provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of the structure of a device for determining table management information of a relational database provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to facilitate understanding of the technical solutions provided in the embodiments of the present application, the technical terms involved are explained below.
[0054] Relational databases store data in the form of tables. In addition, in order to ensure response time requirements, it is usually necessary to limit the number of records stored in a table, so the same type of data can be stored in separate tables in a relational database. In addition, the embodiment of the present application does not limit the table division rules (e.g., it can be divided into monthly tables or daily tables). For example, if payment flow data is recorded in a relational database according to daily tables, TXN_FLOW_20200701, TXN_FLOW_20200702, ... and other sub-tables can be obtained, so that the table names of these sub-tables contain some identical characters.
[0055] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0056] Method Example
[0057] See also Figure 1 , which is a flowchart of a method for determining table management information of a relational database provided in an embodiment of the present application.
[0058] The method for determining table management information of a relational database provided in an embodiment of the present application includes S1-S4:
[0059] S1: Obtain detailed information of the first table and detailed information of the second table.
[0060] The first table detail information includes space occupancy information of each table in the relational database collected at the first time point. That is, the first table detail information is used to record the space occupancy information collected for each table in the relational database at the first time point.
[0061] In addition, the embodiment of the present application does not limit the first time point. For example, the first time point may be April 15, XXX.
[0062] In addition, the embodiment of the present application does not limit the space occupancy information. For example, the space occupancy information may include an occupied space value.
[0063] The second table details include space occupancy information of each table in the relational database collected at a second time point, wherein the first time point is a preset time period later than the second time point, and the preset time period can be pre-set, for example, the preset time period can be 1 month.
[0064] In addition, the embodiment of the present application does not limit the second time point. For example, if the first time point is April 15, XXX, and the preset time length is 1 month, the second time point may be March 15, XXX.
[0065] Based on the relevant content of S1 above, it can be known that for a relational database, the management strategy corresponding to the relational data can be determined based on two adjacent pieces of space occupancy information collected for the relational database (for example, the first table details and the second table details).
[0066] S2: Determine space usage information corresponding to the relational database at the first time point based on the detailed information of the first table.
[0067] The space usage information corresponding to the relational database at the first time point is used to represent the space usage status of the relational database at the first time point. In addition, the embodiment of the present application does not limit the space usage information. For example, the space usage information may include an occupied space value.
[0068] In addition, the embodiment of the present application does not limit the implementation of S2. In one possible implementation, S2 may specifically include S21-S24:
[0069] S21: Determine a first fragmented table set and a first non-fragmented table set according to the first table detail information.
[0070] The first fragment table set is used to record various fragment tables of the relational database at a first point in time, wherein a fragment table refers to a table whose occupied space value is less than or equal to a preset space threshold (eg, 0.0625 MB).
[0071] It should be noted that the causes of fragmented tables in relational databases may include the following two situations: using the truncate command instead of the drop command during cleanup; or not using the table after creation.
[0072] The first non-fragmented table set is used to record various non-fragmented tables of the relational database at a first point in time, wherein a non-fragmented table refers to a table whose occupied space value is greater than a preset space threshold (eg, 0.0625 MB).
[0073] Based on the relevant content of the above S21, it can be known that after obtaining the detailed information of the first table, the occupied space value of each table in the relational database at the first time point can be determined based on the detailed information of the first table; then, it is determined whether the occupied space value of the kth table in the relational database at the first time point is greater than the preset space threshold. If it is greater than the preset space threshold, the kth table is determined as a non-fragmented table, and the kth table is added to the first non-fragmented table set; if it is not greater than the preset space threshold, the kth table is determined as a fragmented table, and the kth table is added to the first fragmented table set; wherein k is a positive integer, k≤K, and K represents the number of tables in the relational database at the first time point.
[0074] S22: Determine the preset space usage information as the space usage information corresponding to the first fragment table set.
[0075] The preset space usage information may be preset. For example, the preset space usage information may be that the occupied space value is equal to a preset space threshold (eg, 0.0625 MB).
[0076] The space usage information corresponding to the first fragment table set is used to describe the space occupancy status of each fragment table in the first fragment table set at a first time point.
[0077] Based on the relevant content of S22 above, it can be known that after obtaining the first fragment table set, the preset space usage information can be directly determined as the space usage information corresponding to the first fragment table set, so that the space usage information corresponding to the first fragment table set is used to represent the space occupancy status shared by all fragment tables in the first fragment table set.
[0078] S23: Determine space usage information corresponding to the first non-fragmented table set according to the first table detail information.
[0079] The space usage information corresponding to the first non-fragmented table set is used to describe the space occupancy status of each non-fragmented table in the first non-fragmented table set at a first point in time. Furthermore, embodiments of the present application do not limit the space usage information corresponding to the first non-fragmented table set. For example, the space usage information corresponding to the first non-fragmented table set may include the space occupancy information of each non-fragmented table in the first non-fragmented table set at a first point in time.
[0080] Based on the relevant content of S23 above, it can be known that after obtaining the first non-fragmented table set, the space occupancy information of each non-fragmented table in the first non-fragmented table set at the first time point can be searched from the detailed information of the first table, and based on the space occupancy information of each non-fragmented table in the first non-fragmented table set at the first time point, the space usage information corresponding to the first non-fragmented table set can be determined, so that the space usage information corresponding to the first non-fragmented table set can accurately represent the space occupancy status of each non-fragmented table in the first non-fragmented table set at the first time point.
[0081] S24: Determine the space usage information corresponding to the first fragmented table set and / or the space usage information corresponding to the first non-fragmented table set as the space usage information corresponding to the relational database at the first time point.
[0082] In an embodiment of the present application, after obtaining the space usage information corresponding to the first fragmented table set and the space usage information corresponding to the first non-fragmented table set, the space usage information corresponding to the first fragmented table set and / or the space usage information corresponding to the first non-fragmented table set can be directly determined as the space usage information corresponding to the relational database at the first point in time, so that the space usage information corresponding to the relational database at the first point in time can accurately represent the space usage status of the relational database at the first time.
[0083] Based on the relevant content of S2 above, it can be known that after obtaining the detailed information of the first table, the detailed information of the first table can be used to analyze the spatial usage information corresponding to the relational database at the first point in time, so that the spatial usage information corresponding to the relational database at the first point in time can accurately represent the spatial usage status of the relational database at the first time.
[0084] S3: Determine space usage information corresponding to the relational database at the second time point based on the detailed information of the second table.
[0085] The space usage information corresponding to the relational database at the second time point is used to represent the space usage status of the relational database at the second time point.
[0086] In addition, the embodiment of the present application does not limit the implementation of S3. In one possible implementation, S3 may specifically include S31-S34:
[0087] S31: Determine a second fragmented table set and a second non-fragmented table set according to the second table detail information.
[0088] The second fragment table set is used to record various fragment tables of the relational database at the second time point.
[0089] The second non-fragmented table set is used to record each non-fragmented table of the relational database at the second time point.
[0090] Based on the relevant content of the above S31, it can be known that after obtaining the detailed information of the second table, the occupied space value of each table in the relational database at the second time point can be determined based on the detailed information of the second table; then it is judged whether the occupied space value of the h-th table in the relational database at the second time point is greater than the preset space threshold. If it is greater than the preset space threshold, the h-th table is determined as a non-fragmented table, and the h-th table is added to the second non-fragmented table set; if it is not greater than the preset space threshold, the h-th table is determined as a fragmented table, and the h-th table is added to the second fragmented table set; wherein h is a positive integer, h≤H, and H represents the number of tables in the relational database at the second time point.
[0091] S32: Determine the preset space usage information as the space usage information corresponding to the second fragment table set.
[0092] The space usage information corresponding to the second fragment table set is used to describe the space occupancy status of each fragment table in the second fragment table set at the second time point.
[0093] Based on the relevant content of S32 above, it can be known that after obtaining the second fragmentation table set, the preset space usage information can be directly determined as the space usage information corresponding to the second fragmentation table set, so that the space usage information corresponding to the second fragmentation table set is used to represent the space occupancy status shared by all fragmentation tables in the second fragmentation table set.
[0094] S33: Determine space usage information corresponding to the second non-fragmented table set according to the second table detail information.
[0095] The space usage information corresponding to the second non-fragmented table set is used to describe the space occupancy status of each non-fragmented table in the second non-fragmented table set at the second time point. In addition, embodiments of the present application do not limit the space usage information corresponding to the second non-fragmented table set. For example, the space usage information corresponding to the second non-fragmented table set may include the space occupancy information of each non-fragmented table in the second non-fragmented table set at the second time point.
[0096] Based on the relevant content of S33 above, it can be known that after obtaining the second non-fragmented table set, the space occupancy information of each non-fragmented table in the second non-fragmented table set at the second time point can be searched from the second table detailed information, and based on the space occupancy information of each non-fragmented table in the second non-fragmented table set at the second time point, the space usage information corresponding to the second non-fragmented table set can be determined, so that the space usage information corresponding to the second non-fragmented table set can accurately represent the space occupancy status of each non-fragmented table in the second non-fragmented table set at the second time point.
[0097] S34: Determine the space usage information corresponding to the second fragmented table set and / or the space usage information corresponding to the second non-fragmented table set as the space usage information corresponding to the relational database at the second time point.
[0098] In an embodiment of the present application, after obtaining the space usage information corresponding to the second fragmented table set and the space usage information corresponding to the second non-fragmented table set, the space usage information corresponding to the second fragmented table set and / or the space usage information corresponding to the second non-fragmented table set can be directly determined as the space usage information corresponding to the relational database at the second time point, so that the space usage information corresponding to the relational database at the second time point can accurately represent the space usage status of the relational database at the second time.
[0099] Based on the relevant content of S3 above, it can be known that after obtaining the detailed information of the second table, the detailed information of the second table can be used to analyze the spatial usage information corresponding to the relational database at the second time point, so that the spatial usage information corresponding to the relational database at the second time point can accurately represent the spatial usage status of the relational database at the second time.
[0100] S4: Determine table management information corresponding to the relational database based on the spatial usage information corresponding to the relational database at the first time point and the spatial usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe the management strategy adopted for the table in the relational database at the first time point.
[0101] The table management information corresponding to the relational database is used to describe the management policy adopted for the table in the relational database at the first time point. In addition, the embodiments of the present application do not limit the management policy. For example, the management policy may include at least one of clearing the table, adjusting the retention period of data in the table, expanding the capacity, and adding a clearing policy.
[0102] In addition, the embodiment of the present application does not limit the implementation of S4. For example, if the space usage information corresponding to the relational database at the second time point includes the space usage information corresponding to the first fragmented table set and the space usage information corresponding to the first non-fragmented table set, and the space usage information corresponding to the relational database at the second time point includes the space usage information corresponding to the second non-fragmented table set, then S4 may specifically include S41-S43:
[0103] S41: When it is determined that there is a correspondence between the space usage information corresponding to the first fragment table set and the first table management strategy, determine the table management information corresponding to the first fragment table set according to the first table management strategy.
[0104] Among them, the first table management strategy refers to a management strategy pre-set for a table with preset space usage information (that is, a fragmentation table); moreover, the embodiment of the present application does not limit the first table management strategy. For example, the first table management strategy may include table cleanup.
[0105] Based on the relevant content of S41 above, it can be known that after obtaining the space usage information corresponding to the first fragmentation table set, the pre-set first table management strategy can be directly used to determine the table management information corresponding to the first fragmentation table set (for example, determine that the table management information corresponding to the first fragmentation table set includes the first table management strategy), so that the management strategy described by the table management information corresponding to the first fragmentation table set (such as the first table management strategy) can be used subsequently to process each fragmentation table in the first fragmentation table set (such as cleaning processing).
[0106] It should be noted that embodiments of the present application can directly determine the table management information corresponding to the first fragmented table set based on the first table management policy. Alternatively, the various sub-tables in the first fragmented table set can be aggregated to obtain at least one third combined table, and the first table management policy can then be determined as the table management information corresponding to all sub-tables in each third combined table, as well as the table management information corresponding to other tables in the first fragmented table set excluding the sub-tables. For details on "aggregating sub-tables," please refer to the following.
[0107] S42: Compare the space usage information corresponding to the first non-fragmented table set with the space usage information corresponding to the second non-fragmented table set to obtain table management information corresponding to the first non-fragmented table set.
[0108] Among them, the table management information corresponding to the first non-fragmented table set is used to describe the management strategy for managing each non-fragmented table in the first non-fragmented table set; moreover, the embodiment of the present application does not limit the table management information corresponding to the first non-fragmented table set. For example, the table management information corresponding to the first non-fragmented table set may include the management strategy corresponding to each non-fragmented table in the first non-fragmented table set.
[0109] In addition, the embodiment of the present application does not limit the implementation of S42. For example, in one possible implementation, S42 may specifically include S421-S427:
[0110] S421: Aggregate all sub-tables in the first non-fragmented table set to obtain N first combined tables, identifiers of the first combined tables, and the number of sub-tables corresponding to the first combined tables, where N is a positive integer.
[0111] The sub-table aggregation refers to merging sub-tables having the same characters except for characters belonging to a preset type (for example, numbers) in their table names into one table. For example, if the table name of the first sub-table is TXN_FLOW_20200701, the table name of the second sub-table is TXN_FLOW_20200702, and the preset type is a number, then because the characters belonging to the preset type in the table name of the first sub-table are "20200701" and the characters belonging to the preset type in the table name of the second sub-table are "20200702", the table name of the first sub-table except the characters belonging to the preset type is "TXN_FLOW_", and the table name of the second sub-table except the characters belonging to the preset type is "TXN_FLOW_". Therefore, the table name of the first sub-table except the characters belonging to the preset type is the same as the table name of the second sub-table except the characters belonging to the preset type. Therefore, the first sub-table and the second sub-table can be merged into one table, and the table name of the merged table can be TXN_FLOW or TXN_FLOW_202007.
[0112] The first combined table is used to record a table obtained by combining at least one sub-table in the first non-fragmented table set.
[0113] The identifier of the first combined table is used to uniquely identify the first combined table; and the embodiment of the present application does not limit the process of determining the identifier of the first combined table. For example, the process of determining the identifier of the first combined table may specifically include: determining the common characters in the table names of all sub-tables in the first combined table (or, the above "other characters in the table names of the sub-tables except for characters belonging to a preset type (for example, numbers)") as the identifier of the first combined table (for example, TXN_FLOW_202007 or TXN_FLOW).
[0114] It should be noted that the “all sub-tables in the first combined table” mentioned above refers to all sub-tables that make up the first combined table.
[0115] The number of sub-tables corresponding to the first combined table refers to the number of sub-tables constituting the first combined table.
[0116] Based on the relevant content of the above S421, it can be known that after obtaining the first non-fragmented table set, all sub-tables in the first non-fragmented table set can be aggregated to obtain N first combined tables, and according to the table name of the sub-table corresponding to each first combined table, the identifier of each first combined table is determined, and the number of sub-tables corresponding to each first combined table is determined to determine the number of sub-tables of each first combined table.
[0117] It should be noted that the “sub-tables corresponding to the first combined table” mentioned above refers to all sub-tables that make up the first combined table.
[0118] S422: Aggregate all sub-tables in the second non-fragmented table set to obtain M second combined tables, identifiers of the second combined tables, and the number of sub-tables corresponding to the second combined tables, where M is a positive integer.
[0119] The second combined table is used to record a table obtained by combining at least one sub-table in the second non-fragmented table set.
[0120] The identifier of the second combined table is used to uniquely identify the second combined table; and the embodiment of the present application does not limit the process of determining the identifier of the second combined table. For example, the process of determining the identifier of the second combined table may specifically include: determining the common characters in the table names of all sub-tables in the second combined table (or, the above "other characters in the table names of the sub-tables except for characters belonging to a preset type (for example, numbers)") as the identifier of the second combined table (for example, TXN_FLOW_202007 or TXN_FLOW).
[0121] It should be noted that the “all sub-tables in the second combined table” mentioned above refers to all sub-tables that make up the second combined table.
[0122] The number of sub-tables corresponding to the second combined table refers to the number of sub-tables constituting the second combined table.
[0123] Based on the relevant content of S422 above, it can be known that after obtaining the second non-fragmented table set, all sub-tables in the second non-fragmented table set can be aggregated to obtain M second combined tables, and according to the table name of the sub-table corresponding to each second combined table, the identifier of each second combined table is determined, and the number of sub-tables corresponding to each second combined table is determined to determine the number of sub-tables of each second combined table.
[0124] It should be noted that the “sub-tables corresponding to the second combined table” mentioned above refers to all sub-tables that make up the second combined table.
[0125] S423: Determine the space usage information corresponding to each first combined table according to the space usage information corresponding to the first non-fragmented table set.
[0126] The space usage information corresponding to the first combined table is used to describe the space occupancy status of the first combined table.
[0127] In addition, the present embodiment does not limit the process for determining the space usage information corresponding to the first combined table. For example, if the space usage information includes an occupied space value, S423 may specifically be as follows: the sum of the space usage information corresponding to all sub-tables in the i-th first combined table is determined as the space usage information corresponding to the i-th first combined table, where i is a positive integer, i≤N.
[0128] Based on the relevant content of S423 above, it can be understood that after obtaining the i-th first combined table, the space usage information corresponding to all sub-tables in the i-th first combined table can be queried from the space usage information corresponding to the first non-fragmented table set. The space usage information corresponding to the i-th first combined table can be determined based on the space usage information corresponding to all sub-tables in the i-th first combined table, so that the space usage information corresponding to the i-th first combined table can accurately represent the space occupancy status of the first combined table. Wherein, i is a positive integer, i≤N.
[0129] S424: Determine the space usage information corresponding to each second combined table according to the space usage information corresponding to the second non-fragmented table set.
[0130] The space usage information corresponding to the second combined table is used to describe the space occupancy status of the second combined table.
[0131] In addition, the present embodiment does not limit the process for determining the space usage information corresponding to the second combined table. For example, if the space usage information includes an occupied space value, S424 may specifically be as follows: the sum of the space usage information corresponding to all sub-tables in the j-th second combined table is determined as the space usage information corresponding to the j-th second combined table, where j is a positive integer and j≤M.
[0132] Based on the relevant content of S424 above, after obtaining the j-th second combined table, the space usage information corresponding to all sub-tables in the j-th second combined table can be queried from the space usage information corresponding to the second non-fragmented table set. The space usage information corresponding to the j-th second combined table can be determined based on the space usage information corresponding to all sub-tables in the j-th second combined table, so that the space usage information corresponding to the j-th second combined table can accurately represent the space occupancy status of the second combined table. Wherein, j is a positive integer, j≤M.
[0133] S425: When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, and the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table meet the first condition, table management information corresponding to each sub-table in the i-th first combined table is determined according to the second table management policy. Here, i is a positive integer, i≤N; j is a positive integer, j≤M.
[0134] Among them, the first condition can be pre-set; and the embodiment of the present application does not limit the first condition. For example, the first condition can be that the number of sub-meters corresponding to the i-th first combined table is greater than the number of sub-meters corresponding to the j-th second combined table.
[0135] The second table management policy is a pre-set management policy for sub-tables in the first combined table whose number of sub-tables is increasing. Furthermore, embodiments of the present application are not limited to the second table management policy. For example, the second table management policy may include an additional table cleanup policy. The table cleanup policy is used to automatically clean up the sub-tables, and the table cleanup policy can be pre-set.
[0136] The table management information corresponding to each sub-table in the i-th first combined table is used to describe the table management strategy implemented for each sub-table in the i-th first combined table.
[0137] Based on the relevant content of the above S425, it can be known that after obtaining the i-th first combined table, a second combined table whose identifier successfully matches the identifier of the i-th first combined table can be searched from the M second combined tables. After determining that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table is compared with the number of sub-tables corresponding to the j-th second combined table. After determining that the number of sub-tables corresponding to the i-th first combined table is greater than the number of sub-tables corresponding to the j-th second combined table, it is determined that the sub-table corresponding to the first combined table lacks a sub-table cleanup policy. Therefore, the second table management policy can be determined as the table management policy corresponding to each sub-table in the i-th first combined table. Based on the table management policy corresponding to each sub-table in the i-th first combined table, table management information corresponding to each sub-table in the i-th first combined table is generated, so that the table management information corresponding to each sub-table in the i-th first combined table can accurately represent the table management policy that should be implemented for each sub-table in the i-th first combined table. Wherein, i is a positive integer, i≤N; j is a positive integer, j≤M.
[0138] S426: When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table do not satisfy the first condition, and it is determined that the space usage information corresponding to the i-th first combined table and the space usage information corresponding to the j-th second combined table satisfy the second condition, table management information corresponding to each sub-table in the i-th first combined table is determined according to a third table management policy. Here, i is a positive integer, i≤N; j is a positive integer, j≤M.
[0139] Among them, the second condition can be set in advance; moreover, the embodiment of the present application does not limit the second condition. For example, if the space usage information includes the occupied space value, the second condition can be that the space usage information corresponding to the i-th first combined table is higher than the space usage information corresponding to the j-th second combined table.
[0140] The third table management strategy refers to a pre-set management strategy for the sub-tables in the first combined table whose number of sub-tables does not show an increasing trend but whose occupied space value shows an increasing trend; moreover, the embodiment of the present application is not limited to the third table management strategy. For example, the third table management strategy may include adjusting the storage period of data in the sub-tables or expanding the capacity.
[0141] Based on the relevant content of S426 above, it can be known that after obtaining the i-th first combined table, a second combined table whose identifier successfully matches the identifier of the i-th first combined table can be searched from the M second combined tables, so that after determining that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table is compared with the number of sub-tables corresponding to the j-th second combined table, so that after determining that the number of sub-tables corresponding to the i-th first combined table is not greater than the number of sub-tables corresponding to the j-th second combined table, it is determined whether the space usage information corresponding to the i-th first combined table matches the space usage information corresponding to the j-th second combined table. Whether the space usage information corresponding to the table satisfies the second condition is determined. If the second condition is satisfied, it is determined that the increasing trend in the occupied space value corresponding to the first combined table is likely due to business expansion. Therefore, the third table management policy can be determined as the table management policy corresponding to each sub-table in the i-th first combined table. Based on the table management policy corresponding to each sub-table in the i-th first combined table, table management information corresponding to each sub-table in the i-th first combined table is generated, so that the table management information corresponding to each sub-table in the i-th first combined table can accurately represent the table management policy that should be implemented for each sub-table in the i-th first combined table. Wherein, i is a positive integer, i≤N; j is a positive integer, j≤M.
[0142] It should be noted that, when it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table do not meet the first condition, and it is determined that the space usage information corresponding to the i-th first combined table and the space usage information corresponding to the j-th second combined table do not meet the second condition, the table management information corresponding to each sub-table in the i-th first combined table is determined according to the fourth table management strategy. The fourth table management strategy may include not performing any processing on the sub-tables. i is a positive integer, i≤N; j is a positive integer, j≤M.
[0143] S427: Determine the table management information corresponding to the first non-fragmented table set based on the table management information corresponding to each sub-table in the i-th first combined table, where i is a positive integer and i≤N.
[0144] In an embodiment of the present application, after obtaining the table management information corresponding to each sub-table in the 1st first combined table to the table management information corresponding to each sub-table in the Nth first combined table, the table management information corresponding to each sub-table in the 1st first combined table to the table management information corresponding to each sub-table in the Nth first combined table are directly summarized to generate the table management information corresponding to the first non-fragmented table set, so that the table management information corresponding to the first non-fragmented table set can accurately represent the table management strategy that should be adopted for each sub-table in the first non-fragmented table set.
[0145] In addition, for tables other than shard tables in the first non-fragmented table set, the space usage information corresponding to the yth table can be compared with the space usage information corresponding to each table other than shard tables in the second non-fragmented table set. When it is determined that the identifier of the yth table successfully matches the identifier of the zth table in the second non-fragmented table set, and the space usage information corresponding to the yth table and the space usage information corresponding to the zth table in the second non-fragmented table set meet a third condition, the table management information corresponding to the yth table is determined according to the fourth table management policy. Here, y is a positive integer, y≤Y, and Y represents the number of tables other than shard tables in the first non-fragmented table set.
[0146] The third condition can be set in advance; moreover, the embodiment of the present application does not limit the third condition. For example, if the space usage information includes an occupied space value, the third condition can be that the space usage information corresponding to the yth table is higher than the space usage information corresponding to the zth table in the second non-fragmented table set.
[0147] The fourth table management strategy refers to a pre-set management strategy for tables other than shard tables whose occupied space values show an increasing trend; moreover, the embodiment of the present application does not limit the fourth table management strategy. For example, the fourth table management strategy may include the storage period or expansion of data in tables other than shard tables.
[0148] It can be seen that for the yth table excluding the shard tables in the first non-fragmented table set, a table whose identifier successfully matches the identifier of the yth table can be searched from all tables excluding the shard tables in the second non-fragmented table set. After determining that the identifier of the yth table successfully matches the identifier of the zth table in the second non-fragmented table set, it is determined whether the space usage information corresponding to the yth table and the space usage information corresponding to the zth table in the second non-fragmented table set meet the third condition. If the third condition is met, the table management information corresponding to the yth table can be determined according to the fourth table management policy. Where y is a positive integer, y≤Y, and Y represents the number of tables excluding the shard tables in the first non-fragmented table set.
[0149] Based on the relevant content of S42 above, it can be known that after obtaining the space usage information corresponding to the first non-fragmented table set and the space usage information corresponding to the second non-fragmented table set, the space usage information corresponding to the first non-fragmented table set can be compared with the space usage information corresponding to the second non-fragmented table set to determine the table management information corresponding to the first non-fragmented table set, so that the table management information corresponding to the first non-fragmented table set can accurately represent the table management strategy that should be adopted for each table in the first non-fragmented table set.
[0150] S43: Determine the table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set as the table management information corresponding to the relational database.
[0151] In an embodiment of the present application, after obtaining the table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set, the table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set can be determined as the table management information corresponding to the relational database, so that the table management information corresponding to the relational database can accurately represent the table management strategy that should be adopted for each table in the relational database.
[0152] Based on the relevant content of S4 above, it can be known that after obtaining the spatial usage information corresponding to the relational database at the first time point and the spatial usage information corresponding to the relational database at the second time point, the table management information corresponding to the relational database can be analyzed from the spatial usage information corresponding to the relational database at the first time point and the spatial usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe the management strategy adopted for the table in the relational database at the first time point.
[0153] In addition, in order to further improve the management accuracy of the relational database, the embodiment of the present application also provides a possible implementation method of a method for determining table management information of a relational database. In this implementation method, in addition to the above S1-S4, the method for determining table management information of the relational database may also include S5-S7:
[0154] S5: Send the table management information corresponding to the relational database to the user.
[0155] The embodiment of the present application does not limit the sending method of the table management information corresponding to the relational database. For example, it can be displayed on the user interface, sent to the user in the form of a text message, or sent to the user in the form of an email.
[0156] Based on the relevant content of S5 above, it can be known that after obtaining the table management information corresponding to the relational database, the table management information corresponding to the relational database can be sent to the user so that the user can know the table management strategy adopted for each table in the relational database.
[0157] S6: Sort the N first combined table sets according to the space usage information corresponding to the N first combined table sets to obtain a sorted table list corresponding to the relational database at the first time point.
[0158] In an embodiment of the present application, after obtaining the space usage information corresponding to the N first combined table sets, the N first combined table sets can be sorted according to the space usage information corresponding to the N first combined table sets (for example, sorted from large to small according to the occupied space value, or sorted from small to large according to the occupied space value), and the table sorting list corresponding to the relational database at the first time point is obtained, so that the table sorting list can accurately represent the size sorting of the space occupied by each first combined table.
[0159] S7: Send the sorted table list corresponding to the relational database at the first time point to the user.
[0160] The embodiment of the present application does not limit the sending method of the table sorting list corresponding to the relational database at the first time point. For example, it can be displayed on the user interface, sent to the user in the form of a text message, or sent to the user in the form of an email.
[0161] It can be seen that after obtaining the table sorting list corresponding to the relational database at the first time point, the table sorting list can be sent to the user so that the user can know the size sorting of the space occupied by each first combined table in the relational database.
[0162] Based on the relevant content of the above-mentioned “method for determining table management information of a relational database”, it can be known that the method for determining table management information of a relational database provided in the embodiment of the present application (for example, as shown in FIG. Figure 1 or Figure 2As shown in FIG, after obtaining the first table detail information and the second table detail information, the space usage information corresponding to the relational database at the first time point can be determined based on the first table detail information, and the space usage information corresponding to the relational database at the second time point can be determined based on the second table detail information; then, based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, the table management information corresponding to the relational database can be determined, so that the table management information corresponding to the relational database is used to describe the management strategy adopted for the tables in the relational database at the first time point. The first table detail information includes the space occupancy information of each table in the relational database collected at the first time point; the second table detail information includes the space occupancy information of each table in the relational database collected at the second time point; and the first time point is later than the second time point by a preset length. In this way, the table management information of the relational database is automatically determined, so that the table management information can accurately represent the management strategy required for the tables in the relational database, which is conducive to improving the management accuracy of the relational database.
[0163] Based on the method for determining table management information of a relational database provided in the above method embodiment, an embodiment of the present application further provides a device for determining table management information of a relational database, which is explained and illustrated below in conjunction with the accompanying drawings.
[0164] Device embodiment
[0165] For technical details of the apparatus for determining table management information of a relational database provided in the apparatus embodiment, please refer to the above method embodiment.
[0166] See also Figure 3 , this figure is a structural diagram of a table management information determination device for a relational database provided in an embodiment of the present application.
[0167] The apparatus 300 for determining table management information of a relational database provided in an embodiment of the present application includes:
[0168] The information acquisition unit 301 is configured to acquire first table detail information and second table detail information; wherein the first table detail information includes space occupancy information of each table in the relational database collected at a first time point; the second table detail information includes space occupancy information of each table in the relational database collected at a second time point; the first time point is later than the second time point by a preset time period;
[0169] A first determining unit 302 is configured to determine space usage information corresponding to the relational database at a first time point based on the first table detailed information;
[0170] A second determining unit 303 is configured to determine space usage information corresponding to the relational database at a second time point based on the second table detailed information;
[0171] The third determination unit 304 is used to determine the table management information corresponding to the relational database based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe the management strategy adopted for the table in the relational database at the first time point.
[0172] In a possible implementation manner, the first determining unit 302 is specifically configured to:
[0173] Determining a first fragmented table set and a first non-fragmented table set based on the first table detail information; wherein the first fragmented table set is used to record each fragmented table of the relational database at a first point in time; and the first non-fragmented table set is used to record each non-fragmented table of the relational database at the first point in time;
[0174] Determining the preset space usage information as the space usage information corresponding to the first fragment table set;
[0175] Determining space usage information corresponding to the first non-fragmented table set based on the first table detail information;
[0176] The space usage information corresponding to the first fragmented table set and / or the space usage information corresponding to the first non-fragmented table set is determined as the space usage information corresponding to the relational database at the first time point.
[0177] In a possible implementation manner, the second determining unit 303 is specifically configured to:
[0178] Determining a second fragmented table set and a second non-fragmented table set based on the second table details; wherein the second fragmented table set is used to record each fragmented table of the relational database at the second time point; and the second non-fragmented table set is used to record each non-fragmented table of the relational database at the second time point;
[0179] Determining the preset space usage information as the space usage information corresponding to the second fragment table set;
[0180] Determining space usage information corresponding to the second non-fragmented table set according to the second table detail information;
[0181] The space usage information corresponding to the second fragmented table set and / or the space usage information corresponding to the second non-fragmented table set is determined as the space usage information corresponding to the relational database at the second time point.
[0182] In a possible implementation, the third determining unit 304 includes:
[0183] a first determining subunit configured to determine, if the space usage information corresponding to the relational database at the second time point includes the space usage information corresponding to the first fragmented table set and the space usage information corresponding to the first non-fragmented table set, and if the space usage information corresponding to the relational database at the second time point includes the space usage information corresponding to the second non-fragmented table set, determine, according to the first table management policy, the table management information corresponding to the first fragmented table set;
[0184] a second determining subunit, configured to compare the space usage information corresponding to the first non-fragmented table set with the space usage information corresponding to the second non-fragmented table set, to obtain table management information corresponding to the first non-fragmented table set;
[0185] The third determining subunit is configured to determine the table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set as the table management information corresponding to the relational database.
[0186] In a possible implementation manner, the second determining subunit is specifically configured to:
[0187] Aggregating all sub-tables in the first non-fragmented table set to obtain N first combined tables, identifiers of the first combined tables, and the number of sub-tables corresponding to the first combined tables; where N is a positive integer;
[0188] Aggregating all sub-tables in the second non-fragmented table set to obtain M second combined tables, identifiers of the second combined tables, and the number of sub-tables corresponding to the second combined tables; where M is a positive integer;
[0189] Determining space usage information corresponding to each first combined table based on space usage information corresponding to the first non-fragmented table set;
[0190] determining, based on the space usage information corresponding to the second non-fragmented table set, space usage information corresponding to each second combined table;
[0191] When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, and the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table meet a first condition, determining table management information corresponding to each sub-table in the i-th first combined table according to a second table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M;
[0192] When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table do not satisfy the first condition, and it is determined that the space usage information corresponding to the i-th first combined table and the space usage information corresponding to the j-th second combined table satisfy the second condition, determining the table management information corresponding to each sub-table in the i-th first combined table according to the third table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M;
[0193] The table management information corresponding to the first non-fragmented table set is determined according to the table management information corresponding to each sub-table in the i-th first combined table.
[0194] In a possible implementation, the table management information determining device 300 further includes:
[0195] a fourth determining unit, configured to sort the N first combined table sets according to the space usage information corresponding to the N first combined table sets, to obtain a sorted table list corresponding to the relational database at the first time point;
[0196] The information sending unit is used to send the table sorting list corresponding to the relational database at the first time point to the user.
[0197] Based on the above-described apparatus 300 for determining table management information for a relational database, it can be seen that after obtaining first table details and second table details, the apparatus can first determine the space usage information corresponding to the relational database at a first time point based on the first table details, and then determine the space usage information corresponding to the relational database at a second time point based on the second table details. Table management information corresponding to the relational database can then be determined based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe the management policy adopted for the tables in the relational database at the first time point. The first table details include space usage information for each table in the relational database collected at the first time point; the second table details include space usage information for each table in the relational database collected at the second time point; and the first time point is later than the second time point by a preset amount. This automatically determines the table management information for the relational database, so that the table management information accurately represents the management policy to be adopted for the tables in the relational database, thereby improving the management accuracy of the relational database.
[0198] Furthermore, an embodiment of the present application also provides a device, comprising a processor and a memory:
[0199] The memory is used to store computer programs;
[0200] The processor is configured to execute any implementation of the method for determining table management information of a relational database provided in the embodiments of the present application according to the computer program.
[0201] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute any implementation of the method for determining table management information of a relational database provided in the embodiment of the present application.
[0202] Furthermore, an embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes any implementation of the method for determining table management information of a relational database provided in the embodiment of the present application.
[0203] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0204] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as above with a preferred embodiment, it is not intended to limit the present invention. Any technician familiar with the art can make many possible changes and modifications to the technical solution of the present invention using the methods and technical contents disclosed above without departing from the scope of the technical solution of the present invention, or modify it into an equivalent embodiment of equivalent changes. Therefore, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of protection of the technical solution of the present invention.
Claims
1. A method for determining table management information of a relational database, characterized in that: The method comprises: Obtaining first table detail information and second table detail information; wherein the first table detail information includes space occupancy information of each table in the relational database collected at a first time point; the second table detail information includes space occupancy information of each table in the relational database collected at a second time point; the first time point is later than the second time point by a preset time period; Determining space usage information corresponding to the relational database at a first point in time based on the first table detailed information; determining, based on the detailed information of the second table, space usage information corresponding to the relational database at a second point in time; determining, based on the space usage information corresponding to the relational database at a first point in time and the space usage information corresponding to the relational database at a second point in time, table management information corresponding to the relational database, so that the table management information corresponding to the relational database is used to describe a management policy adopted for a table in the relational database at the first point in time; If the space usage information corresponding to the relational database at the second time point includes space usage information corresponding to the first fragmented table set and space usage information corresponding to the first non-fragmented table set, and the space usage information corresponding to the relational database at the second time point includes space usage information corresponding to the second non-fragmented table set, then the process of determining the table management information corresponding to the relational database includes: When it is determined that the space usage information corresponding to the first fragmented table set corresponds to the first table management policy, determining table management information corresponding to the first fragmented table set according to the first table management policy; wherein the first fragmented table set is used to record each fragmented table of the relational database at the first time point; Comparing space usage information corresponding to the first non-fragmented table set with space usage information corresponding to the second non-fragmented table set to obtain table management information corresponding to the first non-fragmented table set; the first non-fragmented table set is used to record each non-fragmented table of the relational database at a first point in time; the second non-fragmented table set is used to record each non-fragmented table of the relational database at a second point in time; Determining the table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set as the table management information corresponding to the relational database; The comparing the space usage information corresponding to the first non-fragmented table set with the space usage information corresponding to the second non-fragmented table set to obtain the table management information corresponding to the first non-fragmented table set includes: Aggregating all sub-tables in the first non-fragmented table set to obtain N first combined tables, identifiers of the first combined tables, and the number of sub-tables corresponding to the first combined tables; where N is a positive integer; Aggregating all sub-tables in the second non-fragmented table set to obtain M second combined tables, identifiers of the second combined tables, and the number of sub-tables corresponding to the second combined tables; where M is a positive integer; Determining space usage information corresponding to each first combined table based on space usage information corresponding to the first non-fragmented table set; determining, based on the space usage information corresponding to the second non-fragmented table set, space usage information corresponding to each second combined table; When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, and the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table meet a first condition, determining table management information corresponding to each sub-table in the i-th first combined table according to a second table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M; When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table do not satisfy the first condition, and it is determined that the space usage information corresponding to the i-th first combined table and the space usage information corresponding to the j-th second combined table satisfy the second condition, determining the table management information corresponding to each sub-table in the i-th first combined table according to the third table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M; The table management information corresponding to the first non-fragmented table set is determined according to the table management information corresponding to each sub-table in the i-th first combined table.
2. The method according to claim 1, characterized in that The determining, based on the first table detailed information, space usage information corresponding to the relational database at a first point in time includes: Determining a first fragmented table set and a first non-fragmented table set according to the first table detailed information; Determining the preset space usage information as the space usage information corresponding to the first fragment table set; Determining space usage information corresponding to the first non-fragmented table set based on the first table detail information; The space usage information corresponding to the first fragmented table set and / or the space usage information corresponding to the first non-fragmented table set is determined as the space usage information corresponding to the relational database at the first time point.
3. The method according to claim 1, characterized in that The determining, based on the detailed information of the second table, space usage information corresponding to the relational database at the second time point includes: Determining a second fragmented table set and a second non-fragmented table set based on the second table detail information; wherein the second fragmented table set is used to record each fragmented table of the relational database at the second time point; Determining the preset space usage information as the space usage information corresponding to the second fragment table set; Determining space usage information corresponding to the second non-fragmented table set according to the second table detail information; The space usage information corresponding to the second fragmented table set and / or the space usage information corresponding to the second non-fragmented table set is determined as the space usage information corresponding to the relational database at the second time point.
4. The method according to claim 1, wherein The method further comprises: Sorting the N first combined table sets according to space usage information corresponding to the N first combined table sets to obtain a sorted list of tables corresponding to the relational database at a first time point; The sorted list of tables corresponding to the relational database at the first time point is sent to the user.
5. A device for determining table management information of a relational database, characterized in that: include: an information acquisition unit, configured to acquire first table detail information and second table detail information; wherein the first table detail information includes space occupancy information of each table in the relational database collected at a first time point; the second table detail information includes space occupancy information of each table in the relational database collected at a second time point; the first time point is later than the second time point by a preset time period; A first determining unit is configured to determine space usage information corresponding to the relational database at a first time point based on the first table detailed information; A second determining unit is configured to determine space usage information corresponding to the relational database at a second time point based on the detailed information of the second table; a third determining unit, configured to determine table management information corresponding to the relational database based on the space usage information corresponding to the relational database at the first time point and the space usage information corresponding to the relational database at the second time point, so that the table management information corresponding to the relational database is used to describe a management policy adopted for a table in the relational database at the first time point; The third determining unit includes: A first determining subunit is configured to, if the space usage information corresponding to the relational database at the second time point includes space usage information corresponding to the first fragmented table set and space usage information corresponding to the first non-fragmented table set, and the space usage information corresponding to the relational database at the second time point includes space usage information corresponding to the second non-fragmented table set, determine, based on the first table management policy, table management information corresponding to the first fragmented table set when it is determined that the space usage information corresponding to the first fragmented table set corresponds to a first table management policy; the first fragmented table set is used to record each fragmented table of the relational database at the first time point; a second determining subunit, configured to compare space usage information corresponding to the first non-fragmented table set with space usage information corresponding to the second non-fragmented table set, to obtain table management information corresponding to the first non-fragmented table set; the first non-fragmented table set is configured to record each non-fragmented table of the relational database at a first point in time; and the second non-fragmented table set is configured to record each non-fragmented table of the relational database at a second point in time; a third determining subunit, configured to determine the table management information corresponding to the first fragmented table set and the table management information corresponding to the first non-fragmented table set as the table management information corresponding to the relational database; The second determining subunit is specifically configured to: Aggregating all sub-tables in the first non-fragmented table set to obtain N first combined tables, identifiers of the first combined tables, and the number of sub-tables corresponding to the first combined tables; where N is a positive integer; Aggregating all sub-tables in the second non-fragmented table set to obtain M second combined tables, identifiers of the second combined tables, and the number of sub-tables corresponding to the second combined tables; where M is a positive integer; Determining space usage information corresponding to each first combined table based on space usage information corresponding to the first non-fragmented table set; determining, based on the space usage information corresponding to the second non-fragmented table set, space usage information corresponding to each second combined table; When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, and the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table meet a first condition, determining table management information corresponding to each sub-table in the i-th first combined table according to a second table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M; When it is determined that the identifier of the i-th first combined table successfully matches the identifier of the j-th second combined table, the number of sub-tables corresponding to the i-th first combined table and the number of sub-tables corresponding to the j-th second combined table do not satisfy the first condition, and it is determined that the space usage information corresponding to the i-th first combined table and the space usage information corresponding to the j-th second combined table satisfy the second condition, determining the table management information corresponding to each sub-table in the i-th first combined table according to the third table management strategy; wherein i is a positive integer, i≤N; j is a positive integer, j≤M; The table management information corresponding to the first non-fragmented table set is determined according to the table management information corresponding to each sub-table in the i-th first combined table.
6. A device, characterized in that The device includes a processor and a memory: The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 4 according to the computer program.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 4.
8. A computer program product, characterized in that When the computer program product is run on a terminal device, the terminal device is enabled to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
PostgreSQL database mass data management method and system
CN105893531A
Database table space capacity monitoring method and device
CN110287082A