CN112948389A - MD 5-based database table data comparison method and equipment - Google Patents
MD 5-based database table data comparison method and equipment Download PDFInfo
- Publication number
- CN112948389A CN112948389A CN202110246545.0A CN202110246545A CN112948389A CN 112948389 A CN112948389 A CN 112948389A CN 202110246545 A CN202110246545 A CN 202110246545A CN 112948389 A CN112948389 A CN 112948389A
- Authority
- CN
- China
- Prior art keywords
- value
- time point
- database table
- new
- unique index
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention aims to provide a database table data comparison method and equipment based on MD5, which generate an MD5 encryption result by comparing each piece of data in a database table with a primary key (or unique index), and realize the comparison function of the data in the database table by comparing MD5 results. When a user wants to compare a record in a current database table with a record at any previous historical time point, the comparison between the current database table and the record in the database table at any previous time point can be realized by selecting a comparison MD5 value copy corresponding to the historical time point and a record MD5 value in the database table at the current time point. The database table data comparison function based on MD5 of the invention can quickly compare database table data, and simultaneously can list functions of adding, deleting, changing and recording data in the table, thus solving the problems of complexity and inaccuracy of database table comparison.
Description
Technical Field
The invention relates to the field of computers, in particular to a database table data comparison method and device based on MD 5.
Background
At present, with the widespread use of database technology, database data is also increasingly used. In the process of using the database data, data in the table can be continuously added, deleted and updated, a user often needs to know which data in the current database table and the previous time point data have the operation of adding, deleting and modifying, the traditional comparison mode often needs to manually participate, meanwhile, the data information of two tables of the database of a comparison version needs to be compared, and the whole data comparison process is complex and is easy to generate comparison errors.
Disclosure of Invention
The invention aims to provide a database table data comparison method and equipment based on MD 5.
According to one aspect of the invention, a database table data alignment method based on MD5 is provided, which comprises the following steps:
generating MD5 replica data of a database table at historical points in time, wherein the MD5 replica data comprises: the MD5 value corresponding to each whole row record in the database table and the MD5 value of the unique index corresponding to each whole row record;
querying each whole-row record in the database table at the current time point, and respectively generating a corresponding new MD5 value and a new MD5 value of the unique index corresponding to each whole-row record according to each whole-row record in the current database table;
acquiring a new MD5 value corresponding to a certain whole row record and a new MD5 value of the unique index corresponding to the whole row record in the database table at the current time point, searching whether an MD5 value which is the same as the new MD5 value of the unique index acquired in the database table at the current time point exists in the MD5 duplicate data at the historical time point,
if the MD5 value identical to the new MD5 value of the unique index acquired in the database table at the current time point is found in the MD5 replica data of the database table at the historical time point, and the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 replica data of the database table at the historical time point is equal to the new MD5 value corresponding to the whole row of records acquired in the database table at the current time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is unchanged, taking the current time point as the next historical time point, storing the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index into 5 replica data of the database table at the next historical time point, and deleting the new MD5 value corresponding to the obtained whole row of records in the data of the previous historical time point and the MD5 value of the unique index acquired in the MD5 replica data of the previous historical time point after the MD 4656 replica data of the obtained whole row of the same value as the obtained unique index and the MD5 value of the current MD5 value of the current New MD5 value same MD5 value.
Further, in the above method, after acquiring a new MD5 value corresponding to a whole row of record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of record, and searching whether there is an MD5 value that is the same as the new MD5 value of the unique index acquired in the database table at the current time point in the MD5 copy data at the historical time, the method further includes:
if the MD5 value of the unique index which is the same as the new MD5 value of the currently acquired unique index is found in the MD5 duplicate data of the database table at the historical time point, but the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 duplicate data of the database table at the historical time point is not equal to the new MD5 value corresponding to the whole row of records acquired in the database table at the current time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is updated, storing the new MD5 value corresponding to the whole row of records acquired and the new MD5 value of the unique index acquired into a change table, taking the current time point as the next historical time point, and storing the new MD5 value corresponding to the whole row of records acquired and the new MD5 value of the unique index acquired into the MD5 duplicate data of the database table at the next historical time point, and deleting the MD5 duplicate data of the database table at the previous historical time point, wherein the MD5 duplicate data of the MD5 duplicate data correspond to the whole acquired row of records and the MD5 duplicate data of the MD5 duplicate data of the currently acquired unique index are identical to the MD5 duplicate data of the whole acquired row of records.
Further, in the above method, after acquiring a new MD5 value corresponding to a whole row of record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of record, and searching whether there is an MD5 value that is the same as the new MD5 value of the unique index acquired in the database table at the current time point in the MD5 replica data at the historical time point, the method further includes:
if the MD5 value of the unique index which is the same as the new MD5 value of the currently acquired unique index is not found in the MD5 duplicate data of the database table at the historical time point, the MD5 value of the whole row of records acquired in the database table at the current time point is represented as new data, the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index are stored in a change table, the current time point is used as the next historical time point, and the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index are stored in the MD5 duplicate data of the database table at the next historical time point.
Further, in the above method, after acquiring a new MD5 value corresponding to a whole row of record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of record, and searching whether there is an MD5 value that is the same as the new MD5 value of the unique index acquired in the database table at the current time point in the MD5 replica data at the historical time point, the method further includes:
if the new MD5 value of the unique index acquired by each database table at the current time point is searched in the MD5 copy data at the historical time point, and at least one MD5 value corresponding to the whole row record and at least one MD5 value of the unique index corresponding to the whole row record also exist in the MD5 copy data at the historical time point, the record in the MD5 copy data of the database table at the historical time point is the MD5 value of the deleted whole row record in the database table, and the MD5 value of the unique index corresponding to the MD5 value of the deleted whole row record is stored in the change table.
According to another aspect of the present invention, there is also provided a database table data alignment apparatus based on MD5, wherein the apparatus includes:
first means for generating MD5 replica data of a database table at historical points in time, wherein the MD5 replica data comprises: the MD5 value corresponding to each whole row record in the database table and the MD5 value of the unique index corresponding to each whole row record;
the second device is used for inquiring each whole-row record in the database table at the current time point and respectively generating a corresponding new MD5 value and a new MD5 value of the unique index corresponding to each whole-row record according to each whole-row record in the current database table;
a third device, configured to obtain a new MD5 value corresponding to a certain whole row record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row record, search for whether there is an MD5 value in the MD5 copy data at the historical time point that is the same as the new MD5 value of the unique index obtained in the database table at the current time point, if an MD5 value that is the same as the new MD5 value of the unique index obtained in the database table at the current time point is found in the MD5 copy data of the database table at the historical time point, and the MD5 value of the whole row record corresponding to the MD5 value of the same unique index in the MD5 copy data of the database table at the historical time point is equal to the new MD5 value corresponding to the whole row record obtained in the database table at the current time point, then the whole row record 5 value obtained in the database table at the current time point is represented as unchanged, and taking the current time point as the next historical time point, saving the new MD5 value corresponding to the obtained whole row of records and the obtained new MD5 value of the unique index into the MD5 duplicate data of the database table at the next historical time point, and deleting the MD5 value which is the same as the new MD5 value corresponding to the obtained whole row of records and the MD5 value which is the same as the new MD5 value of the currently obtained unique index in the MD5 duplicate data of the database table at the previous historical time point.
Further, in the above apparatus, the third means is further configured to, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is found in the MD5 copy data of the database table at the historical time point, but the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 copy data of the database table at the historical time point is not equal to the new MD5 value corresponding to the whole row of records acquired in the database table at the current time point, indicate that the MD5 value of the whole row of records acquired in the database table at the current time point is updated, store the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the change table, take the current time point as the next historical time point, and store the new MD5 value corresponding to the whole row of records and the obtained new MD5 value into the MD5 copy data of the next historical time point, and deleting the MD5 duplicate data of the database table at the previous historical time point, wherein the MD5 duplicate data of the MD5 duplicate data correspond to the whole acquired row of records and the MD5 duplicate data of the MD5 duplicate data of the currently acquired unique index are identical to the MD5 duplicate data of the whole acquired row of records.
Further, in the above apparatus, the third device is further configured to, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is not found in the MD5 duplicate data of the database table at the historical time point, indicate that the MD5 value of the whole row of records acquired in the database table at the current time point is newly added data, store the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the change table, take the current time point as a next historical time point, and store the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index into the MD5 duplicate data of the database table at the next historical time point.
Further, in the above apparatus, the third device is further configured to, if a new MD5 value of the unique index acquired by each of the database tables at the current time point is found in the MD5 copy data at the historical time point, and at least one MD5 value corresponding to the entire row record and at least one MD5 value of the unique index corresponding to the entire row record also exist in the MD5 copy data at the historical time point, record in the MD5 copy data of the database table at the historical time point is an MD5 value of the entire row record deleted in the database table, and store the MD5 value of the unique index corresponding to the MD5 value of the entire row record deleted in the change table.
According to another aspect of the present invention, there is also provided a computer readable medium having computer readable instructions stored thereon, the computer readable instructions being executable by a processor to implement the method of any one of the above.
According to another aspect of the present invention, there is also provided an apparatus for information processing at a network device, the apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform any of the methods described above.
Compared with the prior art, the method generates the MD5 encryption result by comparing each piece of data and the main key (or the unique index) in the database table, and realizes the comparison function of the data in the database table by comparing the MD5 results. When a user wants to compare a record in a current database table with a record at any previous historical time point, the comparison between the current database table and the record in the database table at any previous time point can be realized by selecting a comparison MD5 value copy corresponding to the historical time point and a record MD5 value in the database table at the current time point. The database table data comparison function based on MD5 of the invention can quickly compare database table data, and simultaneously can list functions of adding, deleting, changing and recording data in the table, thus solving the problems of complexity and inaccuracy of database table comparison.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
FIG. 1 illustrates a flow diagram for generating MD5 replica data in accordance with an embodiment of the present invention;
FIG. 2 is a flow chart illustrating data comparison and MD5 duplicate data update according to an embodiment of the present invention.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present invention is described in further detail below with reference to the attached drawing figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
As shown in fig. 1 and 2, the present invention provides a database table data alignment method based on MD5, the method includes:
step S1, generating MD5 copy data of a database table at historical time points, wherein the MD5 copy data includes: the MD5 value corresponding to each whole row record in the database table and the MD5 value of the unique index corresponding to each whole row record;
here, the user generates MD5 duplicate data to be compared with the content of the database table at the current time point, where the MD5 duplicate data mainly includes MD5 value data generated by each whole row record in the table and MD5 value data generated by a main key (or unique index) in the table, that is, generates MD5 values storing the MD5 values of the whole row and the corresponding main key (or unique index) in the data table as MD5 value duplicates;
step S2, inquiring each whole-row record in the database table at the current time point, and respectively generating a corresponding new MD5 value and a new MD5 value of the unique index corresponding to each whole-row record according to each whole-row record in the current database table;
here, when the data in the database table is compared at the current time point after the historical time point to determine whether the data in the database table is changed, the MD5 duplicate data generated by the database table at the historical time point before the current time point is loaded first, and the MD5 duplicate information is stored in the system in a key-value pair manner, where the key is the MD5 value generated by the primary key (or unique index) and the value is the MD5 value generated by the whole row record. Then, each whole-row record in the database table at the current time point is queried, and a corresponding new MD5 value and a new MD5 value of the primary key (or unique index) are respectively generated according to each whole-row record in the current database table.
Step S3, obtaining a new MD5 value corresponding to a certain whole row record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row record, searching whether there is an MD5 value in the MD5 copy data at the historical time point that is the same as the new MD5 value of the unique index obtained in the database table at the current time point,
here, the MD5 value corresponding to the primary key (or unique index) may be looked up from the key value pair of the loaded MD5 replica data;
step S4, if the MD5 value identical to the new MD5 value of the unique index acquired in the database table at the current time point is found in the MD5 copy data of the database table at the historical time point, and the MD5 value of the whole row of record corresponding to the MD5 value of the same unique index in the MD 4834 copy data of the database table at the historical time point is equal to the new MD5 value corresponding to the whole row of record acquired in the database table at the current time point, indicating that there is no change in the MD 8657 value of the whole row of record acquired in the database table at the current time point, then taking the current time point as the next historical time point, storing the new MD5 value corresponding to the acquired whole row of record and the new MD5 value of the acquired unique index into the MD5 copy data of the database table at the next historical time point, and deleting the MD 4642 value and the MD 4642 value of the whole row of record corresponding to the MD 3884 and the MD 737 value of the MD5 in the database table 3 copy data at the previous historical time point, after the MD 4642 and the MD 4642 are acquired to be identical to the current MD 4642 value of the MD5 value of An index has a new MD5 value with the same MD5 value.
In the method, the MD5 encryption result is generated by each piece of data in the database table and the primary key (or the unique index), and the comparison function of the data in the database table is realized by comparing the MD5 results. When a user wants to compare a record in a current database table with a record at any previous historical time point, the comparison between the current database table and the record in the database table at any previous time point can be realized by selecting a comparison MD5 value copy corresponding to the historical time point and a record MD5 value in the database table at the current time point. The database table data comparison function based on MD5 of the invention can quickly compare database table data, and simultaneously can list functions of adding, deleting, changing and recording data in the table, thus solving the problems of complexity and inaccuracy of database table comparison.
In an embodiment of the MD 5-based database table data comparison method, in step S3, after acquiring a new MD5 value corresponding to a whole row of record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of record, and searching whether there is an MD5 value that is the same as the new MD5 value of the unique index acquired in the database table at the current time point in the MD5 copy data at the historical time, the method further includes:
step S5, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is found in the MD5 replica data of the database table at the historical time point, but the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 replica data of the database table at the historical time point is not equal to the new MD5 value of the whole row of records acquired in the database table at the current time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is updated, storing the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the change table, taking the current time point as the next historical time point, and storing the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the MD5 replica data of the database table at the next historical time point, and deleting the MD5 duplicate data of the database table at the previous historical time point, wherein the MD5 duplicate data of the MD5 duplicate data correspond to the whole acquired row of records and the MD5 duplicate data of the MD5 duplicate data of the currently acquired unique index are identical to the MD5 duplicate data of the whole acquired row of records.
In an embodiment of the MD 5-based database table data comparison method, in step S3, after acquiring a new MD5 value corresponding to a whole row of record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of record, and searching whether there is an MD5 value that is the same as the new MD5 value of the unique index acquired in the database table at the current time point in the MD5 copy data at the historical time point, the method further includes:
step S6, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is not found in the MD5 copy data of the database table at the historical time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is newly added data, storing the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index into the change table, taking the current time point as the next historical time point, and storing the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index into the MD5 copy data of the database table at the next historical time point.
In an embodiment of the MD 5-based database table data comparison method, in step S3, after acquiring a new MD5 value corresponding to a whole row of record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of record, and searching whether there is an MD5 value that is the same as the new MD5 value of the unique index acquired in the database table at the current time point in the MD5 copy data at the historical time point, the method further includes:
step S7, if the new MD5 value of the unique index acquired by each database table at the current time point is found in the MD5 copy data at the historical time point, and at least one MD5 value corresponding to the entire row record and at least one MD5 value of the unique index corresponding to the entire row record also exist in the MD5 copy data at the historical time point, the MD5 value recorded as the deleted entire row record in the database table in the MD5 copy data of the database table at the historical time point is stored in the change table, and the MD5 value of the unique index corresponding to the MD5 value of the deleted entire row record is stored in the change table.
Here, after the comparison of all the entire row records is completed, if the MD5 duplicate data of the database table at the historical time point is not null, the record in the MD5 duplicate data of the database table at the historical time point is the MD5 value of the entire row record deleted in the database table, and the primary key (or unique index) is updated to the change table.
According to another aspect of the present invention, there is also provided a database table data alignment apparatus based on MD5, wherein the apparatus includes:
first means for generating MD5 replica data of a database table at historical points in time, wherein the MD5 replica data comprises: the MD5 value corresponding to each whole row record in the database table and the MD5 value of the unique index corresponding to each whole row record;
the second device is used for inquiring each whole-row record in the database table at the current time point and respectively generating a corresponding new MD5 value and a new MD5 value of the unique index corresponding to each whole-row record according to each whole-row record in the current database table;
a third device, configured to obtain a new MD5 value corresponding to a certain whole row record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row record, search for whether there is an MD5 value in the MD5 copy data at the historical time point that is the same as the new MD5 value of the unique index obtained in the database table at the current time point, if an MD5 value that is the same as the new MD5 value of the unique index obtained in the database table at the current time point is found in the MD5 copy data of the database table at the historical time point, and the MD5 value of the whole row record corresponding to the MD5 value of the same unique index in the MD5 copy data of the database table at the historical time point is equal to the new MD5 value corresponding to the whole row record obtained in the database table at the current time point, then the whole row record 5 value obtained in the database table at the current time point is represented as unchanged, and taking the current time point as the next historical time point, saving the new MD5 value corresponding to the obtained whole row of records and the obtained new MD5 value of the unique index into the MD5 duplicate data of the database table at the next historical time point, and deleting the MD5 value which is the same as the new MD5 value corresponding to the obtained whole row of records and the MD5 value which is the same as the new MD5 value of the currently obtained unique index in the MD5 duplicate data of the database table at the previous historical time point.
Further, in the above apparatus, the third means is further configured to, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is found in the MD5 copy data of the database table at the historical time point, but the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 copy data of the database table at the historical time point is not equal to the new MD5 value corresponding to the whole row of records acquired in the database table at the current time point, indicate that the MD5 value of the whole row of records acquired in the database table at the current time point is updated, store the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the change table, take the current time point as the next historical time point, and store the new MD5 value corresponding to the whole row of records and the obtained new MD5 value into the MD5 copy data of the next historical time point, and deleting the MD5 duplicate data of the database table at the previous historical time point, wherein the MD5 duplicate data of the MD5 duplicate data correspond to the whole acquired row of records and the MD5 duplicate data of the MD5 duplicate data of the currently acquired unique index are identical to the MD5 duplicate data of the whole acquired row of records.
Further, in the above apparatus, the third device is further configured to, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is not found in the MD5 duplicate data of the database table at the historical time point, indicate that the MD5 value of the whole row of records acquired in the database table at the current time point is newly added data, store the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the change table, take the current time point as a next historical time point, and store the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index into the MD5 duplicate data of the database table at the next historical time point.
Further, in the above apparatus, the third device is further configured to, if a new MD5 value of the unique index acquired by each of the database tables at the current time point is found in the MD5 copy data at the historical time point, and at least one MD5 value corresponding to the entire row record and at least one MD5 value of the unique index corresponding to the entire row record also exist in the MD5 copy data at the historical time point, record in the MD5 copy data of the database table at the historical time point is an MD5 value of the entire row record deleted in the database table, and store the MD5 value of the unique index corresponding to the MD5 value of the entire row record deleted in the change table.
According to another aspect of the present invention, there is also provided a computer readable medium having computer readable instructions stored thereon, the computer readable instructions being executable by a processor to implement the method of any one of the above.
According to another aspect of the present invention, there is also provided an apparatus for information processing at a network device, the apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform any of the methods described above.
For details of embodiments of each device and storage medium of the present invention, reference may be made to corresponding parts of each method embodiment, and details are not described herein again.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
It should be noted that the present invention may be implemented in software and/or in a combination of software and hardware, for example, as an Application Specific Integrated Circuit (ASIC), a general purpose computer or any other similar hardware device. In one embodiment, the software program of the present invention may be executed by a processor to implement the steps or functions described above. Also, the software programs (including associated data structures) of the present invention can be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Further, some of the steps or functions of the present invention may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present invention can be applied as a computer program product, such as computer program instructions, which when executed by a computer, can invoke or provide the method and/or technical solution according to the present invention through the operation of the computer. Program instructions which invoke the methods of the present invention may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the invention herein comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or solution according to embodiments of the invention as described above.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Claims (10)
1. A database table data alignment method based on MD5, wherein the method comprises:
generating MD5 replica data of a database table at historical points in time, wherein the MD5 replica data comprises: the MD5 value corresponding to each whole row record in the database table and the MD5 value of the unique index corresponding to each whole row record;
querying each whole-row record in the database table at the current time point, and respectively generating a corresponding new MD5 value and a new MD5 value of the unique index corresponding to each whole-row record according to each whole-row record in the current database table;
acquiring a new MD5 value corresponding to a certain whole row record and a new MD5 value of the unique index corresponding to the whole row record in the database table at the current time point, searching whether an MD5 value which is the same as the new MD5 value of the unique index acquired in the database table at the current time point exists in the MD5 duplicate data at the historical time point,
if the MD5 value identical to the new MD5 value of the unique index acquired in the database table at the current time point is found in the MD5 replica data of the database table at the historical time point, and the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 replica data of the database table at the historical time point is equal to the new MD5 value corresponding to the whole row of records acquired in the database table at the current time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is unchanged, taking the current time point as the next historical time point, storing the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index into 5 replica data of the database table at the next historical time point, and deleting the new MD5 value corresponding to the obtained whole row of records in the data of the previous historical time point and the MD5 value of the unique index acquired in the MD5 replica data of the previous historical time point after the MD 4656 replica data of the obtained whole row of the same value as the obtained unique index and the MD5 value of the current MD5 value of the current New MD5 value same MD5 value.
2. The method of claim 1, wherein after acquiring a new MD5 value corresponding to an entire row of records in the database table at the current time point and a new MD5 value of the unique index corresponding to the entire row of records, and searching whether an MD5 value identical to a new MD5 value of the unique index acquired in the database table at the current time point exists in the MD5 copy data at the historical time, the method further comprises:
if the MD5 value of the unique index which is the same as the new MD5 value of the currently acquired unique index is found in the MD5 duplicate data of the database table at the historical time point, but the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 duplicate data of the database table at the historical time point is not equal to the new MD5 value corresponding to the whole row of records acquired in the database table at the current time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is updated, storing the new MD5 value corresponding to the whole row of records acquired and the new MD5 value of the unique index acquired into a change table, taking the current time point as the next historical time point, and storing the new MD5 value corresponding to the whole row of records acquired and the new MD5 value of the unique index acquired into the MD5 duplicate data of the database table at the next historical time point, and deleting the MD5 duplicate data of the database table at the previous historical time point, wherein the MD5 duplicate data of the MD5 duplicate data correspond to the whole acquired row of records and the MD5 duplicate data of the MD5 duplicate data of the currently acquired unique index are identical to the MD5 duplicate data of the whole acquired row of records.
3. The method of claim 1, wherein after acquiring a new MD5 value corresponding to a whole row of records in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of records, and searching whether an MD5 value identical to the new MD5 value of the unique index acquired in the database table at the current time point exists in the MD5 replica data at the historical time point, the method further comprises: if the MD5 value of the unique index which is the same as the new MD5 value of the currently acquired unique index is not found in the MD5 duplicate data of the database table at the historical time point, the MD5 value of the whole row of records acquired in the database table at the current time point is represented as new data, the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index are stored in a change table, the current time point is used as the next historical time point, and the new MD5 value corresponding to the acquired whole row of records and the new MD5 value of the acquired unique index are stored in the MD5 duplicate data of the database table at the next historical time point.
4. The method of claim 1, wherein after acquiring a new MD5 value corresponding to a whole row of records in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row of records, and searching whether an MD5 value identical to the new MD5 value of the unique index acquired in the database table at the current time point exists in the MD5 replica data at the historical time point, the method further comprises: if the new MD5 value of the unique index acquired by each database table at the current time point is searched in the MD5 copy data at the historical time point, and at least one MD5 value corresponding to the whole row record and at least one MD5 value of the unique index corresponding to the whole row record also exist in the MD5 copy data at the historical time point, the record in the MD5 copy data of the database table at the historical time point is the MD5 value of the deleted whole row record in the database table, and the MD5 value of the unique index corresponding to the MD5 value of the deleted whole row record is stored in the change table.
5. An MD 5-based database table data alignment device, wherein the device comprises:
first means for generating MD5 replica data of a database table at historical points in time, wherein the MD5 replica data comprises: the MD5 value corresponding to each whole row record in the database table and the MD5 value of the unique index corresponding to each whole row record;
the second device is used for inquiring each whole-row record in the database table at the current time point and respectively generating a corresponding new MD5 value and a new MD5 value of the unique index corresponding to each whole-row record according to each whole-row record in the current database table;
a third device, configured to obtain a new MD5 value corresponding to a certain whole row record in the database table at the current time point and a new MD5 value of the unique index corresponding to the whole row record, search for whether there is an MD5 value in the MD5 copy data at the historical time point that is the same as the new MD5 value of the unique index obtained in the database table at the current time point, if an MD5 value that is the same as the new MD5 value of the unique index obtained in the database table at the current time point is found in the MD5 copy data of the database table at the historical time point, and the MD5 value of the whole row record corresponding to the MD5 value of the same unique index in the MD5 copy data of the database table at the historical time point is equal to the new MD5 value corresponding to the whole row record obtained in the database table at the current time point, then the whole row record 5 value obtained in the database table at the current time point is represented as unchanged, and taking the current time point as the next historical time point, saving the new MD5 value corresponding to the obtained whole row of records and the obtained new MD5 value of the unique index into the MD5 duplicate data of the database table at the next historical time point, and deleting the MD5 value which is the same as the new MD5 value corresponding to the obtained whole row of records and the MD5 value which is the same as the new MD5 value of the currently obtained unique index in the MD5 duplicate data of the database table at the previous historical time point.
6. The apparatus according to claim 5, wherein the third means is further configured to, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is found in the MD5 copy data of the database table at the historical time point, but the MD5 value of the whole row of records corresponding to the MD5 value of the same unique index in the MD5 copy data of the database table at the historical time point is not equal to the new MD5 value of the whole row of records acquired in the database table at the current time point, indicating that the MD5 value of the whole row of records acquired in the database table at the current time point is updated, store the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index into the change table, regard the current time point as the next historical time point, and store the new MD5 value corresponding to the obtained whole row of records and the new MD5 value of the acquired unique index to the next time point in the MD5 sub-time table at the historical time point After the data is stored, the MD5 duplicate data of the database table at the previous historical time point is deleted, wherein the MD5 value of the new data is the same as the MD5 value corresponding to the acquired whole row of records, and the MD5 value of the new data is the same as the MD5 value of the currently acquired unique index.
7. The apparatus according to claim 5, wherein the third means is further configured to, if the MD5 value of the unique index that is the same as the new MD5 value of the currently acquired unique index is not found in the MD5 copy data of the database table at the historical time point, indicate that the MD5 value of the entire row of acquired records in the database table at the current time point is newly added data, store the new MD5 value corresponding to the acquired entire row of records and the new MD5 value of the acquired unique index into the change table, take the current time point as the next historical time point, and save the new MD5 value corresponding to the acquired entire row of records and the new MD5 value of the acquired unique index into the MD5 copy data of the database table at the next historical time point.
8. The apparatus of claim 5, wherein the third means is further configured to, if a new MD5 value of the unique index obtained by each of the database tables at the current time point is found in the MD5 copy data at the historical time point, and there are at least one MD5 value corresponding to the entire row record and at least one MD5 value of the unique index corresponding to the entire row record in the MD5 copy data at the historical time point, record in the MD5 copy data of the database tables at the historical time point is the MD5 value of the deleted entire row record in the database table, and store the MD5 value of the unique index corresponding to the 5 value of the deleted entire row record in the change table.
9. A computer readable medium having computer readable instructions stored thereon which are executable by a processor to implement the method of any one of claims 1 to 4.
10. An apparatus for information processing at a network device, the apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform the method of any of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110246545.0A CN112948389B (en) | 2021-03-05 | 2021-03-05 | MD 5-based database table data comparison method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110246545.0A CN112948389B (en) | 2021-03-05 | 2021-03-05 | MD 5-based database table data comparison method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112948389A true CN112948389A (en) | 2021-06-11 |
CN112948389B CN112948389B (en) | 2023-07-25 |
Family
ID=76247937
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110246545.0A Active CN112948389B (en) | 2021-03-05 | 2021-03-05 | MD 5-based database table data comparison method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112948389B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113449505A (en) * | 2021-07-01 | 2021-09-28 | 浪潮天元通信信息系统有限公司 | File comparison method |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20110102555A (en) * | 2010-03-11 | 2011-09-19 | 이너비트 주식회사 | Synchronization method for specific data of dbms mounted in embedded terminal device |
US20140122430A1 (en) * | 2012-11-01 | 2014-05-01 | Red Hat Israel, Ltd. | Retrieving historical tags hierarchy plus related objects |
US20180137186A1 (en) * | 2016-11-11 | 2018-05-17 | International Business Machines Corporation | Copying data changes to a target database |
WO2019071858A1 (en) * | 2017-10-09 | 2019-04-18 | 武汉斗鱼网络科技有限公司 | File update method, apparatus, and device |
CN109977082A (en) * | 2019-03-12 | 2019-07-05 | 福建省农村信用社联合社 | A kind of method and computer readable storage medium of high-volume data automatic comparison |
CN111078672A (en) * | 2019-12-20 | 2020-04-28 | 中国建设银行股份有限公司 | Data comparison method and device for database |
CN111143368A (en) * | 2019-12-27 | 2020-05-12 | 瀚高基础软件股份有限公司 | Relational database data comparison method and system |
CN111382334A (en) * | 2020-03-11 | 2020-07-07 | 腾讯科技(深圳)有限公司 | Data processing method and device, computer and readable storage medium |
CN111651453A (en) * | 2020-04-30 | 2020-09-11 | 中国平安财产保险股份有限公司 | User historical behavior query method and device, electronic equipment and storage medium |
CN112256715A (en) * | 2020-11-12 | 2021-01-22 | 微医云(杭州)控股有限公司 | Index updating method and device, electronic equipment and storage medium |
CN112416907A (en) * | 2020-12-03 | 2021-02-26 | 厦门市美亚柏科信息股份有限公司 | Database table data importing and exporting method, terminal equipment and storage medium |
-
2021
- 2021-03-05 CN CN202110246545.0A patent/CN112948389B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20110102555A (en) * | 2010-03-11 | 2011-09-19 | 이너비트 주식회사 | Synchronization method for specific data of dbms mounted in embedded terminal device |
US20140122430A1 (en) * | 2012-11-01 | 2014-05-01 | Red Hat Israel, Ltd. | Retrieving historical tags hierarchy plus related objects |
US20180137186A1 (en) * | 2016-11-11 | 2018-05-17 | International Business Machines Corporation | Copying data changes to a target database |
WO2019071858A1 (en) * | 2017-10-09 | 2019-04-18 | 武汉斗鱼网络科技有限公司 | File update method, apparatus, and device |
CN109977082A (en) * | 2019-03-12 | 2019-07-05 | 福建省农村信用社联合社 | A kind of method and computer readable storage medium of high-volume data automatic comparison |
CN111078672A (en) * | 2019-12-20 | 2020-04-28 | 中国建设银行股份有限公司 | Data comparison method and device for database |
CN111143368A (en) * | 2019-12-27 | 2020-05-12 | 瀚高基础软件股份有限公司 | Relational database data comparison method and system |
CN111382334A (en) * | 2020-03-11 | 2020-07-07 | 腾讯科技(深圳)有限公司 | Data processing method and device, computer and readable storage medium |
CN111651453A (en) * | 2020-04-30 | 2020-09-11 | 中国平安财产保险股份有限公司 | User historical behavior query method and device, electronic equipment and storage medium |
CN112256715A (en) * | 2020-11-12 | 2021-01-22 | 微医云(杭州)控股有限公司 | Index updating method and device, electronic equipment and storage medium |
CN112416907A (en) * | 2020-12-03 | 2021-02-26 | 厦门市美亚柏科信息股份有限公司 | Database table data importing and exporting method, terminal equipment and storage medium |
Non-Patent Citations (10)
Title |
---|
ANTONIOS MAKRIS 等: "Database system comparison based on spatiotemporal functionality", ACM, pages 1 - 7 * |
VADIM EISENBERG 等: "D2RQ/update: updating relational data via virtual RDF", 《ACM》 * |
VADIM EISENBERG 等: "D2RQ/update: updating relational data via virtual RDF", 《ACM》, 16 April 2012 (2012-04-16), pages 497 - 498, XP058468017, DOI: 10.1145/2187980.2188095 * |
孟学潮等: "基于实时数据和历史查询分布的时空索引新方法", 《计算机应用》 * |
孟学潮等: "基于实时数据和历史查询分布的时空索引新方法", 《计算机应用》, no. 03, 10 March 2017 (2017-03-10) * |
袁满;康峰峰;黄刚;: "一种融入MD5的影子表算法研究", 计算机应用研究, no. 01, pages 149 - 151 * |
赵德基等: "应用在变电运检管理平台的数据库技术研究", 《数字技术与应用》 * |
赵德基等: "应用在变电运检管理平台的数据库技术研究", 《数字技术与应用》, no. 09, 5 September 2018 (2018-09-05), pages 23 - 26 * |
赵驰等: "面向城轨线网的海量数据查询优化方法", 《计算机系统应用》 * |
赵驰等: "面向城轨线网的海量数据查询优化方法", 《计算机系统应用》, no. 12, 15 December 2015 (2015-12-15), pages 157 - 162 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113449505A (en) * | 2021-07-01 | 2021-09-28 | 浪潮天元通信信息系统有限公司 | File comparison method |
Also Published As
Publication number | Publication date |
---|---|
CN112948389B (en) | 2023-07-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109167811B (en) | Cross-chain data access method and device based on block chain | |
WO2021073242A1 (en) | Index creation and data querying methods, apparatus and device | |
CN111324665B (en) | Log playback method and device | |
WO2021017422A1 (en) | Index creation method in block chain type account book, device and apparatus | |
US20180144061A1 (en) | Edge store designs for graph databases | |
CN105630475B (en) | A kind of data label organization system and method for organizing | |
US20070156778A1 (en) | File indexer | |
WO2020253231A1 (en) | Receipt-based data storage method and apparatus, and device | |
WO2023083237A1 (en) | Graph data management | |
CN113918535A (en) | Data reading method, device, equipment and storage medium | |
CN115599764A (en) | Method, device and medium for migrating table data | |
CN114626092A (en) | Desensitization method, system, device and computer storage medium for multi-field data with incidence relation | |
CN112948389B (en) | MD 5-based database table data comparison method and device | |
US10691757B1 (en) | Method and system for cached document search | |
CN117492670A (en) | Log printing sequence determining method and device and electronic equipment | |
TWI710918B (en) | An optimization method, device and computer equipment of LSM tree | |
US20180144060A1 (en) | Processing deleted edges in graph databases | |
CN108228604B (en) | Model construction method based on memory object, information query method and device | |
CN110019357B (en) | Database query script generation method and device | |
CN112632211A (en) | Semantic information processing method and equipment for mobile robot | |
CN114816247A (en) | Logic data acquisition method and device | |
CN111459949B (en) | Data processing method, device and equipment for database and index updating method | |
CN114443777B (en) | Multi-data aggregation management method, device, equipment and system | |
CN106155837B (en) | method and device for restoring data of main and standby databases | |
US10521314B2 (en) | Cross-referenced irregular field storage in databases |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |