Business data processing method and device, electronic equipment and storage medium

By employing a hierarchical management strategy in the database, storing more recent data in the first database and older data in the second database, and combining timestamps and synchronization rates, the problem of low database maintenance efficiency is solved, achieving efficient data storage and retrieval.

CN116955356BActive Publication Date: 2025-11-04BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310891172.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2025-11-04
Estimated Expiration
2043-07-20

AI Technical Summary

Technical Problem

The problem of low database maintenance efficiency in existing technologies, especially when dealing with large amounts of data, is caused by the low maintenance efficiency resulting from database sharding and table partitioning methods.

Method used

By storing new business data in the first database and deleting older data when the data volume exceeds a threshold, and synchronizing data to the second database when synchronization conditions are triggered, data management is performed by combining timestamps and synchronization rates. A hierarchical management strategy is adopted, with the first database used for transaction processing and the second database used for massive data storage and analysis.

Benefits of technology

It achieves the balance of massive data storage, high-concurrency complex queries, and transaction support with only two databases, improving database resource utilization and maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116955356B_ABST
    Figure CN116955356B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a business data processing method and device, electronic equipment and storage medium, comprising: in response to a storage instruction for new business data, storing the new business data into a first database; in a case where the data volume after adding the new business data in the first database exceeds a data volume threshold, deleting target business data in the first database; the storage time of the target business data is earlier than that of other business data in the first database, and the other business data is data in the first database except the target business data; when the new business data triggers a preset synchronization condition, synchronizing the new business data in the first database to a second database. The method can realize hierarchical management of business data, improve the utilization rate of database resources, and facilitate data maintenance through hierarchical management, thereby improving the maintenance efficiency of the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a business data processing method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] In some business areas where data updates are rapid, each data update generates a corresponding amount of business data. Over time, this amount of business data will continue to grow, placing high demands on data management.

[0003] Currently, the management methods for large amounts of data in these business areas mostly adopt the approach of database sharding and table partitioning. Database sharding and table partitioning splits a originally independent database into several databases and large tables into several tables, reducing the amount of data in a single database or table. While this method can alleviate the problem of database performance degradation caused by excessive data volume to some extent, the maintenance efficiency is low due to the large number of databases and tables. Summary of the Invention

[0004] This disclosure provides a business data processing method, apparatus, electronic device, storage medium, and program product to at least solve the problem of low database maintenance efficiency in related technologies. The technical solution of this disclosure is as follows:

[0005] According to a first aspect of the present disclosure, a business data processing method is provided, comprising:

[0006] In response to a storage instruction for new business data, the new business data is stored in the first database;

[0007] If the amount of data after adding the new business data to the first database exceeds the data volume threshold, the target business data in the first database is deleted; the storage time of the target business data is earlier than that of other business data in the first database, and the other business data refers to data in the first database other than the target business data.

[0008] When the new business data triggers a preset synchronization condition, the new business data in the first database is synchronized to the second database.

[0009] In one exemplary embodiment, the business data stored in the first database and the second database carries a timestamp; the method further includes:

[0010] The timestamps of the first and last two business data items in the first database are periodically obtained, as well as the first number of business data items stored in the first database.

[0011] Query the second database to find the second number of business data within the time range corresponding to the timestamps of the first and last data;

[0012] If the first number is greater than the second number, then the missing data in the second database is determined, and the missing data is resynchronized from the first database to the second database; or, the business data within the time range in the first database is resynchronized to the second database.

[0013] In one exemplary embodiment, the method further includes:

[0014] Receive data query instructions;

[0015] When the data query instruction carries query parameters, the first database or the second database is queried according to the query parameters to obtain the corresponding query data.

[0016] In one exemplary embodiment, the method further includes:

[0017] When the data query instruction does not carry query parameters, obtain the synchronization rate of business data from the first database to the second database;

[0018] Based on the synchronization rate, the database to be queried is determined from the first database and the second database, and the corresponding query data is obtained.

[0019] In an exemplary embodiment, determining the database to be queried from the first database and the second database based on the synchronization rate, and querying the corresponding query data, includes:

