Method, device and electronic device for determining primary key of data table
By calculating the concurrency amount of the service to determine the time accuracy of the primary key of the data table, the conflict problem caused by time as the primary key is solved, and the distinction between data tables and normal operation of the business is realized.
Patent Information
- Application Number
- CN202110954572.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-19
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2041-08-19
AI Technical Summary
Using time as the content of the primary key of the data table can easily cause primary key conflicts, which will in turn be unable to distinguish data tables, affecting the normal processing of business.
By obtaining the historical execution data of the target service, calculate the maximum service concurrency amount under different time units, determine the target time unit in the order of time units from large to small, and adjust the time accuracy of the time in the data table primary key.
It avoids primary key conflicts, realizes the distinction between data tables, and ensures normal business processing.
Smart Images

Figure CN113656409B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and more specifically, to a method, device and electronic device for determining a primary key of a data table. Background Art
[0002] The business volume of the banking system is large, and each business will generate multiple data tables. At present, the multiple data tables are generally distinguished by setting different primary keys for the data tables.
[0003] In actual applications, the time corresponding to a data table is generally used as the content of the primary key of the data table, and the time can be the creation time, etc. Using time as the content of the primary key of a data table is likely to cause primary key conflicts, and thus the data tables cannot be distinguished, affecting the normal handling of business. Summary of the invention
[0004] In view of this, the present invention provides a method, device and electronic device for determining the primary key of a data table to solve the problem that using time as the primary key of a data table easily causes primary key conflicts, and thus cannot distinguish data tables, affecting the normal handling of business.
[0005] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0006] A method for determining a primary key of a data table, comprising:
[0007] When receiving a primary key determination instruction, obtaining a target business in the primary key determination instruction;
[0008] Based on the historical execution data of the target business, obtaining the maximum business concurrency of the target business in different time units;
[0009] According to the order of time units from large to small, determine the time unit whose corresponding maximum business concurrency meets the maximum business concurrency rule, and use it as the target time unit;
[0010] An adjustment operation of the time precision of the time in the primary key of the data table of the target business is performed based on the target time unit.
[0011] Optionally, determining a time unit in which the corresponding maximum business concurrency meets the maximum business concurrency rule in descending order of time units, and using the time unit as the target time unit includes:
[0012] Sorting the time units from large to small to obtain a sorting result, and setting the processing flags of all the time units as unprocessed;
[0013] Determine the time unit with the processing mark of the sorting result as unprocessed and with the largest sorting number, and use it as the time unit to be processed;
[0014] Determine whether the maximum concurrent business volume corresponding to the pending time unit is not greater than a preset threshold;
[0015] If yes, the time unit to be processed is used as the target time unit;
[0016] If not, the processing flag of the pending time unit is set to processed, and the process returns to the step of determining that the processing flag of the sorting result is unprocessed and the time unit with the largest sorting number, until it is determined whether the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold value;
[0017] If the result is that the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold, the last pending time unit is used as the target time unit;
[0018] If the result is that the maximum business concurrency corresponding to the last pending time unit is greater than the preset threshold, the last pending time unit is used as the time unit limit value.
[0019] Optionally, based on the historical execution data of the target service, obtaining the maximum service concurrency of the target service in different time units includes:
[0020] The historical execution data of the target business is obtained, and the maximum business concurrency under different time units at the same time is filtered out from the historical execution data.
[0021] Optionally, receiving a primary key determination instruction includes:
[0022] Obtain error information during business execution, and determine whether the error information is primary key time conflict information;
[0023] If so, it is determined that a primary key determination instruction is received, and the business information in the error message is used as the target business in the primary key determination instruction.
[0024] Optionally, adjusting the time precision of the time in the primary key based on the target time unit includes:
[0025] The time precision of the primary key corresponding to the target business is set to the target time unit.
[0026] Optionally, receiving a primary key determination instruction includes:
[0027] Receiving a service query instruction input by a user on a display interface; the service query instruction includes a target service;
[0028] The business query instruction is used as a primary key to determine the instruction.
[0029] Optionally, adjusting the time precision of the time in the primary key based on the target time unit includes:
[0030] The target time unit is displayed on the display interface, and the user adjusts the time precision of the primary key time of the target business according to the target time unit.
[0031] A device for determining a primary key of a data table, comprising:
[0032] A business acquisition module, configured to acquire a target business in the primary key determination instruction upon receiving the primary key determination instruction;
[0033] A concurrency acquisition module, used to acquire the maximum business concurrency of the target business in different time units based on the historical execution data of the target business;
[0034] A time unit determination module, used to determine, in descending order of time units, a time unit whose corresponding maximum business concurrency satisfies the maximum business concurrency rule, and use it as a target time unit;
[0035] The precision adjustment module is used to adjust the time precision of the time in the primary key of the data table of the target business based on the target time unit.
[0036] Optionally, the time unit determination module includes:
[0037] A first flag setting submodule is used to sort the time units from large to small to obtain a sorting result, and set the processing flags of all the time units to unprocessed;
[0038] A first unit determination submodule is used to determine the time unit with the processing mark of the sorting result as unprocessed and the largest sorting number, and use it as the time unit to be processed;
[0039] A concurrency determination submodule is used to determine whether the maximum business concurrency corresponding to the to-be-processed time unit is not greater than a preset threshold;
[0040] A second unit determination submodule, configured to, if yes, use the to-be-processed time unit as the target time unit;
[0041] A second flag setting submodule, for setting the processing flag of the time unit to be processed as processed if no;
[0042] A judgment submodule is used to judge whether the time unit to be processed is the last one;
[0043] The first unit determination submodule is further configured to, when the time unit to be processed is not the last one, determine the time unit with the processing mark of the sorting result as unprocessed and with the largest sorting number, and use it as the time unit to be processed;
[0044] The third unit determination submodule is used to use the last time unit to be processed as the time unit limit value when the time unit to be processed is the last one and the maximum business concurrency corresponding to the last time unit to be processed is greater than a preset threshold.
[0045] An electronic device comprising: a memory and a processor;
[0046] Wherein, the memory is used to store programs;
[0047] The processor calls the program and is used to execute the above-mentioned method for determining the primary key of the data table.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] The present invention provides a method, device and electronic device for determining the primary key of a data table. When receiving a primary key determination instruction, the target business in the primary key determination instruction is obtained, and based on the historical execution data of the target business, the maximum business concurrency of the target business under different time units is obtained. According to the order of time units from large to small, the time unit whose corresponding maximum business concurrency satisfies the maximum business concurrency rule is determined, and the time unit is used as the target time unit, and the time precision of the time in the primary key of the data table of the target business is adjusted based on the target time unit. That is, in the present invention, when there are multiple data tables corresponding to the same business, the time precision of the time in the primary key is adjusted based on the maximum business concurrency, so that the time in the primary key of the data table does not conflict, the data table can be distinguished, and the normal handling of the business is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0051] Figure 1 A method flow chart of a method for determining a primary key of a data table provided by an embodiment of the present invention;
[0052] Figure 2 A method flow chart of another method for determining a primary key of a data table provided by an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of the structure of a device for determining a primary key of a data table provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] In actual applications, the time corresponding to a data table is generally used as the content of the primary key of the data table, and the time can be the creation time, etc. Using time as the content of the primary key of a data table is likely to cause primary key conflicts, and thus the data tables cannot be distinguished, affecting the normal handling of business.
[0056] For example, suppose there is a data table ABC, which was created on 12.01, 12.02, and 12.03. If the time precision of the primary key is hour, then the hour corresponding to 12.01, 12.02, and 12.03 is 12. In other words, the primary keys of the data table ABC are 12, 12, and 12 respectively.
[0057] When multiple data tables corresponding to the same business have the same time, the primary keys of the multiple data tables will be the same. When querying a primary key content, such as 12 mentioned above, more data tables will appear, and it will be impossible to determine which data table is required, resulting in the inability to handle the business normally.
[0058] In order to solve this technical problem, the inventor discovered through research that the time precision of the time in the primary key can be selected based on the maximum concurrency of the business, so that the time of the primary key of any two data tables is different. Therefore, when performing primary key screening, one data table can be uniquely determined to ensure the normal execution of the business.
[0059] Based on the above content, the embodiment of the present invention provides a method, device and electronic device for determining the primary key of a data table, which can be used in the field of big data or finance. The above is only an example and does not limit the application field of the method, device and electronic device for determining the primary key of a data table provided by the present invention.
[0060] Reference Figure 1 The present invention provides a method for determining a primary key of a data table, which may include:
[0061] S11. When a primary key determination instruction is received, a target business in the primary key determination instruction is obtained.
[0062] In this embodiment, when the user actively queries the time accuracy of the primary key, or when the system reports an error and determines that the error information is primary key time conflict information, it can be considered that the primary key determination instruction has been received.
[0063] Now let’s talk about it in detail:
[0064] 1. Receive the primary key determination instruction, including:
[0065] A business query instruction input by a user on a display interface is received; the business query instruction includes a target business, and the business query instruction is used as a primary key to determine the instruction.
[0066] The execution subject in this embodiment may be a time accuracy determination system, which is provided with a display interface, which may display a time accuracy query interface, on which the user is required to input a service. In this embodiment, the user may enter a service code or a service name, and click the OK button, at which time the time accuracy determination system may receive a service query instruction entered by the user on the display interface, the service query instruction including the service code or service name of the target service. Among them, the service code or service name may uniquely determine a target service, such as transfer, remittance, account opening, and other services.
[0067] After receiving the business query instruction, the business query instruction is considered as a primary key determination instruction.
[0068] It should be noted that the scenario of inputting business query instructions in this embodiment can be carried out during the process of developers developing the system. During the development process, if the developer is uncertain about the time accuracy of the primary key of a certain business, the time accuracy determination system in this embodiment can be used to query the corresponding time accuracy.
[0069] 2. Receive the primary key determination instruction, including:
[0070] 1) Obtain error information during business execution and determine whether the error information is primary key time conflict information;
[0071] 2) If yes, it is determined that a primary key determination instruction is received, and the business information in the error message is used as the target business in the primary key determination instruction.
[0072] This embodiment can be applied to scenarios during the use of the system. During the use of the system, there may be primary key time conflicts, such as multiple data tables being queried when querying a primary key time. This may be because the primary key conflict problem was not considered during development, or the time precision of the primary key set during development is not suitable for the current business scenario.
[0073] In addition, other error situations may occur, such as insufficient running memory, data call failure, etc. In this embodiment, the primary key time conflict situation is analyzed in detail. After obtaining the error information during the business execution process, it is determined whether the error information is the primary key time conflict information. If so, it means that the error is caused by the time accuracy of the primary key time.
[0074] In this embodiment, the obtained error information can be matched with the time accuracy problem library. The time accuracy problem library is problem information summarized by experienced developers based on previous error information and system analysis. If the error information matches the primary key time conflict problem, it is considered that the primary key time conflict is caused by the time accuracy error.
[0075] When it is determined that the error message is a primary key time conflict message, it is determined that a primary key determination instruction has been received, and the service information in the error message is used as the target service in the primary key determination instruction. The service information in this embodiment may also be the above service code or service name.
[0076] After that, it is possible to check whether the current time accuracy meets the current concurrency requirement. If it does, a warning message is output and the problem is manually found. If it does not, step S12 is executed.
[0077] S12: Based on the historical execution data of the target service, obtain the maximum service concurrency of the target service in different time units.
[0078] After determining the target business, such as the transfer business, the maximum business concurrency of the target business in different time units will be obtained.
[0079] In this embodiment, the time unit may be hours, minutes, seconds, milliseconds, etc.
[0080] The historical execution data of the target business is obtained, and then the maximum business concurrency under different time units at the same time is filtered out from the historical execution data.
[0081] The historical execution data is the business data of the target business in the historical time period, and the business data can be obtained through log query.
[0082] Taking the target business as transfer business, for example, to query the historical execution data of the transfer business, you can query all the transfer data, or you can query the transfer data of the past month, and then query the maximum concurrent business volume at the same time in hours, the maximum concurrent business volume at the same time in minutes, the maximum concurrent business volume at the same time in seconds, the maximum concurrent business volume at the same time in milliseconds...
[0083] Among them, the maximum concurrent business volume at the same time in hours can be 20, the maximum concurrent business volume at the same time in minutes can be 5, the maximum concurrent business volume at the same time in seconds can be 2, and the maximum concurrent business volume at the same time in milliseconds can be 1...
[0084] S13. According to the order of time units from large to small, determine the time unit whose corresponding maximum business concurrency satisfies the maximum business concurrency rule, and use it as the target time unit.
[0085] In practical applications, refer to Figure 2 , step S13 may include:
[0086] S21. Sort the time units from large to small to obtain a sorting result, and set the processing flags of all the time units to unprocessed.
[0087] Specifically, the order of time units from large to small is hours, minutes, seconds, milliseconds...
[0088] For each time unit, a corresponding processing mark is set. When the time unit has not been queried, the processing mark is unprocessed.
[0089] S22: Determine the time unit with the processing mark of the sorting result as unprocessed and with the largest sorting number, and use it as the time unit to be processed.
[0090] In this embodiment, the time units with the processing mark of unprocessed and the largest sorting number in the sorting results are screened out, that is, the time units at the front and with the processing mark of unprocessed are screened out in the above sorting results.
[0091] In this embodiment, the unit that is preferentially screened out is "hour", that is, "hour" is used as the time unit to be processed.
[0092] S23. Determine whether the maximum concurrent business volume corresponding to the to-be-processed time unit is not greater than a preset threshold; if so, execute step S24; if not, execute step S25.
[0093] Taking the above “the maximum concurrent business volume at the same time in hours can be 20, the maximum concurrent business volume at the same time in minutes can be 5, the maximum concurrent business volume at the same time in seconds can be 2, the maximum concurrent business volume at the same time in milliseconds can be 1…” as an example, in this embodiment, the preset threshold value can be 1. The reason for setting 1 is:
[0094] Only when the corresponding maximum business concurrency is not greater than 1, there will be at most one business at that moment. Then, using this time precision can ensure that the time of the primary key of the data table between the same businesses does not conflict.
[0095] For example, the maximum concurrent business volume at the same time in hours can be 20, which means that there are 20 business data tables in the same hour. If the primary keys of these 20 data tables are in hours, they all correspond to the same hour, resulting in the same primary keys of multiple data tables. However, if the maximum concurrent business volume at the same time in hours is only one, then only one data table's primary key uses the hour, which will not result in the same primary keys of multiple data tables.
[0096] Therefore, the present invention needs to determine whether the maximum concurrent business volume corresponding to the to-be-processed time unit is not greater than a preset threshold.
[0097] S24: Taking the time unit to be processed as the target time unit.
[0098] When the maximum concurrent business volume corresponding to the pending time unit is not greater than the preset threshold, it means that the time accuracy of using the pending time unit as the primary key will not cause primary key conflict.
[0099] S25. Setting the processing flag of the time unit to be processed as processed.
[0100] If the maximum concurrent business volume corresponding to the pending time unit is greater than the preset threshold, it means that the time accuracy of using the pending time unit as the primary key will cause a primary key conflict. At this time, the processing flag of the pending time unit is set to processed, and the next time unit is judged.
[0101] S26. Determine whether the time unit to be processed is the last one; if so, execute step S27; if not, execute step S22.
[0102] Specifically, if the time unit to be processed is the last one, it means that it has been determined whether the maximum business concurrency corresponding to all time units is not greater than the preset threshold.
[0103] If the result of determining whether the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold is that the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold, the last pending time unit is used as the target time unit.
[0104] If the result of whether the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold is that the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold, it means that all pending time units do not meet the requirements. At this time, the last pending time unit is used as the time unit limit value and output to the user, so that the user can determine the time accuracy according to the actual situation. Among them, the time unit limit value is the smallest time unit that can be set currently.
[0105] If the time unit to be processed is not the last one, continue to judge the next time unit, such as judging in the order of hours, minutes, seconds, and milliseconds, that is, return to step S22 and execute sequentially.
[0106] S27: When the maximum business concurrency corresponding to the last pending time unit is greater than a preset threshold, the last pending time unit is used as the time unit limit value.
[0107] Specifically, after determining whether the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold, if the result is that the maximum business concurrency corresponding to the last pending time unit is greater than the preset threshold, the last pending time unit is used as the time unit limit value.
[0108] According to the above example, "the maximum concurrent business volume at the same time in hours can be 20, the maximum concurrent business volume at the same time in minutes can be 5, the maximum concurrent business volume at the same time in seconds can be 2, and the maximum concurrent business volume at the same time in milliseconds can be 1...". Since hours, minutes, and seconds do not meet the requirements, but milliseconds do, milliseconds are the target time unit.
[0109] S14: Adjust the time precision of the time in the primary key of the data table of the target business based on the target time unit.
[0110] In actual applications, different specific implementation processes of step S14 may correspond to different implementation steps of "receiving the primary key determination instruction". Specifically, as follows:
[0111] 1. Upon receiving a primary key determination instruction, including: obtaining error information during the business execution process, and determining whether the error information is primary key time conflict information; if so, determining that the primary key determination instruction is received, and taking the business information in the error information as the target business in the primary key determination instruction, step S14 includes:
[0112] The time precision of the primary key corresponding to the target business is set to the target time unit.
[0113] Specifically, in this embodiment, the system can automatically set the time precision, and can set the time precision of the primary key corresponding to the target business to the target time unit to avoid primary key conflicts.
[0114] In practical applications, if a suitable target time unit is not selected, the above time unit limit value can be used as the time precision of the time in the primary key. Then it is determined whether primary key conflict information is continuously received. If so, an error is reported and an early warning message is sent to manually resolve the primary key conflict problem.
[0115] 2. When a primary key determination instruction is received, including: receiving a business query instruction input by a user on a display interface; the business query instruction includes a target business; and when the business query instruction is used as the primary key determination instruction, step S14 includes:
[0116] The target time unit is displayed on the display interface, and the user adjusts the time precision of the primary key time of the target business according to the target time unit.
[0117] Specifically, the target time unit is output to the display interface, and the user can refer to the target time unit and the time unit limit value to set the time precision. For example, if there is a target time unit, the time precision can be set to the target time unit. If there is no target time unit, the time precision can be set to the time unit limit value.
[0118] In this embodiment, when a primary key determination instruction is received, the target business in the primary key determination instruction is obtained, and based on the historical execution data of the target business, the maximum business concurrency of the target business under different time units is obtained, and the time unit corresponding to the maximum business concurrency that satisfies the maximum business concurrency rule is determined in descending order of time units, and the time unit is used as the target time unit, and the time precision of the time in the primary key of the data table of the target business is adjusted based on the target time unit. That is, in the present invention, when there are multiple data tables corresponding to the same business, the time precision of the time in the primary key is adjusted based on the maximum business concurrency, so that the time in the primary key of the data table does not conflict, the normal operation of the system is guaranteed, the distinction of data tables is realized, and the normal handling of the business is guaranteed, and the user experience is improved.
[0119] Optionally, based on the above embodiment of the method for determining the primary key of a data table, another embodiment of the present invention provides a device for determining the primary key of a data table, referring to Figure 3 , which may include:
[0120] The business acquisition module 11 is used to acquire the target business in the primary key determination instruction when receiving the primary key determination instruction;
[0121] A concurrent volume acquisition module 12 is used to acquire the maximum concurrent volume of the target business in different time units based on the historical execution data of the target business;
[0122] The time unit determination module 13 is used to determine the time unit whose corresponding maximum business concurrency meets the maximum business concurrency rule according to the order of time units from large to small, and use it as the target time unit;
[0123] The precision adjustment module 14 is used to adjust the time precision of the time in the primary key of the data table of the target business based on the target time unit.
[0124] Further, the time unit determination module includes:
[0125] A first flag setting submodule is used to sort the time units from large to small to obtain a sorting result, and set the processing flags of all the time units to unprocessed;
[0126] A first unit determination submodule is used to determine the time unit with the processing mark of the sorting result as unprocessed and the largest sorting number, and use it as the time unit to be processed;
[0127] A concurrency determination submodule is used to determine whether the maximum business concurrency corresponding to the to-be-processed time unit is not greater than a preset threshold;
[0128] A second unit determination submodule, configured to, if yes, use the to-be-processed time unit as the target time unit;
[0129] A second flag setting submodule, for setting the processing flag of the time unit to be processed as processed if no;
[0130] A judgment submodule is used to judge whether the time unit to be processed is the last one;
[0131] The first unit determination submodule is further configured to, when the time unit to be processed is not the last one, determine the time unit with the processing mark of the sorting result as unprocessed and with the largest sorting number, and use it as the time unit to be processed;
[0132] The third unit determination submodule is used to use the last time unit to be processed as the time unit limit value when the time unit to be processed is the last one and the maximum business concurrency corresponding to the last time unit to be processed is greater than a preset threshold.
[0133] Furthermore, the concurrent amount acquisition module 12 is specifically used for:
[0134] The historical execution data of the target business is obtained, and the maximum business concurrency under different time units at the same time is filtered out from the historical execution data.
[0135] Further, when receiving the primary key determination instruction, the business acquisition module 11 is specifically used to:
[0136] Obtain error information during business execution, and determine whether the error information is primary key time conflict information; if so, determine that a primary key determination instruction has been received, and use the business information in the error information as the target business in the primary key determination instruction.
[0137] Further, the precision adjustment module 14 is specifically used for:
[0138] The time precision of the primary key corresponding to the target business is set to the target time unit.
[0139] Further, when receiving the primary key determination instruction, the business acquisition module 11 is specifically used to:
[0140] A business query instruction input by a user on a display interface is received; the business query instruction includes a target business; and the business query instruction is used as a primary key to determine an instruction.
[0141] Further, the precision adjustment module 14 is specifically used for:
[0142] The target time unit is displayed on the display interface, and the user adjusts the time precision of the primary key time of the target business according to the target time unit.
[0143] In this embodiment, when a primary key determination instruction is received, the target business in the primary key determination instruction is obtained, and based on the historical execution data of the target business, the maximum business concurrency of the target business under different time units is obtained, and the time unit corresponding to the maximum business concurrency that satisfies the maximum business concurrency rule is determined in descending order of time units, and the time unit is used as the target time unit, and the time precision of the time in the primary key of the data table of the target business is adjusted based on the target time unit. That is, in the present invention, when there are multiple data tables corresponding to the same business, the time precision of the time in the primary key is adjusted based on the maximum business concurrency, so that the time in the primary key of the data table does not conflict, the normal operation of the system is guaranteed, the distinction of data tables is realized, and the normal handling of the business is guaranteed, and the user experience is improved.
[0144] It should be noted that, for the working process of each module and sub-module in this embodiment, please refer to the corresponding description in the above embodiment, which will not be repeated here.
[0145] Optionally, based on the above embodiments of the method and device for determining the primary key of a data table, another embodiment of the present invention provides an electronic device, including: a memory and a processor;
[0146] Wherein, the memory is used to store programs;
[0147] The processor calls the program and is used to execute the above-mentioned method for determining the primary key of the data table.
[0148] In this embodiment, when a primary key determination instruction is received, the target business in the primary key determination instruction is obtained, and based on the historical execution data of the target business, the maximum business concurrency of the target business under different time units is obtained, and the time unit corresponding to the maximum business concurrency that satisfies the maximum business concurrency rule is determined in descending order of time units, and the time unit is used as the target time unit, and the time precision of the time in the primary key of the data table of the target business is adjusted based on the target time unit. That is, in the present invention, when there are multiple data tables corresponding to the same business, the time precision of the time in the primary key is adjusted based on the maximum business concurrency, so that the time in the primary key of the data table does not conflict, the normal operation of the system is guaranteed, the distinction of data tables is realized, and the normal handling of the business is guaranteed, and the user experience is improved.
[0149] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for determining the primary key of a data table. It is characterized in that include: When receiving a primary key determination instruction, obtaining a target business in the primary key determination instruction; Based on the historical execution data of the target business, obtaining the maximum business concurrency of the target business in different time units; According to the order of time units from large to small, determine the time unit whose corresponding maximum business concurrency meets the maximum business concurrency rule, and use it as the target time unit; Performing an adjustment operation on the time precision of the time in the primary key of the data table of the target business based on the target time unit; Among them, according to the order of time units from large to small, the time unit whose corresponding maximum business concurrency meets the maximum business concurrency rule is determined and used as the target time unit, including: Sorting the time units from large to small to obtain a sorting result, and setting the processing flags of all the time units as unprocessed; Determine the time unit with the processing mark of the sorting result as unprocessed and with the largest sorting number, and use it as the time unit to be processed; Determine whether the maximum concurrent business volume corresponding to the pending time unit is not greater than a preset threshold; If yes, the time unit to be processed is used as the target time unit; If not, the processing flag of the pending time unit is set to processed, and the process returns to the step of determining that the processing flag of the sorting result is unprocessed and the time unit with the largest sorting number, until it is determined whether the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold value; If the result is that the maximum business concurrency corresponding to the last pending time unit is not greater than the preset threshold, the last pending time unit is used as the target time unit; If the result is that the maximum business concurrency corresponding to the last pending time unit is greater than the preset threshold, the last pending time unit is used as the time unit limit value; Wherein, receiving the primary key determination instruction includes: Obtain error information during business execution, and determine whether the error information is primary key time conflict information; If yes, it is determined that the primary key determination instruction is received, and the business information in the error message is used as the target business in the primary key determination instruction; The operation of adjusting the time precision of the time in the primary key based on the target time unit includes: The time precision of the primary key corresponding to the target business is set to the target time unit.
2. The determination method according to claim 1, It is characterized in that Based on the historical execution data of the target service, the maximum service concurrency of the target service in different time units is obtained, including: The historical execution data of the target business is obtained, and the maximum business concurrency under different time units at the same time is filtered out from the historical execution data.
3. The determination method according to claim 1, It is characterized in that Receiving a primary key determination instruction also includes: Receiving a service query instruction input by a user on a display interface; the service query instruction includes a target service; The business query instruction is used as a primary key to determine the instruction.
4. The determination method according to claim 3, It is characterized in that The operation of adjusting the time precision of the time in the primary key based on the target time unit includes: The target time unit is displayed on the display interface, and the user adjusts the time precision of the primary key time of the target business according to the target time unit.
5. A device for determining a primary key of a data table, It is characterized in that include: A business acquisition module, configured to acquire a target business in the primary key determination instruction upon receiving the primary key determination instruction; A concurrency acquisition module, used to acquire the maximum business concurrency of the target business in different time units based on the historical execution data of the target business; A time unit determination module, used to determine, in descending order of time units, a time unit whose corresponding maximum business concurrency satisfies the maximum business concurrency rule, and use it as a target time unit; A precision adjustment module, used for adjusting the time precision of the time in the primary key of the data table of the target business based on the target time unit; Wherein, the time unit determination module includes: A first flag setting submodule is used to sort the time units from large to small to obtain a sorting result, and set the processing flags of all the time units to unprocessed; A first unit determination submodule is used to determine the time unit with the processing mark of the sorting result as unprocessed and the largest sorting number, and use it as the time unit to be processed; A concurrency determination submodule is used to determine whether the maximum business concurrency corresponding to the to-be-processed time unit is not greater than a preset threshold; A second unit determination submodule, configured to, if yes, use the to-be-processed time unit as the target time unit; A second flag setting submodule, for setting the processing flag of the time unit to be processed as processed if no; A judgment submodule is used to judge whether the time unit to be processed is the last one; The first unit determination submodule is further configured to, when the time unit to be processed is not the last one, determine the time unit with the processing mark of the sorting result as unprocessed and with the largest sorting number, and use it as the time unit to be processed; The third unit determination submodule is used to use the last time unit to be processed as the time unit limit value when the time unit to be processed is the last one and the maximum business concurrency corresponding to the last time unit to be processed is greater than a preset threshold; The service acquisition module is used to receive the primary key determination instruction, including: obtaining error information during service execution, and determining whether the error information is primary key time conflict information; if so, determining that the primary key determination instruction is received, and using the service information in the error information as the target service in the primary key determination instruction; The precision adjustment module is specifically configured to set the time precision of the primary key corresponding to the target business to the target time unit.
6. An electronic device, It is characterized in that include: Memory and processor; Wherein, the memory is used to store programs; The processor calls the program and is used to execute the method for determining the primary key of a data table as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Load balancing for large in-memory databases
CN107430529A
Global primary key generation method and device
CN111708831A