Data comparison method and device, computer equipment and storage medium

By performing full-scale comparison and multiple rounds of difference comparison between different online databases, the problem of determining true differences is solved, and the accurate identification and removal of false differences between databases is achieved.

CN119415494APending Publication Date: 2025-02-11JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411438773.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When comparing data between different online databases, it is difficult to determine the true difference, especially when the database cannot maintain constant consistency and read and write services are provided online.

Method used

When receiving the data comparison instruction at the first moment, the data to be compared between the two databases are obtained and the complete comparison is performed within the first preset time period to obtain the difference set. Subsequently, within the second preset time period, through multiple rounds of difference comparison, pseudo-differences caused by time difference are excluded, and real difference data are obtained.

Benefits of technology

Accurate determination of the true differences between different online databases is achieved, and pseudo-differences caused by data synchronization time difference is eliminated, providing more accurate differences comparison results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415494A_ABST
    Figure CN119415494A_ABST
Patent Text Reader

Abstract

The invention relates to a data comparison method and device, computer equipment and a storage medium. The method comprises the steps that when a data comparison instruction is received at a first moment, first to-be-compared data of a first database at the first moment and second to-be-compared data of second data at the first moment are acquired; performing full-quantity comparison on the first to-be-compared data and the second to-be-compared data within a first preset duration from the first moment to obtain a difference set; within a second preset duration, the first database and the second database are used for conducting multi-round difference comparison on the difference data in the difference set, a target comparison result is obtained, and the target comparison result comprises real difference data of the first database and the second database at the first moment. Multi-round difference comparison is carried out on the difference part subjected to full-amount comparison, pseudo differences generated by time differences in the difference part are removed, only real differences are reserved, and therefore the problem of how to determine the real differences between different online databases is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data comparison, and in particular to a data comparison method, device, computer equipment and storage medium. Background Art

[0002] With the development of the Internet, more and more databases have been invested. However, there is correlation between the data in different databases. Sometimes it is necessary to compare the data differences of some tables in different databases. However, since the two databases cannot maintain data consistency at all times and both databases provide data reading and writing services online, it is very difficult to obtain the real difference between the two data. It is impossible to confirm whether the difference data is caused by the synchronization time difference between the two databases or the real difference. In addition, the online service during the comparison process will make it more difficult to judge the data difference. Summary of the invention

[0003] The present application provides a data comparison method, apparatus, computer device and storage medium to solve the problem of how to determine the real differences between different online databases.

[0004] In a first aspect, the present application provides a data comparison method, the method comprising:

[0005] When a data comparison instruction is received at a first moment, first data to be compared of a first database at a first moment and second data to be compared of a second database at a first moment are obtained through a comparison thread, wherein the first database and the second database are different online databases;

[0006] Performing a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set, wherein the difference set includes a plurality of difference data;

[0007] Within a second preset time period, the first database and the second database are used to perform multiple rounds of difference comparisons on each difference data in the difference set to obtain a target comparison result, wherein the target comparison result includes the actual difference data between the first database and the second database at the first moment, and the start moment of the second preset time period is the end moment of the first preset time period.

[0008] Optionally, performing a round of difference comparison on each difference data in the difference set using the first database and the second database includes:

[0009] querying the first database and the second database respectively for the latest data value corresponding to each difference data in the difference set;

[0010] When the latest data value of the target difference data queried from the first database is the same as the latest data value queried from the second database, the target difference data is removed from the difference set to obtain an updated difference set, wherein the target difference data is any difference data in the difference set, and the updated difference set is used to execute the steps of querying the latest data values ​​corresponding to each difference data in the difference set in the first database and the second database respectively in the next round of difference comparison.

[0011] Optionally, the starting time of the second preset duration is greater than the sum of the first time and a data time difference, where the data time difference is a data synchronization time difference between the first database and the second database.

[0012] Optionally, within the second preset time period, the starting time of the last round of difference comparison of each difference data in the difference set using the first database and the second database is greater than the sum of the first time and the data time difference, and the data time difference is the data synchronization time difference between the first database and the second database.