[0020] If the synchronization rate is greater than the first threshold, then the second database is queried to obtain the corresponding query data;

[0021] If the synchronization rate is less than the second threshold, then the first database is queried to obtain the corresponding query data;

[0022] If the synchronization rate is greater than the second threshold and less than the first threshold, then query the first database or the second database to obtain the corresponding query data.

[0023] In an exemplary embodiment, the step of querying the first database or the second database according to the query parameters to obtain the corresponding query data includes:

[0024] When the query parameter is a parameter with real-time requirements, the first database is queried to obtain the corresponding query data.

[0025] In one exemplary embodiment, the first database employs an online transaction processing scheme, and the second database employs an online analytical processing scheme.

[0026] According to a second aspect of the present disclosure, a business data processing apparatus is provided, comprising:

[0027] The storage unit is configured to execute a storage instruction for new business data and store the new business data in the first database.

[0028] The deletion unit is configured to delete target business data in the first database when the amount of data after adding the new business data to the first database exceeds a data volume threshold; the target business data is stored earlier than other business data in the first database, and the other business data is data in the first database other than the target business data.

[0029] The synchronization unit is configured to synchronize the new business data in the first database to the second database when the new business data triggers a preset synchronization condition.

[0030] In an exemplary embodiment, the business data stored in the first database and the second database carries a timestamp; the synchronization unit is further configured to periodically acquire the timestamps of the first and last business data in the first database, and a first number of business data stored in the first database; query the second database for a second number of business data within the time range corresponding to the timestamps of the first and last data; if the first number is greater than the second number, determine the missing data in the second database, and resynchronize the missing data from the first database to the second database, or resynchronize the business data within the time range in the first database to the second database.

[0031] In one exemplary embodiment, the apparatus further includes a query unit configured to execute a data query instruction; when the data query instruction carries query parameters, the unit queries the first database or the second database according to the query parameters to obtain the corresponding query data.

[0032] In an exemplary embodiment, the query unit is further configured to, when the data query instruction does not carry query parameters, obtain the synchronization rate of business data from the first database to the second database; based on the synchronization rate, determine the database to be queried from the first database and the second database, and query the corresponding query data.

[0033] In an exemplary embodiment, the query unit is further configured to perform the following actions: if the synchronization rate is greater than a first threshold, query the second database to obtain corresponding query data; if the synchronization rate is less than a second threshold, query the first database to obtain corresponding query data; if the synchronization rate is greater than the second threshold and less than the first threshold, query either the first database or the second database to obtain corresponding query data.

[0034] In an exemplary embodiment, the query unit is further configured to query the first database to obtain corresponding query data when the query parameter is a parameter with real-time requirements.

[0035] In one exemplary embodiment, the first database employs an online transaction processing scheme, and the second database employs an online analytical processing scheme.

[0036] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0037] processor;

[0038] Memory used to store the processor's executable instructions;

[0039] The processor is configured to execute the instructions to implement the method as described in any of the preceding methods.

[0040] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the method described in any of the preceding claims.

[0041] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product including instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the method as described in any of the preceding claims.

[0042] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0043] In response to a storage command for new business data, the terminal first stores the new business data in the first database. When the new business data triggers a preset synchronization condition, it synchronizes the new business data from the first database to the second database. Simultaneously, if the data volume after adding new business data to the first database exceeds a data volume threshold, the target business data stored earlier in the first database is deleted. This method stores more recent business data in the first database and maintains the data volume in the first database within a suitable range, enabling the first database to provide basic transaction processing support. Meanwhile, older business data is stored in the second database, which handles the storage of massive amounts of business data and provides high-concurrency data query and analysis capabilities. This achieves hierarchical management of business data, requiring only two databases to handle massive data storage, high-concurrency complex queries, and transaction support for business data. This improves the utilization of database resources, and the hierarchical management facilitates data maintenance, thus improving database maintenance efficiency.

[0044] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0045] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0046] Figure 1 This is an application environment diagram illustrating a business data processing method according to an exemplary embodiment.

[0047] Figure 2 This is a flowchart illustrating a business data processing method according to an exemplary embodiment.

[0048] Figure 3 This is a flowchart illustrating a method for achieving data consistency according to an exemplary embodiment.

[0049] Figure 4 This is a schematic diagram illustrating a framework for implementing a business data processing method according to an exemplary embodiment.

[0050] Figure 5 This is a schematic diagram illustrating a framework for implementing a business data processing method according to another exemplary embodiment.

[0051] Figure 6 This is a structural block diagram of a business data processing apparatus according to an exemplary embodiment.

[0052] Figure 7This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0053] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0054] It should be noted that the embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0055] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0056] The business data processing method provided in this disclosure can be applied to, for example, Figure 1In the application environment shown, terminal 102 communicates with the first database 104 and the second database 106 via a network. In the application scenario of this disclosure, when terminal 102 receives a storage instruction for new business data, in response to the storage instruction, terminal 102 first stores the new business data in the first database 104. If the amount of data in the first database 104 exceeds the data volume threshold after adding the new business data, the terminal deletes the target business data in the first database 104 that was stored earlier than other business data, so as to control the amount of data in the first database 104 within a certain range. When new business data is detected to trigger a preset synchronization condition, the new business data in the first database 104 is synchronized to the second database 106. This achieves the storage of more recent business data in the first database and maintains the amount of data stored in the first database within a suitable range, so that the first database can provide basic transaction processing support. Meanwhile, business data that is older is stored in the second database, which can store massive amounts of business data and provide high-concurrency data query and analysis capabilities, thereby achieving hierarchical management of business data. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc.

[0057] Figure 2 This is a flowchart illustrating a business data processing method according to an exemplary embodiment, such as... Figure 2 As shown, this method is applied to Figure 1 Taking terminal 102 as an example, the explanation includes the following steps:

[0058] In step S210, in response to a storage instruction for new business data, the new business data is stored in the first database.

[0059] Business data may include data content, timestamps, and business data numbers.

[0060] The first database is used to store business data that is more recent than the current time, that is, to store the most recently generated business data.

[0061] In a specific implementation, when new business data is generated that needs to be stored, the terminal 102 will receive a storage instruction for the new business data, and can then respond to the storage instruction to store the new business data in the first database.

[0062] In step S220, if the amount of data after adding new business data to the first database exceeds the data volume threshold, the target business data in the first database is deleted; the storage time of the target business data is earlier than that of other business data in the first database, and the other business data are the data in the first database other than the target business data.

[0063] The data volume threshold is used to maintain the data volume in the first database within a suitable range to avoid excessive data volume in the first database, which would affect the transaction processing capability of the first database. The data volume threshold can be set according to actual needs.

[0064] In practice, after storing new business data in the first database, the amount of data in the first database after adding the new business data can be determined synchronously, and the amount of data at this time can be compared with the preset data amount threshold. If the amount of data at this time is less than the data amount threshold, no processing is required. Conversely, if the amount of data at this time is greater than the data amount threshold, some business data needs to be deleted from the first database to keep the amount of data in the first database within the range that does not exceed the data amount threshold.

[0065] More specifically, in order to ensure the freshness of the data in the first database, the business data to be deleted can be the target business data that was stored in the first database earlier. In other words, the storage time of the target business data to be deleted is earlier than the storage time of other business data in the first database.

[0066] In this step, when the amount of data in the first database exceeds the data volume threshold after adding new business data, the target business data that was stored in the first database earlier is deleted. By setting this deletion mechanism in the first database, the amount of data in the first database can be maintained within a certain range, ensuring the normal processing and execution of basic transactions in the first database.

[0067] In step S230, when new business data triggers a preset synchronization condition, the new business data in the first database is synchronized to the second database.

[0068] The second database is used to store business data from earlier times.

[0069] In this step, the synchronization condition can be either that the new business data has been stored in the first database for a preset duration, or that the current time has reached a preset synchronization point. The second synchronization condition is unaffected by the storage time of the new business data in the first database. For example, if the operation of synchronizing business data from the first database to the second database is set to be performed every 10 minutes, if the new business data is stored in the first database within the 10-minute interval, then when 10 minutes have passed since the last synchronization operation, the new business data will be synchronized to the second database regardless of its storage time in the first database.

[0070] In practical implementation, a synchronizer can be set to detect the storage time of new business data in the first database and compare it with a preset duration. When the preset duration is reached, the new business data is synchronously stored in the second database. Alternatively, a synchronization interval can be set. When the time difference between the current time and the time of the last synchronization operation reaches the set interval, a synchronization operation is performed, thereby achieving the synchronous storage of new business data in the second database.

[0071] In the aforementioned business data processing method, in response to a storage instruction for new business data, the terminal first stores the new business data in the first database. When the new business data triggers a preset synchronization condition, the new business data in the first database is synchronized to the second database. Simultaneously, if the data volume after adding new business data to the first database exceeds a data volume threshold, the target business data stored earlier in the first database is deleted. This method stores more recent business data in the first database and maintains the data volume in the first database within a suitable range, enabling the first database to provide basic transaction processing support. Meanwhile, older business data is stored in the second database, which handles the storage of massive amounts of business data and provides high-concurrency data query and analysis capabilities. This achieves hierarchical management of business data, requiring only two databases to handle massive data storage, high-concurrency complex queries, and transaction support for business data. This improves the utilization rate of database resources, and hierarchical management facilitates data maintenance, thereby improving database maintenance efficiency.

[0072] In addition to setting up an event synchronization mechanism to ensure data synchronization between the first and second databases, a monitoring mechanism can also be set up to ensure data consistency between the two databases. This mechanism uses asynchronous data comparison to guarantee data consistency between the first and second databases. (Reference) Figure 3The above is a flowchart illustrating a method for ensuring data consistency in a first database and a second database, as shown in an exemplary embodiment. The method specifically includes the following steps:

[0073] Step S310: Periodically obtain the timestamps of the first and last two business data in the first database, as well as the first number of business data stored in the first database;

[0074] Step S320: Query the second database to find the second number of business data within the time range corresponding to the timestamps of the first and last data entries;

[0075] Step S330: If the first number is greater than the second number, then the missing data in the second database is determined, and the missing data is resynchronized from the first database to the second database; or, the business data within the time range corresponding to the timestamps of the first and last data in the first database is resynchronized to the second database.

[0076] In specific implementation, a timed monitoring strategy can be implemented to monitor the consistency of data in the first and second databases. Specifically, at preset time intervals, the timestamps of the first and last business data entries in the first database, as well as the first number of business data entries stored in the first database, are periodically obtained. It is understood that since the business data in the second database is synchronized from the first database, and the data volume in the first database is much smaller than that in the second database, the business data in the first database can be considered as the consistency comparison benchmark. The time range corresponding to the timestamps of the first and last business data entries in the first database is used as the time range of the business data for consistency comparison. Business data within this time range is determined from the second database, and a second number of business data entries within this time range is calculated. Further, by comparing the first and second numbers, if the first number is greater than the second number, it indicates that not all business data in the first database has been synchronized to the second database, and there is missing data. Therefore, by comparing the business data within the time range in the first and second databases, the missing data in the second database can be determined, and the missing data can be resynchronized to the second database. Alternatively, all business data within the time range in the first database can be directly resynchronized to the second database. During the synchronization process, if duplicate business data exists, only one of the duplicate business data is retained.

[0077] In this embodiment, the number of business data in the first database and the second database within the same time range is compared periodically. If they are inconsistent, the synchronization operation of business data from the first database to the second database is performed again to ensure the consistency of business data between the second database and the first database, as well as the integrity of business data in the second database.

[0078] In an exemplary embodiment, the above method further includes a method for querying business data, which specifically includes the following steps:

[0079] Step S410: Receive a data query command;

[0080] Step S420: When the data query instruction carries query parameters, query the first database or the second database according to the query parameters to obtain the corresponding query data.

[0081] Among them, query parameters can be divided into parameters with real-time requirements (e.g., the number of business data) and parameters with no real-time requirements or low real-time requirements, such as query time.

[0082] In practical implementation, when a data query command carries query parameters, the database to be queried can be determined based on the nature of the query parameters. For example, if the query parameter is a query time with low real-time requirements, the database to be queried can be determined according to the query time, and the corresponding query data can be obtained. More specifically, the timestamp carried by the business data can determine the time corresponding to the business data stored in the first and second databases. Therefore, it can be determined whether to query the first or second database based on the query time. The query principle is that if the query time is closer to the current time, the first database is queried; if the query time is farther from the current time, the second database is queried.

[0083] In another exemplary embodiment, step S420 further includes: when the query parameter is a parameter with real-time requirements, querying the first database to obtain the corresponding query data.

[0084] Specifically, taking the query parameter of business data ID as an example, the first database provides a separate storage area for business data IDs. Suppose you want to query whether the ID of newly generated business data is duplicated with the ID of previously generated business data. Since there might be a case where a business data ID has just been stored in the first database and has not yet been synchronized to the second database, querying the first database directly will yield more accurate results when querying parameters with real-time requirements, such as business data IDs. However, for query parameters that do not have real-time requirements or have lower real-time requirements, such as daily resource transfer values, the impact of adding or subtracting a single data entry is relatively small. In this case, the second database, with its larger and more complete data set, can be queried.

[0085] In the above embodiments, when the data query instruction carries query parameters, the system determines whether to query the first database or the second database based on the real-time requirements of the query parameters, so as to ensure the accuracy and reliability of the query results.

[0086] In one exemplary embodiment, the above-mentioned method for querying business data further includes:

[0087] Step S430: When the data query instruction does not carry query parameters, obtain the synchronization rate of business data from the first database to the second database;

[0088] Step S440: Based on the synchronization rate, determine the database to be queried from the first database and the second database, and obtain the corresponding query data.

[0089] The synchronization rate can be understood as the frequency at which business data in the first database is synchronized to the second database. For example, the synchronization rate is once per second or once per millisecond.

[0090] In practical implementation, when a data query command does not carry query parameters, the system can determine whether to query the first or second database based on the synchronization rate of business data from the first database to the second database. More specifically, the database to be queried can be determined by the condition that a higher synchronization rate tends to favor querying the second database, and a lower synchronization rate tends to favor querying the first database.

[0091] Further, in an exemplary embodiment, step S440, based on the synchronization rate, determines the database to be queried from the first database and the second database, and retrieves the corresponding query data, including:

[0092] Step S4401: If the synchronization rate is greater than the first threshold, then query the second database to obtain the corresponding query data;

[0093] Step S4402: If the synchronization rate is less than the second threshold, then query the first database to obtain the corresponding query data;

[0094] Step S4403: If the synchronization rate is greater than the second threshold and less than the first threshold, then query the first database or the second database to obtain the corresponding query data.

[0095] In practical implementation, if the synchronization rate of business data from the first database to the second database is greater than the first threshold (e.g., milliseconds or seconds), whenever new business data is stored in the first database, it will be synchronized to the second database at the same rate. In this case, the second database effectively contains all the business data stored in the first database, providing more comprehensive data. Therefore, under these conditions, when a data query command is received, the second database with more complete data can be queried directly. Conversely, if the synchronization rate is less than the second threshold (e.g., once a day), when new business data is stored in the first database, it takes a day to synchronize to the second database. In this case, the second database will lack the most recent day's business data. Therefore, under these conditions, when a data query command is received, the first database, which has higher real-time performance, should be queried. If the synchronization rate is greater than the second threshold but less than the first threshold, the query can be performed on either the first or second database to obtain the corresponding query data.

[0096] In the above embodiments, when the data query instruction does not carry query parameters, the database to be queried is determined based on the synchronization rate of business data from the first database to the second database. The higher the synchronization rate, the more likely it is to query the second database, and the lower the synchronization rate, the more likely it is to query the first database. This achieves a reasonable allocation of data query strategies, thereby improving the efficiency of business data query and the accuracy of query results.

[0097] In one exemplary embodiment, the first database employs an online transaction processing scheme, and the second database employs an online analytical processing scheme.

[0098] Online Transaction Processing (OLTP) is the main application of traditional relational databases, primarily for basic, routine transaction processing, recording real-time additions, deletions, modifications, and queries.

[0099] Online Analytical Processing (OLAP) supports complex analytical operations and provides intuitive and easy-to-understand query results.

[0100] This disclosure implements a hierarchical management system for business data. A first database stores business data that is more recent and less voluminous, while a second database stores business data that is more recent and more voluminous. Based on the characteristics of the data in the first database, an Online Transaction Processing (OLTP) scheme is adopted to provide transaction support for the business data. Based on the characteristics of the data in the second database, an Online Analytical Processing (OLAP) scheme is adopted to provide massive data storage and concurrent queries for complex queries. This overall architecture, employing different implementation schemes for different data layers, effectively balances the needs for massive data storage, complex queries, high-concurrency queries, and support for rapidly updated business data, while improving database maintenance efficiency.

[0101] In an exemplary embodiment, specific examples will be described below in conjunction with the accompanying drawings to facilitate understanding of the embodiments of this disclosure by those skilled in the art.

[0102] Taking financial data as an example of business data, the analysis of this business reveals a strong correlation between the stability of financial data and time. Therefore, a layered data storage structure is constructed with time as the dimension. Different technical solutions are used for different layers of data to meet different requirements. The upper layer of data needs transaction capabilities to support the updating of data sources and to provide strong consistency in data acquisition capabilities, while the lower layer of data needs to provide massive data storage and high-concurrency multi-dimensional complex query and analysis capabilities.

[0103] refer to Figure 4 This is a schematic diagram illustrating a framework for implementing a business data processing method according to an exemplary embodiment. Business data that is more recent and fresher is stored as upper-layer data in a first database, while business data that is older is stored as lower-layer data in a second database, and so on. Figure 5 As shown, an event synchronization mechanism can be set to synchronize the business data in the first database to the second database when the synchronization condition is triggered by the business data in the first database. For example, when the storage time of new business data in the first database reaches a preset duration, or when the current time reaches a preset synchronization time point, the business data in the first database will be synchronized to the second database, thereby ensuring the synchronization of upper-layer data and lower-layer data.

[0104] Simultaneously, consistency between the data in the first and second databases can be ensured through asynchronous data comparison between the first and second databases. Specifically, a timed monitoring strategy can be implemented to monitor the consistency of data between the first and second databases. This involves periodically acquiring the timestamps of the first and last business data entries in the first database, as well as the first number of business data entries stored in the first database, at preset time intervals. Then, the second database is queried for the second number of business data entries within the time range corresponding to the timestamps of the first and last data entries. If the first number is greater than the second number, it indicates that not all business data in the first database has been synchronized to the second database. In this case, missing data in the second database can be identified, and the missing data can be resynchronized from the first database to the second database. Alternatively, the business data within the time range corresponding to the timestamps of the first and last data entries in the first database can be resynchronized to the second database. This ensures the consistency and integrity of the business data between the second and first databases.

[0105] Compared to traditional solutions, the main advantage of the solution disclosed herein lies in its ability to control data at each layer within an appropriate range by introducing a hierarchical data management component. This provides transactional consistency capabilities for upper-layer data in a single-table format, thereby maximizing the utilization of database resources. Furthermore, based on the characteristics of the upper-layer data, an Online Transaction Processing (OLTP) solution can be adopted; based on the characteristics of the lower-layer data, an Online Analytical Processing (OLAP) solution can be adopted. The resulting overall architecture is highly adaptable to the transactional requirements of rapidly updated business data, massive storage, complex queries, and high concurrency.

[0106] The business data management method provided in this embodiment manages business data in layers based on business characteristics, adopts different implementation schemes for different layers of data, and introduces a layer manager to dynamically maintain the capacity of upper-layer data. The application layer can maintain upper-layer data, taking into account the characteristics of massive data storage, concurrent queries of complex queries, and transaction support for business data. While taking into account the advantages of traditional solutions, it provides an engineering method with higher database resource utilization and maintenance efficiency.

[0107] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0108] It is understood that the same / similar parts between the various embodiments of the methods described above in this specification can be referred to each other. Each embodiment focuses on the differences from other embodiments, and relevant parts can be referred to the description of other method embodiments.

[0109] Based on the same inventive concept, this disclosure also provides a business data processing apparatus for implementing the business data processing method described above.

[0110] Figure 6 This is a structural block diagram illustrating a business data processing apparatus according to an exemplary embodiment. (Refer to...) Figure 6 The device includes: a storage unit 610, a deletion unit 620, and a synchronization unit 630, wherein,

[0111] Storage unit 610 is configured to execute a storage instruction for new business data and store the new business data in the first database.

[0112] Deletion unit 620 is configured to delete target business data in the first database when the amount of data after adding new business data to the first database exceeds the data volume threshold; the target business data is stored earlier than other business data in the first database, and the other business data is data in the first database other than the target business data.

[0113] Synchronization unit 630 is configured to synchronize new business data from the first database to the second database when new business data triggers preset synchronization conditions.

[0114] In an exemplary embodiment, the business data stored in the first database and the second database carries a timestamp; the synchronization unit 630 is further configured to periodically acquire the timestamps of the first and last business data in the first database, and the first number of business data stored in the first database; query the second database for the second number of business data within the time range corresponding to the timestamps of the first and last data; if the first number is greater than the second number, determine the missing data in the second database, and resynchronize the missing data from the first database to the second database, or resynchronize the business data within the time range in the first database to the second database.

[0115] In an exemplary embodiment, the apparatus further includes a query unit configured to execute a data query instruction; when the data query instruction carries query parameters, the unit queries a first database or a second database according to the query parameters to obtain the corresponding query data.

[0116] In an exemplary embodiment, the query unit is further configured to, when the data query instruction does not carry query parameters, obtain the synchronization rate of business data from the first database to the second database; based on the synchronization rate, determine the database to be queried from the first database and the second database, and query the corresponding query data.

[0117] In an exemplary embodiment, the query unit is further configured to perform the following actions: if the synchronization rate is greater than a first threshold, query the second database to obtain the corresponding query data; if the synchronization rate is less than the second threshold, query the first database to obtain the corresponding query data; if the synchronization rate is greater than the second threshold and less than the first threshold, query either the first database or the second database to obtain the corresponding query data.

[0118] In an exemplary embodiment, the query unit is further configured to query the first database to obtain the corresponding query data when the query parameter is a parameter with real-time requirements.

[0119] In one exemplary embodiment, the first database employs an online transaction processing scheme, and the second database employs an online analytical processing scheme.

[0120] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0121] Figure 7 This is a block diagram illustrating an electronic device 700 for implementing a business data processing method according to an exemplary embodiment. For example, the electronic device 700 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0122] Reference Figure 7 The electronic device 700 may include one or more of the following components: processing component 702, memory 704, power supply component 706, multimedia component 708, audio component 710, input / output (I / O) interface 712, sensor component 714, and communication component 716.

[0123] Processing component 702 typically controls the overall operation of electronic device 700, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 702 may include one or more modules to facilitate interaction between processing component 702 and other components. For example, processing component 702 may include a multimedia module to facilitate interaction between multimedia component 708 and processing component 702.

[0124] Memory 704 is configured to store various types of data to support the operation of electronic device 700. Examples of such data include instructions for any application or method operating on electronic device 700, contact data, phonebook data, messages, pictures, videos, etc. Memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, optical disk, or graphene memory.

[0125] Power supply component 706 provides power to various components of electronic device 700. Power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 700.

[0126] Multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 708 includes a front-facing camera and / or a rear-facing camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0127] Audio component 710 is configured to output and / or input audio signals. For example, audio component 710 includes a microphone (MIC) configured to receive external audio signals when electronic device 700 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 704 or transmitted via communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.

[0128] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0129] Sensor assembly 714 includes one or more sensors for providing state assessments of various aspects of electronic device 700. For example, sensor assembly 714 can detect the on / off state of electronic device 700, the relative positioning of components such as the display and keypad of electronic device 700, changes in position of electronic device 700 or its components, the presence or absence of user contact with electronic device 700, orientation or acceleration / deceleration of device 700, and temperature changes of electronic device 700. Sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 714 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0130] Communication component 716 is configured to facilitate wired or wireless communication between electronic device 700 and other devices. Electronic device 700 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 716 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 716 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0131] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0132] In one exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, which can be executed by a processor 720 of an electronic device 700 to perform the above-described method. For example, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0133] In one exemplary embodiment, a computer program product is also provided, which includes instructions that can be executed by a processor 720 of an electronic device 700 to perform the above-described method.

[0134] It should be noted that the above-mentioned apparatus, electronic equipment, computer-readable storage medium, computer program product, etc., may also include other implementation methods according to the description of the method embodiments. For specific implementation methods, please refer to the description of the relevant method embodiments, which will not be elaborated here.

[0135] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0136] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A business data processing method, characterized in that, include: In response to a storage instruction for new business data, the new business data is stored in the first database; If the amount of data after adding the new business data to the first database exceeds the data volume threshold, the target business data in the first database is deleted; the storage time of the target business data is earlier than that of other business data in the first database, and the other business data refers to data in the first database other than the target business data. When the new business data triggers a preset synchronization condition, the new business data in the first database is synchronized to the second database; The first database is used to store business data that is more recent than the current time, and the second database is used to store business data that is further back than the current time. The method further includes: receiving a data query instruction; when the data query instruction does not carry query parameters, obtaining the synchronization rate of business data from the first database to the second database; if the synchronization rate is greater than a first threshold, querying the second database to obtain the corresponding query data; if the synchronization rate is less than a second threshold, querying the first database to obtain the corresponding query data; if the synchronization rate is greater than the second threshold and less than the first threshold, querying either the first database or the second database to obtain the corresponding query data.

2. The method according to claim 1, characterized in that, The business data stored in the first database and the second database carries a timestamp; the method further includes: The timestamps of the first and last two business data items in the first database are periodically obtained, as well as the first number of business data items stored in the first database. Query the second database to find the second number of business data within the time range corresponding to the timestamps of the first and last data; If the first number is greater than the second number, then the missing data in the second database is determined, and the missing data is resynchronized from the first database to the second database; or, the business data within the time range in the first database is resynchronized to the second database.

3. The method according to claim 1, characterized in that, The method further includes: When the data query instruction carries query parameters, the first database or the second database is queried according to the query parameters to obtain the corresponding query data.

4. The method according to claim 3, characterized in that, The step of querying the first database or the second database according to the query parameters to obtain the corresponding query data includes: When the query parameter is a parameter with real-time requirements, the first database is queried to obtain the corresponding query data.

5. The method according to claim 3, characterized in that, The step of querying the first database or the second database according to the query parameters to obtain the corresponding query data further includes: When the query parameter is not a parameter with real-time requirements, the second database is queried to obtain the corresponding query data.

6. The method according to claim 1, characterized in that, The preset synchronization condition is that the new business data has been stored in the first database for a preset duration, or the current time reaches a preset synchronization time point.

7. The method according to any one of claims 1-6, characterized in that, The first database uses an online transaction processing scheme, and the second database uses an online analytical processing scheme.

8. A business data processing device, characterized in that, include: The storage unit is configured to execute a storage instruction for new business data and store the new business data in the first database. The deletion unit is configured to delete target business data in the first database when the amount of data after adding the new business data to the first database exceeds a data volume threshold; the target business data is stored earlier than other business data in the first database, and the other business data is data in the first database other than the target business data. The synchronization unit is configured to synchronize the new business data in the first database to the second database when the new business data triggers a preset synchronization condition. The first database is used to store business data that is more recent than the current time, and the second database is used to store business data that is further back than the current time. The query unit is configured to execute a data query instruction. When the data query instruction does not carry query parameters, it obtains the synchronization rate of business data from the first database to the second database. If the synchronization rate is greater than a first threshold, it queries the second database to obtain the corresponding query data. If the synchronization rate is less than a second threshold, it queries the first database to obtain the corresponding query data. If the synchronization rate is greater than the second threshold and less than the first threshold, it queries either the first database or the second database to obtain the corresponding query data.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the business data processing method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the business data processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and related device for realizing data synchronization based on distributed database

    CN114185991A

  • Method and system for synchronization of relational database management system to non-structured query language database

    US20170270137A1