A method and device for updating full data
By using data unique identifiers in memory for matching, the problem of low efficiency in updating the entire data is solved, and a more efficient data update process is achieved.
Patent Information
- Application Number
- CN202011048638.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-29
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-09-29
AI Technical Summary
When the full data is updated, the existing method is very inefficient when the amount of data to be updated is large.
By obtaining the unique identification of each piece of data in the list of data to be updated and the stored data list in the database, data matching is used in memory, and full data updates are performed in the database based on the matching results.
By matching data in memory, the interaction with the database is reduced, and the efficiency of updating the entire data is significantly improved.
Smart Images

Figure CN113821505B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a full data update method and device. Background Art
[0002] Currently, when it comes to updating the entire amount of data, it is usually necessary to query all records that meet the conditions in the database, and then loop through them, searching the database one by one according to the fields in the database that can uniquely represent the data. If there is no record, delete it. Then loop through the data to be updated, and query one by one according to the fields in the database that can uniquely represent the data to see if there is a record. If there is, update the data. If not, insert the data.
[0003] In the process of implementing the present application, the inventors found that when the amount of data to be updated is large, the efficiency of the above-mentioned full data update is very low. Summary of the invention
[0004] In view of this, the present application provides a full data update method and device, which can improve the efficiency of full data update.
[0005] To solve the above technical problems, the technical solution of this application is implemented as follows:
[0006] In one embodiment, a full data update method is provided, the method comprising:
[0007] Obtain a list of data to be updated, generate a unique identifier for each piece of data in the list of data to be updated, and bind the unique identifier to the corresponding data and store them in a first mapping table;
[0008] Obtain a list of stored data in a database, and obtain a unique identifier for each piece of data in the list of stored data, and bind the unique identifier to the corresponding data and store them in a second mapping table;
[0009] The unique identifiers in the first mapping table and the second mapping table are used to perform data matching in the memory, and all data are updated in the database according to the matching result.
[0010] In another embodiment, a full data update device is provided, the device comprising: a first acquisition unit, a second acquisition unit, a matching unit, and an update unit;
[0011] The first acquisition unit is used to acquire a list of data to be updated, generate a unique identifier for each piece of data in the list of data to be updated, and bind the unique identifier with the corresponding data and store them in a first mapping table;
[0012] The second acquisition unit is used to acquire a list of stored data in the database, and acquire a unique identifier of each piece of data in the list of stored data, and bind the unique identifier with the corresponding data and store them in a second mapping table;
[0013] The matching unit is used to perform data matching in the memory using the unique identifier in the first mapping table obtained by the first obtaining unit and the second mapping table obtained by the second obtaining unit;
[0014] The updating unit is used to update all data in the database according to the matching result of the matching unit.
[0015] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the full data update method when executing the program.
[0016] In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the full data update method are implemented.
[0017] As can be seen from the above technical solution, in the above embodiment, the data in the database and the data to be updated are obtained, and are converted into a unique identifier and data mapping method and bound and stored in the memory, and the unique identifiers in the first mapping table and the second mapping table are used in the memory to match the data, and the full amount of data is updated in the database according to the matching result. This implementation scheme matches data in the memory through the unique identifier, greatly reducing the interaction with the database, and can improve the efficiency of the full amount of data update. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 This is a schematic diagram of the full data update process in Example 1 of the present application;
[0020] Figure 2 This is a schematic diagram of the full data update process in Example 2 of this application;
[0021] Figure 3 This is a schematic diagram of the structure of a device applied to the above technology in an embodiment of the present application;
[0022] Figure 4A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0026] In an embodiment of the present application, a method for updating full data is provided, which obtains a unique identifier for each data in a list of data to be updated and a list of data stored in a database, matches the data in the memory using the unique identifier of each data, and performs a full data update in the database based on the matching result, thereby improving the performance of the full data update.
[0027] The following is a detailed description of the process of implementing full data update in the embodiment of the present application in conjunction with the accompanying drawings.
[0028] Embodiment 1
[0029] See also Figure 1 , Figure 1 This is a schematic diagram of the full data update process in Example 1 of this application. The specific steps are:
[0030] Step 101: obtain a list of data to be updated, generate a unique identifier for each piece of data in the list of data to be updated, and bind the unique identifier with the corresponding data and store them in a first mapping table.
[0031] Obtaining the unique identifier of each piece of data in the data table to be updated, that is, obtaining the unique identifier of each piece of data can be achieved in the following ways, but is not limited to the following implementation methods:
[0032] The first method is to use the value of a field in the data as the unique identifier of the data.
[0033] For example, in an employee information table, the value of the employee's ID number field can be used as the unique identifier of a piece of data corresponding to the employee.
[0034] The second method is to use a combination of values of multiple fields in the data as a unique identifier of the data.
[0035] The combination of values of multiple fields here means obtaining the value of each field separately and combining them in sequence according to a preset order. Usually, the values of the multiple selected fields remain unchanged.
[0036] For example, for actor information, you can combine the values of the actor name and height fields: A1.75 represents the actor information corresponding to actor A who is 1.75 meters tall.
[0037] The third method is to use a hash value obtained by hashing the values of multiple fields in the data as the unique identifier of the data.
[0038] For example, for message data, the hash value obtained by hashing the value corresponding to the five-tuple field of each message is used as the unique identifier of the message.
[0039] The first data list includes a unique identifier and data corresponding to each unique identifier.
[0040] Step 102: Obtain a list of stored data in the database, obtain a unique identifier for each piece of data in the list of stored data, and bind the unique identifier to the corresponding data and store them in a second mapping table.
[0041] The obtaining of the unique identifier of each piece of data in the stored data list includes:
[0042] If the database stores a unique identifier for each piece of data, the unique identifier of each piece of data is obtained from the stored data list; otherwise, the unique identifier of the corresponding data is generated according to the data in the obtained stored data list.
[0043] Whether to store the unique identifier of each piece of data in the database can be determined by the implementer according to actual needs or self-configuration. If stored, when obtaining the list of data stored in the database, the unique identifier of each piece of data in the data list will be obtained at the same time.
[0044] Step 103: perform data matching in the memory using the unique identifiers in the first mapping table and the second mapping table, and perform full data update in the database according to the matching result.
[0045] The entire data is updated by comparing the unique identifiers in the first mapping table and the second mapping table to determine which identifiers correspond to data that need to be deleted, which identifiers correspond to data that need to be inserted, and which identifiers correspond to data that need to be updated.
[0046] And the unique identifier is used in memory for data matching, so there is no need to frequently query the database.
[0047] In the embodiment of the present application, the data in the database and the data to be updated are obtained, and converted into a unique identifier and data mapping method and bound and stored in the memory, and the unique identifiers in the first mapping table and the second mapping table are used in the memory to match the data, and the full amount of data is updated in the database according to the matching result. This implementation scheme matches data in the memory through the unique identifier, greatly reduces the interaction with the database, and can improve the efficiency of the full amount of data update.
[0048] Embodiment 2
[0049] See also Figure 2 , Figure 2 This is a schematic diagram of the full data update process in Example 2 of this application. The specific steps are:
[0050] Step 201: obtain a list of data to be updated, generate a unique identifier for each piece of data in the list of data to be updated, and bind the unique identifier with the corresponding data and store them in a first mapping table.
[0051] Obtaining the unique identifier of each piece of data in the data table to be updated, that is, obtaining the unique identifier of each piece of data can be achieved in the following ways, but is not limited to the following implementation methods:
[0052] The first method is to use the value of a field in the data as the unique identifier of the data.
[0053] For example, in an employee information table, the value of the employee's ID number field can be used as the unique identifier of a piece of data corresponding to the employee.
[0054] The second method is to use a combination of values of multiple fields in the data as a unique identifier of the data.
[0055] The combination of values of multiple fields here means obtaining the value of each field separately and combining them in sequence according to a preset order. Usually, the values of the multiple selected fields remain unchanged.
[0056] For example, for actor information, you can combine the values of the actor name and height fields: A1.75 represents the actor information corresponding to actor A who is 1.75 meters tall.
[0057] The third method is to use a hash value obtained by hashing the values of multiple fields in the data as the unique identifier of the data.
[0058] For example, for message data, the hash value obtained by hashing the value corresponding to the five-tuple field of each message is used as the unique identifier of the message.
[0059] The first data list includes a unique identifier and data corresponding to each unique identifier.
[0060] Step 202: Obtain a list of stored data in the database, obtain a unique identifier for each piece of data in the list of stored data, and bind the unique identifier to the corresponding data and store them in a second mapping table.
[0061] The obtaining of the unique identifier of each piece of data in the stored data list includes:
[0062] If the database stores a unique identifier for each piece of data, the unique identifier of each piece of data is obtained from the stored data list; otherwise, the unique identifier of the corresponding data is generated according to the data in the obtained stored data list.
[0063] Whether to store the unique identifier of each piece of data in the database can be determined by the implementer according to actual needs or self-configuration. If stored, when obtaining the list of data stored in the database, the unique identifier of each piece of data in the data list will be obtained at the same time.
[0064] Step 203, traverse the first mapping table, replace the data corresponding to the unique identifier in the second mapping table with the corresponding data in the first mapping table to form a first data list; and store the existing unique identifier in a third mapping table in combination with a default value; and store the data corresponding to the unique identifier that does not exist in the second mapping table in the second data table.
[0065] In this step, the data corresponding to the unique identifier in the second mapping table is replaced with the corresponding data in the first mapping table to form a first data list. Specifically, all the field contents provided in the first mapping table for this data are replaced. If there are more fields in the second mapping table than the fields corresponding to the data in the first mapping table, they will continue to be retained. For example, the data with the unique identifier of 5 in the second mapping table includes: the first field, the second field, and the third field, and in the first mapping table, only the content modified for the second field is provided. In this case, the second field of the corresponding data in the second mapping table is replaced with the content of the corresponding second field in the first mapping table. If the contents of all fields in the first mapping table are provided, the corresponding data in the first mapping table can also be directly stored in the first data table.
[0066] The existing unique identifier is bound with the default value and stored in the third mapping table. In specific implementation, a configured value, such as 1, is used as the default value, which is only for realizing the mapping table of key and value mapping.
[0067] Step 204: traverse the second mapping table, and store the serial numbers of the data corresponding to the unique identifier that does not exist in the third mapping table into the third data table.
[0068] The third data table is used to delete data. It only stores the serial number and can query the corresponding data in the database for deletion.
[0069] Step 205: Update the data in the first data list into the database according to the sequence number.
[0070] When updating data, just use the serial number to search the corresponding data in the database.
[0071] When the data in the first data list is updated to the database, the data is updated in a parallel update manner; as for how many pieces of data are executed in parallel each time, it is determined according to the number of threads that can be provided by the device at the same time.
[0072] Step 206: insert the data in the second data table into the database.
[0073] When inserting the data in the second data table into the database, the data is inserted in batches, that is, the data in the second data table is packaged and sent to the database for batch insertion.
[0074] Step 207: Delete the data corresponding to the serial number in the third data table in the database.
[0075] When deleting data in the database, the serial number in the third data table is used to search for corresponding data in the database.
[0076] When deleting the data corresponding to the unique identifier in the third data list in the database, the data is deleted by parallel deletion. As for how many pieces of data are deleted in parallel each time, it is determined according to the number of threads that the device can provide simultaneously.
[0077] If the implementation method is to store the unique identifier of each piece of data in the database, when the full data is updated according to the matching result, the method further includes:
[0078] A unique identifier is stored for the data binding in the database.
[0079] If you perform a full data update again, you can directly obtain the data in the database and the unique identifier corresponding to the data.
[0080] In the embodiment of the present application, the data in the database and the data to be updated are obtained, and are converted into unique identifiers and data mappings and bound and stored in the memory. The unique identifiers in the first mapping list and the second mapping are used in the memory to match the data, and the third data list is obtained for updating the corresponding data in the database, the fourth data list is obtained for inserting the corresponding data in the database, and the fifth data list is obtained for deleting the corresponding data in the database to achieve full data update. This solution obtains a batch of data into the memory by querying the database once, and matches the data by the unique identifier corresponding to the data, which greatly reduces the complexity of finding data, reduces the time of finding and matching, and the interaction with the database, thereby improving the efficiency of full data update while reducing overhead.
[0081] The mapping table in the embodiment of the present application is a Map mapping table, which is a key-value structure, and the key is a unique identifier in the embodiment; the value can be directly found according to the key, and its time complexity is 1. The traditional data list is a superposition of values. To find the data corresponding to the key, its average time complexity is (n-1) / 2, and the worst is n.
[0082] Therefore, when traversing the data to be updated and the existing data, converting them into the first and second "unique key-data" mapping tables, and storing the unique key of the data to be updated in a "unique key-1" mapping table can greatly improve the update efficiency of the entire data.
[0083] Take the case where there are 5,000 records to be updated (1,000 inserted and 4,000 modified) and there are 5,000 records in the database for testing: the traditional solution takes 5 minutes, while this solution only takes 1 minute.
[0084] Based on the same inventive concept, the present application also provides a full data update device. Figure 3 , Figure 3 This is a schematic diagram of the structure of a device applied to the above technology in an embodiment of the present application. The device includes: a first acquisition unit 301, a second acquisition unit 302, a matching unit 303 and an updating unit 304;
[0085] The first acquisition unit 301 is used to acquire a list of data to be updated, generate a unique identifier for each piece of data in the list of data to be updated, and bind the unique identifier with the corresponding data and store them in a first mapping table;
[0086] The second acquisition unit 302 is used to acquire a list of stored data in the database, and acquire a unique identifier of each piece of data in the list of stored data, and bind the unique identifier with the corresponding data and store them in a second mapping table;
[0087] A matching unit 303, configured to perform data matching in a memory using a unique identifier in the first mapping table obtained by the first obtaining unit 301 and in the second mapping table obtained by the second obtaining unit 302;
[0088] The updating unit 304 is used to update all data in the database according to the matching result of the matching unit.
[0089] Preferably,
[0090] The matching unit 303 is specifically used to traverse the first mapping table, replace the data corresponding to the unique identifier in the second mapping table with the corresponding data in the first mapping table to form a first data list; and store the existing unique identifier in a third mapping table in a binding manner with a default value; store the data corresponding to the unique identifier that does not exist in the third mapping table in the second data table; traverse the second mapping table, and store the serial number of the data corresponding to the unique identifier that does not exist in the first mapping table in the third data table;
[0091] The updating unit 304 is specifically used to update the data in the first data list into the database according to the serial number; insert the data in the second data table into the database; and delete the data corresponding to the serial number in the third data table in the database.
[0092] Preferably,
[0093] The updating unit 304 is specifically used to update the data in the first data list to the database according to the serial number by means of parallel updating; and / or, when inserting the data in the second data table into the database, inserting the data by means of batch storage; and / or, when deleting the data corresponding to the serial number in the third mapping table in the database, deleting the data by means of parallel deletion.
[0094] Preferably,
[0095] The updating unit 304 is further configured to store a unique identifier for data binding in the database when performing a full data update according to the matching result.
[0096] Preferably,
[0097] The second acquisition unit 302 is specifically used to acquire the unique identifier of each data in the stored data list, including: if the database stores a unique identifier for each data, then acquiring the unique identifier of each data from the stored data list; otherwise, generating a unique identifier for the corresponding data based on the acquired data in the stored data list.
[0098] Preferably,
[0099] The first acquisition unit 301 is specifically used to obtain the unique identifier of a piece of data, including: using the value of a field in the data as the unique identifier of the data; or, using the combination of values of multiple fields in the data as the unique identifier of the data; or, using the hash value obtained by hashing the values of multiple fields in the data as the unique identifier of the data.
[0100] The units in the above-mentioned embodiments may be integrated into one body or deployed separately; they may be combined into one unit or further divided into multiple sub-units.
[0101] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the full data update method when executing the program.
[0102] In another embodiment, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps in the full data update method can be implemented.
[0103] Figure 4 The following is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. Figure 4 As shown, the electronic device may include: a processor (Processor) 410, a communication interface (Communications Interface) 420, a memory (Memory) 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the following method:
[0104] Obtain a list of data to be updated, generate a unique identifier for each piece of data in the list of data to be updated, and bind the unique identifier to the corresponding data and store them in a first mapping table;
[0105] Obtain a list of stored data in a database, and obtain a unique identifier for each piece of data in the list of stored data, and bind the unique identifier to the corresponding data and store them in a second mapping table;
[0106] The unique identifiers in the first mapping table and the second mapping table are used to perform data matching in the memory, and all data are updated in the database according to the matching result.
[0107] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0108] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0109] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0110] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for updating full data, characterized in that: The method comprises: Acquire the batch data included in the data list to be updated, generate a unique identifier for each piece of data in the data list to be updated, bind the unique identifier with the corresponding data and store them in a first mapping table located in the memory; the first mapping table is a key-value structure Map mapping table, wherein the Key is the unique identifier of the first mapping table; Acquire the batch data included in the stored data list in the database, and acquire the unique identifier of each data in the stored data list, and bind the unique identifier with the corresponding data and store them in a second mapping table in the memory; the second mapping table is a key-value structure Map mapping table, wherein the Key is the unique identifier of the second mapping table; Data is matched in the memory using the unique identifiers in the first mapping table and the second mapping table, and all data is updated in the database according to the matching result, wherein the matching result includes: Determine the unique identifiers that need to be deleted, the unique identifiers that need to be inserted, and the unique identifiers that need to be updated; The performing data matching in the memory using the unique identifiers in the first mapping table and the second mapping table, and performing full data updating in the database according to the matching result, includes: Traversing the first mapping table, replacing the data corresponding to the unique identifier in the second mapping table with the corresponding data in the first mapping table to form a first data list; and binding the existing unique identifier with a default value and storing it in a third mapping table; storing the data corresponding to the unique identifier that does not exist in the second mapping table in the second data table; wherein, replacing the data corresponding to the unique identifier in the second mapping table with the corresponding data in the first mapping table to form the first data list specifically includes: replacing all the field contents provided in the first mapping table for the data corresponding to the unique identifier in the second mapping table, and if there are more fields in the second mapping table than the fields corresponding to the data in the first mapping table, then continuing to retain the other fields; Traversing the second mapping table, and storing the serial numbers of the data corresponding to the unique identifier that does not exist in the third mapping table in the third data table; Updating the data in the first data list into the database according to the sequence number; Inserting the data in the second data table into the database; Delete the data corresponding to the serial number in the third data table in the database.
2. The method according to claim 1, characterized in that When the data in the first data list is updated into the database according to the sequence number, the data is updated by parallel updating; and / or, When inserting the data in the second data table into the database, the data is inserted in batches; and / or, When deleting the data corresponding to the serial number in the third mapping table in the database, the data is deleted by parallel deletion.
3. The method according to claim 1, characterized in that When the full data is updated according to the matching result, the method further includes: A unique identifier is stored for the data binding in the database.
4. The method according to claim 1, characterized in that: The obtaining of the unique identifier of each piece of data in the stored data list includes: If the database stores a unique identifier for each piece of data, the unique identifier of each piece of data is obtained from the stored data list; otherwise, the unique identifier of the corresponding data is generated according to the data in the obtained stored data list.
5. The method according to any one of claims 1 to 4, characterized in that: Get the unique identifier of a piece of data, including: Using the value of a field in the data as a unique identifier of the data; or, Using a combination of values of multiple fields in the data as a unique identifier of the data; or, A hash value obtained by hashing the values of multiple fields in the data is used as the unique identifier of the data.
6. A full data update device, characterized in that: The device comprises: a first acquisition unit, a second acquisition unit, a matching unit and an updating unit; The first acquisition unit is used to acquire the batch data included in the data list to be updated, generate a unique identifier for each data in the data list to be updated, and bind the unique identifier with the corresponding data and store them in a first mapping table located in the memory; the first mapping table is a key-value structure Map mapping table, wherein the Key is the unique identifier of the first mapping table; The second acquisition unit is used to acquire the batch data included in the stored data list in the database, and acquire the unique identifier of each data in the stored data list, and bind the unique identifier with the corresponding data and store them in a second mapping table located in the memory; the second mapping table is a key-value structure Map mapping table, wherein the Key is the unique identifier of the second mapping table; The matching unit is used to perform data matching in the memory using the unique identifier in the first mapping table obtained by the first obtaining unit and the second mapping table obtained by the second obtaining unit; The updating unit is used to update all data in the database according to the matching result of the matching unit; the matching result includes: determining a unique identifier that needs to be deleted, a unique identifier that needs to be inserted, and a unique identifier that needs to be updated; The matching unit is specifically used to traverse the first mapping table, replace the data corresponding to the unique identifier existing in the second mapping table with the corresponding data in the first mapping table to form a first data list; and store the existing unique identifier in a third mapping table in a binding with a default value; store the data corresponding to the unique identifier not existing in the third mapping table in the second data table; traverse the second mapping table, and store the serial number of the data corresponding to the unique identifier not existing in the first mapping table in the third data table; wherein, replacing the data corresponding to the unique identifier existing in the second mapping table with the corresponding data in the first mapping table to form the first data list specifically includes: replacing all the field contents provided in the first mapping table for the data corresponding to the unique identifier in the second mapping table, and if there are more fields in the second mapping table than the fields corresponding to the data in the first mapping table, then continue to retain the other fields; The updating unit is specifically used to update the data in the first data list into the database according to the serial number; insert the data in the second data table into the database; and delete the data corresponding to the serial number in the third data table in the database.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Apparatus and method for judging data state and apparatus and method for updating data
CN109446205A