[0013] Optionally, when receiving the data comparison instruction at the first moment, obtaining, through the comparison thread, first data to be compared of the first database at the first moment, and second data to be compared of the second data at the first moment, includes:

[0014] When a data comparison instruction is received at a first moment, a first data snapshot of first data to be compared in the first database at the first moment and a second data snapshot of second data to be compared in the first moment are obtained through a comparison thread.

[0015] Optionally, performing a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set includes:

[0016] The first data snapshot and the second data snapshot are fully compared within a first preset time period from the first moment to obtain a difference set.

[0017] Optionally, the first data to be compared is the full data of the first database or partial data filtered according to a query condition, and the second data to be compared is the full data or partial data in the second database corresponding to the first data to be compared.

[0018] In a second aspect, the present application provides a data comparison device, characterized in that the device comprises:

[0019] an acquisition module, configured to, when receiving a data comparison instruction at a first moment, obtain, through a comparison thread, first data to be compared of a first database at a first moment, and second data to be compared of a second database at a first moment, wherein the first database and the second database are different online databases;

[0020] a full comparison module, configured to perform a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set, wherein the difference set includes a plurality of difference data;

[0021] A difference comparison module is used to perform multiple rounds of difference comparison on each difference data in a difference set using the first database and the second database within a second preset time length to obtain a target comparison result, wherein the target comparison result includes the actual difference data between the first database and the second database at the first moment, and the start moment of the second preset time length is the end moment of the first preset time length.

[0022] In a third aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data comparison method when executing the computer program.

[0023] In a fourth aspect, the present application also provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the above-mentioned data comparison method.

[0024] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application, when receiving a data comparison instruction at a first moment, obtains the first data to be compared of the first database at the first moment and the second data to be compared of the second data at the first moment through the comparison thread, wherein the first database and the second database are different online databases; within a first preset time length from the first moment, the first data to be compared and the second data to be compared are fully compared to obtain a difference set, wherein the difference set includes multiple difference data; within a second preset time length, multiple rounds of difference comparison are performed on each difference data in the difference set using the first database and the second database to obtain a target comparison result, wherein the target comparison result includes the real difference data between the first database and the second database at the first moment, and the start time of the second preset time length is the end time of the first preset time length.

[0025] Based on the above method, the two online databases are first fully compared with the data to be compared, and the difference parts after the full comparison are subjected to multiple rounds of difference comparison to remove the pseudo-differences caused by the time difference in this part of the difference, and only the real differences are retained, thus solving the problem of how to determine the real differences between different online databases. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0028] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0029] Figure 1 An application environment diagram of a data comparison method provided in an embodiment of the present application;

[0030] Figure 2 A schematic diagram of a data comparison method provided in an embodiment of the present application;

[0031] Figure 3 A structural block diagram of a data comparison device provided in an embodiment of the present application;

[0032] Figure 4 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0034] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0035] Figure 1 FIG. 1 is an application environment diagram of a data comparison method in an embodiment. Figure 1 , the data comparison method is applied to a data comparison system. The data comparison system includes a data comparison device 110 and at least two different online databases, and the data comparison device 110 and the different online databases can be respectively arranged in different devices, or can be simultaneously concentrated in the same device. The device can specifically be a terminal or a server. The terminal can specifically be a desktop terminal or a mobile terminal, and the mobile terminal can specifically be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0036] In one embodiment, Figure 2 is a flow chart of a data comparison method in an embodiment, referring to Figure 2 , provides a data comparison method. This embodiment mainly applies this method to the above Figure 1 Taking the data comparison device 110 in the example as an example, the data comparison method specifically includes the following steps:

[0037] Step S210, when a data comparison instruction is received at a first moment, the first data to be compared of the first database 120 at the first moment and the second data to be compared of the second data at the first moment are obtained through the comparison thread, wherein the first database 120 and the second database 130 are different online databases.

[0038] Specifically, the data comparison instruction can be automatically triggered by the data comparison device 110 according to a timing, that is, the data comparison instruction can be generated at a timing, or it can be initiated by the user through the client. The data comparison instruction includes the first database 120 and the second database 130 to be compared, and specifies the first data to be compared in the first database 120 and the second data to be compared in the second database 130, and is used to request a difference comparison between the first data to be compared in the first database 120 and the second data to be compared in the second database 130. The data to be compared can specifically be the full data / partial data of the specified table / all tables in the database, and the partial data refers to the data filtered according to the query conditions.

[0039] An online database refers to a database that provides data reading and writing services online. The first moment is recorded as T1. The comparison thread pulls the data to be compared from the two databases at moment T1.

[0040] Step S220: perform a full comparison on the first data to be compared and the second data to be compared within a first preset time period starting from the first moment to obtain a difference set, wherein the difference set includes a plurality of difference data.

[0041] Specifically, the starting time of the first preset time length is time T1, and the ending time of the first preset time length is time T2. After the first data to be compared and the second data to be compared are pulled at time T1, the first data to be compared and the second data to be compared are fully compared within the first preset time length, and a difference set is generated at time T2. The difference set is recorded as DiffDataSet1. The difference data in the difference set is data that only exists in the first data to be compared or the second data to be compared. However, some of the difference data in the difference set at this time may be caused by the data time difference between the first database 120 and the second database 130. For example, if data A is written to the first database 120 and then to the second database 130, due to a certain data time difference before writing into the second database 130, data A does not exist in the second database 130, then data A will be put into the difference set as difference data.

[0042] Step S230, within a second preset time length, use the first database 120 and the second database 130 to perform multiple rounds of difference comparison on each difference data in the difference set to obtain a target comparison result, wherein the target comparison result includes the actual difference data between the first database 120 and the second database 130 at the first moment, and the starting moment of the second preset time length is the ending moment of the first preset time length.

[0043] Specifically, the starting time of the second preset time length is time T2, and the ending time is time T3. Within the second preset time length, multiple rounds of difference comparison are performed on the difference data in the difference set to exclude the difference data caused by the data time difference, so as to obtain the target comparison result that finally contains only the real difference data. The real difference data refers to the difference data that is not caused by the data time difference and is only stored in the first database 120 or the second database 130, that is, the difference data is only written to the first database 120 or the second database 130, and the data synchronization is not performed between the first database 120 and the second database 130.

[0044] Based on the above method, the two online databases are first fully compared with the data to be compared, and the difference parts after the full comparison are subjected to multiple rounds of difference comparison to remove the pseudo-differences caused by the time difference in this part of the difference, and only the real differences are retained, thus solving the problem of how to determine the real differences between different online databases.

[0045] In one embodiment, a round of difference comparison is performed on each difference data in the difference set using the first database 120 and the second database 130, including:

[0046] Query the first database 120 and the second database 130 respectively for the latest data value corresponding to each difference data in the difference set;

[0047] When the latest data value of the target difference data queried from the first database 120 is the same as the latest data value queried from the second database 130, the target difference data is removed from the difference set to obtain an updated difference set, wherein the target difference data is any difference data in the difference set, and the updated difference set is used to execute the steps of querying the latest data values ​​corresponding to each difference data in the difference set in the first database 120 and the second database 130 respectively in the next round of difference comparison.

[0048] Specifically, performing a round of difference comparison means querying the latest data values ​​of the difference data in the difference set from the first database 120 and the second database 130 respectively. If the data on both sides are the same, they are removed from DiffDataSet1. That is, the latest data values ​​queried from the first database 120 and the second database 130 for the same difference data are the same, indicating that the difference data is caused by the data time difference between the first database 120 and the second database 130, and is not the real difference data. Therefore, the difference data is removed from the difference set. In this way, multiple rounds of difference comparison are performed on the difference set. The difference set used in each round is the difference set obtained after the previous round of difference comparison, that is, the difference set is iteratively compared until time T3 is reached, and the difference set obtained in the last round is used as the final target difference result. After n rounds of data comparison, it can be accurately confirmed that the difference caused by the time difference between the two databases is removed, while the real difference is retained. A more accurate difference comparison result can be provided to the user, which is convenient for the user and avoids confirming the authenticity of the difference in various ways.

[0049] In one embodiment, the start time of the second preset duration is greater than the sum of the first time and a data time difference, where the data time difference is a data synchronization time difference between the first database 120 and the second database 130 .

[0050] Specifically, time T2 must be later than the time corresponding to the sum of time T1 and the data time difference, that is, it is required that at the start time of the first round of difference comparison, the data version in the database with slower data update in the first database 120 and the second database 130 has been updated to the data version of the database with faster data update at time T1, so as to ensure that the time period before the start time of the difference comparison process already includes the time difference from the database with slow data update to the database with fast data update at time T1. In this way, starting the first round of difference comparison at time T2 can ensure that the difference data caused by the data time difference in the difference set before the difference comparison is performed has been updated in both databases. In this way, the difference data caused by the data time difference in the difference set can be accurately identified and removed from the difference set during multiple rounds of difference comparison.

[0051] In one embodiment, within the second preset time period, the starting time of the last round of difference comparison of each difference data in the difference set using the first database 120 and the second database 130 is greater than the sum of the first time and the data time difference, and the data time difference is the data synchronization time difference between the first database 120 and the second database 130.

[0052] Specifically, within the second preset time period, the first database 120 and the second database 130 are used to perform N rounds of difference comparison on each difference data in the difference set, that is, the number of rounds of difference comparison is N, and the last round is recorded as the Nth round, and the starting time of the Nth round of difference comparison is recorded as Tn, and the starting time of the Nth round of difference comparison must be later than the time corresponding to the sum of the time T1 and the data time difference, that is, it is required that at the start time of the Nth round of difference comparison, the data version in the database with slower data update in the first database 120 and the second database 130 has been updated to the data update time T1. The data version of the newer and faster database is used to ensure that the time period before the start time of the Nth round of difference comparison process has included the time difference between the database with slow data update and the database with fast data update at time T1. In this way, the Nth round of difference comparison is started at time Tn, which can ensure that the difference data caused by the data time difference in the difference set has been updated in both databases before the last round of difference comparison. In this way, the difference data caused by the data time difference in the difference set can be fully identified and removed from the difference set in the last round of difference comparison process.

[0053] In one embodiment, when the data comparison instruction is received at the first moment, obtaining the first data to be compared of the first database 120 at the first moment and the second data to be compared of the second data at the first moment through the comparison thread includes:

[0054] When a data comparison instruction is received at a first moment, a first data snapshot of the first data to be compared in the first database 120 at the first moment and a second data snapshot of the second data to be compared at the first moment are obtained through the comparison thread.

[0055] Specifically, when a data comparison instruction is received at the first moment, data snapshots of the data to be compared in the first database 120 and the second database 130 are pulled respectively through the comparison thread. Pulling data snapshots takes less time than copying the data to be compared and occupies less memory space. Therefore, by pulling snapshot data, the data comparison time can be shortened and the data comparison result can be obtained more quickly.

[0056] In one embodiment, performing a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set includes:

[0057] The first data snapshot and the second data snapshot are fully compared within a first preset time period from the first moment to obtain a difference set.

[0058] Specifically, comparing the pulled data snapshots can further shorten the comparison time and provide users with difference comparison results more quickly compared to comparing a large amount of data to be compared.

[0059] In one embodiment, the first data to be compared is the full data of the first database 120 or partial data filtered according to the query conditions, and the second data to be compared is the full data or partial data in the second database 130 corresponding to the first data to be compared.

[0060] Specifically, the data to be compared can be the full data of the database at the first moment, which refers to all the data of all tables or specified tables in the database, or it can be partial data after the database is filtered according to the search conditions, so as to provide a comparison function for different types of data.

[0061] Figure 2 FIG. 1 is a flow chart of a data comparison method in one embodiment. It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0062] In one embodiment, Figure 3 As shown, a data comparison device 110 is provided, comprising:

[0063] The acquisition module 310 is configured to, when receiving a data comparison instruction at a first moment, obtain, through a comparison thread, first data to be compared from the first database 120 at the first moment, and second data to be compared from the second database at the first moment, wherein the first database 120 and the second database 130 are different online databases;

[0064] A full comparison module 320, configured to perform a full comparison on the first to-be-compared data and the second to-be-compared data within a first preset time period from the first moment to obtain a difference set, wherein the difference set includes a plurality of difference data;

[0065] The difference comparison module 330 is used to perform multiple rounds of difference comparison on each difference data in the difference set using the first database 120 and the second database 130 within a second preset time period to obtain a target comparison result, wherein the target comparison result includes the actual difference data between the first database 120 and the second database 130 at the first moment, and the start moment of the second preset time period is the end moment of the first preset time period.

[0066] In one embodiment, the difference comparison module 330 is further used to:

[0067] Query the first database 120 and the second database 130 respectively for the latest data value corresponding to each difference data in the difference set;

[0068] When the latest data value of the target difference data queried from the first database 120 is the same as the latest data value queried from the second database 130, the target difference data is removed from the difference set to obtain an updated difference set, wherein the target difference data is any difference data in the difference set, and the updated difference set is used to execute the steps of querying the latest data values ​​corresponding to each difference data in the difference set in the first database 120 and the second database 130 respectively in the next round of difference comparison.

[0069] In one embodiment, the start time of the second preset duration is greater than the sum of the first time and a data time difference, where the data time difference is a data synchronization time difference between the first database 120 and the second database 130 .

[0070] In one embodiment, within the second preset time period, the starting time of the last round of difference comparison of each difference data in the difference set using the first database 120 and the second database 130 is greater than the sum of the first time and the data time difference, and the data time difference is the data synchronization time difference between the first database 120 and the second database 130.

[0071] In one embodiment, the acquisition module 310 is further used for:

[0072] When a data comparison instruction is received at a first moment, a first data snapshot of the first data to be compared in the first database 120 at the first moment and a second data snapshot of the second data to be compared at the first moment are obtained through the comparison thread.

[0073] In one embodiment, the full amount comparison module 320 is further used to:

[0074] The first data snapshot and the second data snapshot are fully compared within a first preset time period from the first moment to obtain a difference set.

[0075] In one embodiment, the first data to be compared is the full data of the first database 120 or partial data filtered according to the query conditions, and the second data to be compared is the full data or partial data in the second database 130 corresponding to the first data to be compared.

[0076] like Figure 4 As shown, an embodiment of the present application provides a computer device, including a processor 711, a communication interface 712, a memory 713 and a communication bus 714, wherein the processor 711, the communication interface 712, and the memory 713 communicate with each other through the communication bus 714;

[0077] Memory 713, used for storing computer programs;

[0078] The processor 711 is used to implement the data comparison method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 713.

[0079] Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0080] In one embodiment, the data comparison device 110 provided in the present application can be implemented in the form of a computer program. The computer program can be Figure 4 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the data comparison device 110, for example, Figure 3 The acquisition module 310, the full comparison module 320 and the difference comparison module 330 are shown. The computer program composed of various program modules enables the processor to execute the data comparison method of each embodiment of the present application described in this specification.

[0081] Figure 4 The computer device shown can be Figure 3 When the acquisition module 310 in the data comparison device 110 shown receives the data comparison instruction at the first moment, the first data to be compared of the first database 120 at the first moment and the second data to be compared of the second data at the first moment are obtained through the comparison thread, wherein the first database 120 and the second database 130 are different online databases. The computer device can perform a full comparison of the first data to be compared and the second data to be compared within a first preset time length from the first moment through the full comparison module 320 to obtain a difference set, wherein the difference set includes a plurality of difference data. The computer device can perform multiple rounds of difference comparisons on each difference data in the difference set using the first database 120 and the second database 130 within a second preset time length through the difference comparison module 330 to obtain a target comparison result, wherein the target comparison result includes the real difference data of the first database 120 and the second database 130 at the first moment, and the start time of the second preset time length is the end time of the first preset time length.

[0082] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the data comparison method provided in any of the aforementioned method embodiments is implemented.

[0083] 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 shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0084] 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 general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology 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.

[0085] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative can be used.

[0086] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A data comparison method, characterized in that: The method comprises: When a data comparison instruction is received at a first moment, first data to be compared of a first database at a first moment and second data to be compared of a second database at a first moment are obtained through a comparison thread, wherein the first database and the second database are different online databases; Performing a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set, wherein the difference set includes a plurality of difference data; Within a second preset time period, the first database and the second database are used to perform multiple rounds of difference comparisons on each difference data in the difference set to obtain a target comparison result, wherein the target comparison result includes the actual difference data between the first database and the second database at the first moment, and the start moment of the second preset time period is the end moment of the first preset time period.

2. The method according to claim 1, characterized in that Performing a round of difference comparison on each difference data in the difference set by using the first database and the second database includes: querying the first database and the second database respectively for the latest data value corresponding to each difference data in the difference set; When the latest data value of the target difference data queried from the first database is the same as the latest data value queried from the second database, the target difference data is removed from the difference set to obtain an updated difference set, wherein the target difference data is any difference data in the difference set, and the updated difference set is used to execute the steps of querying the latest data values ​​corresponding to each difference data in the difference set in the first database and the second database respectively in the next round of difference comparison.

3. The method according to claim 1, characterized in that The starting time of the second preset duration is greater than the sum of the first time and a data time difference, where the data time difference is a data synchronization time difference between the first database and the second database.

4. The method according to claim 1, characterized in that: Within the second preset time period, the starting time of the last round of difference comparison of each difference data in the difference set using the first database and the second database is greater than the sum of the first time and the data time difference, and the data time difference is the data synchronization time difference between the first database and the second database.

5. The method according to claim 1, characterized in that When receiving the data comparison instruction at the first moment, obtaining the first data to be compared of the first database at the first moment and the second data to be compared of the second database at the first moment through the comparison thread includes: When a data comparison instruction is received at a first moment, a first data snapshot of first data to be compared in the first database at the first moment and a second data snapshot of second data to be compared in the first moment are obtained through a comparison thread.

6. The method according to claim 5, characterized in that The step of performing a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set includes: The first data snapshot and the second data snapshot are fully compared within a first preset time period from the first moment to obtain a difference set.

7. The method according to claim 1, characterized in that The first data to be compared is the full data of the first database or partial data filtered according to a query condition, and the second data to be compared is the full data or partial data in the second database corresponding to the first data to be compared.

8. A data comparison device, characterized in that: The device comprises: an acquisition module, configured to, when receiving a data comparison instruction at a first moment, obtain, through a comparison thread, first data to be compared of a first database at a first moment, and second data to be compared of a second database at a first moment, wherein the first database and the second database are different online databases; a full comparison module, configured to perform a full comparison on the first data to be compared and the second data to be compared within a first preset time period from the first moment to obtain a difference set, wherein the difference set includes a plurality of difference data; A difference comparison module is used to perform multiple rounds of difference comparison on each difference data in a difference set using the first database and the second database within a second preset time length to obtain a target comparison result, wherein the target comparison result includes the actual difference data between the first database and the second database at the first moment, and the start moment of the second preset time length is the end moment of the first preset time length.

9. A computer 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 computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Data processing method and device, storage medium and electronic equipment

    CN120705161A

  • Hive metadata-based total data amount auditing method and device, equipment and storage medium

    CN121166778A