Operation sorting result generation method and device, equipment and storage medium
By identifying and separating interdependencies in database operations, a parallel operation queue is generated, which solves the problem in the existing technology that multiple interdependent table operations cannot be loaded in parallel, and improves the efficiency of database synchronization and data consistency.
Patent Information
- Application Number
- CN202410304516.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2024-08-30
AI Technical Summary
The existing technology cannot implement parallel loading when processing operations between multiple interdependent tables, resulting in low database synchronization efficiency and inability to maximize the loading efficiency of the target library.
By determining the operation-related tables of the target operation, including the belonging table, the dependent table of the belonging table and the dependent table of the belonging table, the insertion queue, update queue and deletion queue are generated, and the operation sorting results are generated according to the insertion situation and the operation queue, and the sequential dependency relationship is eliminated. , to achieve parallel loading of operations.
It improves the parallelism of operation loading and the loading rate of database synchronization, enhances the integrity and consistency of data, and reduces data redundancy.
Smart Images

Figure CN118568087A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a method, device, equipment and storage medium for generating operation sorting results. Background Art
[0002] With the rapid development of informatization, information systems have become the key to maintaining business operations. Enterprises urgently need to improve the availability of information systems, ensure business continuity, and minimize losses caused by disasters or failures.
[0003] The database real-time synchronization system is based on mature relational data models and standard interfaces. It can achieve real-time data synchronization in seconds with very little system overhead. It can be widely used in business areas such as emergency systems, disaster recovery and backup, load balancing, data migration, online maintenance, and multi-business centers.
[0004] In many cases, the source database has multiple interdependent tables with operations interspersed, and the operations obtained from the database log are also operations mixed between multiple interdependent tables. The prior art generally loads the obtained operations mixed between multiple interdependent tables in series in the target database to prevent loading errors caused by incorrect sequence dependencies. In this way, parallel loading cannot be performed when there are interdependent tables, and the maximum loading efficiency cannot be achieved in the target database. This will result in low loading efficiency of the target database when the business volume of some tables in the source database is large, resulting in excessive synchronization delay. Summary of the invention
[0005] The present invention provides a method, device, equipment and storage medium for generating operation sorting results. After sorting, operations mixed between multiple interdependent tables will be distinguished according to the different tables to which the operations belong. In this way, operations belonging to the same table can be gathered and loaded in parallel without considering the dependency relationship, so as to improve the parallelism of operation loading and improve the loading rate in database synchronization.
[0006] According to one aspect of the present invention, a method for generating an operation ranking result is provided, the method comprising:
[0007] Obtain the target operation, and determine the operation-related table corresponding to the target operation, wherein the operation-related table includes a belonging table, a belonging table dependent table, and a belonging table dependent table;
[0008] Generate each operation queue according to the operation related table, wherein the operation queue includes operations of the same operation type;
[0009] The placement status of the target operation is determined according to each operation queue, and the operation sorting result is generated according to the placement status and each operation queue.
[0010] Optionally, determining the operation-related table corresponding to the target operation includes: determining the target table identifier corresponding to the target operation; obtaining a database, wherein the database includes dependency relationships corresponding to each table identifier; matching the target table identifier through the database to obtain a target dependency relationship that matches the target table identifier; and using the belonging table, the belonging table dependent table, and the belonging table dependent table in the target dependency relationship as operation-related tables.
[0011] Optionally, each operation queue is generated according to the operation-related table, including: taking each table in the operation-related table as the target table in turn; obtaining each operation contained in the target table, and determining the operation type corresponding to each operation, wherein the operation type includes an insert operation, an update operation, and a delete operation; and grouping each operation according to the operation type to generate each operation queue.
[0012] Optionally, the placement status of the target operation is determined according to each operation queue, including: obtaining the target primary key column data corresponding to the target operation, and determining the target operation type corresponding to the target operation; determining the comparison primary key column data according to the target operation type; judging whether the target primary key column data and the comparison primary key column data have the same data, and if so, determining that the placement status is that placement cannot be sorted; otherwise, determining that the placement status is that placement can be sorted.
[0013] Optionally, determining the comparison primary key column data based on the target operation type includes: judging whether the target operation type is a delete operation, and if so, using the insert queue and update queue corresponding to the corresponding table as the first target queue, and using the primary key column data of each operation in the first target queue as the comparison primary key column data; otherwise, using the delete queue corresponding to the corresponding table as the second target queue, and using the primary key column data of each operation in the second target queue as the comparison primary key column data.
[0014] Optionally, an operation sorting result is generated based on the placement situation and each operation queue, including: determining whether the placement situation is suitable for placement and sorting, and if so, determining a third target queue corresponding to the target operation according to the target operation type, placing the target operation into the third target queue to generate each updated operation queue, and determining the number of operations in the updated third target queue, and generating an operation sorting result based on the number of operations; otherwise, directly extracting each operation queue according to a preset extraction rule to generate each first sorting operation queue, deleting the primary key column data in each first sorting operation queue, and extracting the operations in each first sorting operation queue in turn to generate an operation sorting result.
[0015] Optionally, generating operation sorting results based on the number of operations, including: when the number of operations reaches a preset sorting number limit, extracting each updated operation queue according to a preset extraction rule to generate each second sorting operation queue; deleting the primary key column data in each second sorting operation queue; and using each second sorting operation queue as the operation sorting result.
[0016] According to another aspect of the present invention, there is provided an operation ranking result generating device, the device comprising:
[0017] A target operation and related table acquisition module is used to acquire the target operation and determine the operation related table corresponding to the target operation, wherein the operation related table includes a belonging table, a belonging table dependent table and a belonging table dependent table;
[0018] An operation queue generation module, used to generate each operation queue according to the operation related table, wherein the operation queue includes operations of the same operation type;
[0019] The operation sorting result generating module is used to determine the placement status of the target operation according to each operation queue, and generate the operation sorting result according to the placement status and each operation queue.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] at least one processor; and
[0022] a memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute an operation sorting result generating method described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement an operation sorting result generating method described in any embodiment of the present invention when executed.
[0025] The technical solution of the embodiment of the present invention determines the operation-related tables corresponding to the target operation, including the belonging table, the belonging table dependent table and the belonging table dependent table, and establishes an insert queue, an update queue and a delete queue for each operation-related table to store operations of different operation types. Finally, the placement of the target operation is determined according to each operation queue to extract the sequential operations from each operation queue to generate an operation sorting result, thereby improving the integrity and consistency of the data and reducing data redundancy. There is no sequential dependency in the operation sorting result, thereby improving the parallelism of operation loading and improving the loading rate in database synchronization.
[0026] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 is a flowchart of a method for generating operation sorting results according to Embodiment 1 of the present invention;
[0029] Figure 2 is a flowchart of another method for generating operation sorting results provided according to the first embodiment of the present invention;
[0030] Figure 3 is a flowchart of another method for generating operation sorting results provided according to Embodiment 2 of the present invention;
[0031] Figure 4 is a schematic diagram of a dependency relationship between tables provided according to Embodiment 2 of the present invention;
[0032] Figure 5 is a structural diagram of an operation ranking result generating device provided according to Embodiment 3 of the present invention;
[0033] Figure 6 It is a structural schematic diagram of an electronic device for implementing a method for generating operation ranking results according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0036] Embodiment 1
[0037] Figure 1 A flowchart of a method for generating an operation sorting result is provided for the first embodiment of the present invention. This embodiment is applicable to the case of sorting operations in a database synchronization environment. The method can be executed by an operation sorting result generating device. The operation sorting result generating device can be implemented in the form of hardware and / or software. The operation sorting result generating device can be configured in a computer controller. Figure 1 As shown, the method includes:
[0038] S110: Acquire a target operation, and determine an operation-related table corresponding to the target operation, wherein the operation-related table includes a belonging table, a belonging table dependent table, and a belonging table dependent table.
[0039] The target operation refers to the table operation that the user is performing on the table in the database. Table operations include insert operation, update operation and delete operation. Insert operation refers to inserting new data rows into the table, update operation refers to modifying existing data rows in the table, and delete operation refers to deleting data rows from the table. Operation-related tables refer to tables in the database that are associated with the target operation, including the belonging table, the belonging table dependent table and the belonging table dependent table. The belonging table refers to the table in the database to which the target operation belongs. The belonging table dependent table refers to the table in which the values of certain columns in the belonging table depend on the values of certain columns in other tables. The belonging table dependent table refers to the table in which the values of certain columns in the belonging table depend on the values of certain columns in other tables.
[0040] Optionally, determining the operation-related table corresponding to the target operation includes: determining the target table identifier corresponding to the target operation; obtaining a database, wherein the database includes dependency relationships corresponding to each table identifier; matching the target table identifier through the database to obtain a target dependency relationship that matches the target table identifier; and using the belonging table, the belonging table dependent table, and the belonging table dependent table in the target dependency relationship as operation-related tables.
[0041] Specifically, the controller determines the target table identifier involved in the target operation and obtains the database, which includes the dependency relationships corresponding to each table identifier, and these dependency relationships describe the associations and constraints between tables. The target table identifier can be matched through the database to obtain the target dependency relationship matching the table identifier, that is, to query the table to which the target operation belongs, all tables that the table depends on, and all tables that depend on the table.
[0042] S120: Generate various operation queues according to the operation-related table, wherein the operation queues include operations of the same operation type.
[0043] Specifically, various operation queues may be generated according to the operation-related table. The operation queues include operations of the same operation type, such as insert, update, and delete. By putting operations of the same type together, it is convenient to process and sort subsequent operations.
[0044] Optionally, each operation queue is generated according to the operation-related table, including: taking each table in the operation-related table as the target table in turn; obtaining each operation contained in the target table, and determining the operation type corresponding to each operation, wherein the operation type includes an insert operation, an update operation, and a delete operation; and grouping each operation according to the operation type to generate each operation queue.
[0045] Specifically, the controller will create three operation queues for each operation-related table obtained, storing insert operations, update operations, and delete operations respectively. Specifically, this can be done by looping through the operation-related tables, and then taking each table in the operation-related tables as the target table in turn. Further, the controller will obtain each operation contained in the target table. Specifically, these operations can be obtained by querying the log or transaction information of the target table. After obtaining each operation contained in the target table, the operation type of each operation needs to be determined. The operation types include insert operations, update operations, and delete operations. Specifically, the operation type can be determined by analyzing the semantics and context of the operation. For example, if the operation is to insert a new record into the table, then it is an insert operation; if the operation is to modify an existing record in the table, then it is an update operation; if the operation is to delete one or more records from the table, then it is a delete operation. Finally, the controller will group each operation according to the operation type, and by adding operations of the same operation type to the corresponding operation queue, each operation queue can be generated, and each operation queue contains operations of the same operation type.
[0046] S130 , determining the placement status of the target operation according to each operation queue, and generating an operation sorting result according to the placement status and each operation queue.
[0047] The placement condition refers to whether the target operation can be placed in the existing operation being sorted. The operation sorting results are arranged according to the priority and order of the operations so that they can be performed in the correct order. This can improve the efficiency and accuracy of database operations and avoid unnecessary errors and conflicts.
[0048] Figure 2 A flowchart of a method for generating an operation ranking result is provided for the first embodiment of the present invention. Step S130 mainly includes the following steps S131 to S136:
[0049] S131. Acquire target primary key column data corresponding to the target operation, and determine the target operation type corresponding to the target operation.
[0050] Specifically, the controller will make the following judgments based on the target operation type: if the operation is an insert operation, it is necessary to judge whether the primary key column data of the operation is equal to the primary key column data of all operations in the delete queue of the table to which it belongs; if the operation is an update operation, it is necessary to judge whether the primary key column data of the operation is equal to the primary key column data of all operations in the delete queue of the table to which it belongs; if the operation is a delete operation, it is necessary to judge whether the primary key column data of the operation is equal to the primary key column data of all operations in the insert queue and update queue of the table to which it belongs. The controller refers to the computer controller that is sorting database operations.
[0051] S132. Determine the primary key column data for comparison according to the target operation type.
[0052] Optionally, determining the comparison primary key column data based on the target operation type includes: judging whether the target operation type is a delete operation, and if so, using the insert queue and update queue corresponding to the corresponding table as the first target queue, and using the primary key column data of each operation in the first target queue as the comparison primary key column data; otherwise, using the delete queue corresponding to the corresponding table as the second target queue, and using the primary key column data of each operation in the second target queue as the comparison primary key column data.
[0053] Specifically, if the target operation is a delete operation, the controller will use the insert queue and update queue corresponding to the table as the first target queue, and use the primary key column data of each operation in the first target queue as the comparison primary key column data. If the target operation is not a delete operation, the controller will use the delete queue corresponding to the table as the second target queue, and use the primary key column data of each operation in the second target queue as the comparison primary key column data.
[0054] S133, determine whether the target primary key column data and the comparison primary key column data have the same data, if so, execute S134, otherwise, execute S135.
[0055] S134, determining that the placement situation is unable to be placed in the sorting.
[0056] S135, determining that the placement status is suitable for placement sorting.
[0057] S136: Generate operation sorting results according to the placement status and each operation queue.
[0058] Specifically, it is determined whether the target primary key column data and the comparison primary key column data have the same data, which can be achieved by comparing the key values of the target primary key column data and the comparison primary key column data. If the target primary key column data and the comparison primary key column data have the same data, it is determined that the placement situation cannot be placed and sorted. This is because if the target primary key column data already exists in the target table, the same data cannot be placed in the target table again. If the target primary key column data and the comparison primary key column data do not have the same data, it is determined that the placement situation can be placed and sorted. This is because if the target primary key column data does not exist in the target table, it can be placed in the target table and sorted according to the sorting rules in the target table.
[0059] The technical solution of the embodiment of the present invention determines the operation-related tables corresponding to the target operation, including the belonging table, the belonging table dependent table and the belonging table dependent table, and establishes an insert queue, an update queue and a delete queue for each operation-related table to store operations of different operation types. Finally, the placement of the target operation is determined according to each operation queue to extract the sequential operations from each operation queue to generate an operation sorting result, thereby improving the integrity and consistency of the data and reducing data redundancy. There is no sequential dependency in the operation sorting result, thereby improving the parallelism of operation loading and improving the loading rate in database synchronization.
[0060] Embodiment 2
[0061] Figure 3 This is a flowchart of a method for generating operation sorting results provided by Embodiment 2 of the present invention. This embodiment adds a specific process for generating operation sorting results according to the placement conditions and each operation queue on the basis of Embodiment 1. Among them, the specific contents of steps S210-S220 are roughly the same as steps S110-S120 in Embodiment 1, so they will not be repeated in this embodiment. Figure 3 As shown, the method includes:
[0062] S210: Acquire a target operation, and determine an operation-related table corresponding to the target operation, wherein the operation-related table includes a belonging table, a belonging table dependent table, and a belonging table dependent table.
[0063] Optionally, determining the operation-related table corresponding to the target operation includes: determining the target table identifier corresponding to the target operation; obtaining a database, wherein the database includes dependency relationships corresponding to each table identifier; matching the target table identifier through the database to obtain a target dependency relationship that matches the target table identifier; and using the belonging table, the belonging table dependent table, and the belonging table dependent table in the target dependency relationship as operation-related tables.
[0064] S220: Generate each operation queue according to the operation-related table, wherein the operation queue includes operations of the same operation type.
[0065] Optionally, each operation queue is generated according to the operation-related table, including: taking each table in the operation-related table as the target table in turn; obtaining each operation contained in the target table, and determining the operation type corresponding to each operation, wherein the operation type includes an insert operation, an update operation, and a delete operation; and grouping each operation according to the operation type to generate each operation queue.
[0066] S230: Determine the placement status of the target operation according to each operation queue.
[0067] Optionally, the placement status of the target operation is determined according to each operation queue, including: obtaining the target primary key column data corresponding to the target operation, and determining the target operation type corresponding to the target operation; determining the comparison primary key column data according to the target operation type; judging whether the target primary key column data and the comparison primary key column data have the same data, and if so, determining that the placement status is that placement cannot be sorted; otherwise, determining that the placement status is that placement can be sorted.
[0068] Optionally, determining the comparison primary key column data based on the target operation type includes: judging whether the target operation type is a delete operation, and if so, using the insert queue and update queue corresponding to the corresponding table as the first target queue, and using the primary key column data of each operation in the first target queue as the comparison primary key column data; otherwise, using the delete queue corresponding to the corresponding table as the second target queue, and using the primary key column data of each operation in the second target queue as the comparison primary key column data.
[0069] S240, determine whether the placement situation is suitable for placement sorting, if so, execute S250, otherwise, execute S260.
[0070] S250, determining a third target queue corresponding to the target operation according to the target operation type, placing the target operation into the third target queue to generate each updated operation queue, determining the number of operations in the updated third target queue, and generating an operation sorting result according to the number of operations.
[0071] Specifically, if the placement condition of the target operation is that it can be placed in the sorting, a third target queue corresponding to the target operation is determined according to the target operation type, and the target operation is placed in the third target queue to generate each updated operation queue. For example, if the target operation type is an update operation, the target operation is placed in the update queue of the corresponding table to generate an updated update queue.
[0072] Optionally, generating operation sorting results based on the number of operations, including: when the number of operations reaches a preset sorting number limit, extracting each updated operation queue according to a preset extraction rule to generate each second sorting operation queue; deleting the primary key column data in each second sorting operation queue; and using each second sorting operation queue as the operation sorting result.
[0073] Specifically, when the number of operations reaches the preset sorting quantity limit, each updated operation queue can be extracted according to the preset extraction rules to generate each second sorting operation queue. For example, if the preset sorting quantity limit is 50, when the updated operation queue reaches 50 operations, the controller will extract operations from the updated operation queue according to the preset extraction rules for sorting to generate a second sorting operation queue. Exemplarily, the preset extraction rules can be the insert queue of the dependent table, the update queue of the dependent table, the insert queue of the dependent table, the update queue of the dependent table, the delete queue of the dependent table, and the delete queue of the dependent table. After extracting all operations, the controller will clear the primary key column data in each second sorting operation queue. Finally, the controller will use the generated second sorting operation queues as the operation sorting results. The operation sorting results can be saved in a preset storage address and displayed to the user through the user terminal when the user needs it. It should be noted that the preset sorting quantity limit and the preset extraction rules can be adjusted according to specific needs.
[0074] S260: directly extract each operation queue according to the preset extraction rule to generate each first sorting operation queue, delete the primary key column data in each first sorting operation queue, and extract the operations in each first sorting operation queue in sequence to generate an operation sorting result.
[0075] Specifically, when the placement of the target operation is not allowed to be sorted, the controller will directly extract each operation queue according to the preset extraction rules to generate each first sorting operation queue, delete the primary key column data in each first sorting operation queue, and extract the operations in each first sorting operation queue in turn to generate the operation sorting result. After the current operation queue is sorted and cleared, the target operation is placed in the queue and waits for the subsequent operation to be sorted.
[0076] Specific application scenarios: Figure 4 A schematic diagram of the dependency relationship between tables is provided for the second embodiment of the present invention; Figure 4There are three tables in the table, namely table A, table B and table C, and the dependency relationship is that table C depends on table B, and table B depends on table A. Table A, table B and table C have three queues, namely insert queue, update queue and delete queue. When the operations are taken out in sequence, the order of the queues is: insert queue of table A, update queue of table A, insert queue of table B, update queue of table B, insert queue of table C, update queue of table C, delete queue of table C, delete queue of table B, delete queue of table A.
[0077] In a specific implementation, the following operations are sorted: insert operation 1 of table A, insert operation 1 of table B, insert operation 1 of table C, insert operation 2 of table A, insert operation 2 of table B, insert operation 2 of table C, insert operation 3 of table A, insert operation 3 of table B, insert operation 3 of table C, insert operation 4 of table A, insert operation 4 of table B, and insert operation 4 of table C.
[0078] It should be noted that due to the dependency restrictions between the three tables, insert operation 1 of table A needs to be loaded before insert operation 1 of table B, and insert operation 1 of table B needs to be loaded before insert operation 1 of table C. The dependencies of other operations are similar. In this way, the three operations have a sequential dependency relationship and can only be loaded in series but not in parallel.
[0079] In a specific implementation, the sorted operations are: insert operation 1 of table A, insert operation 2 of table A, insert operation 3 of table A, insert operation 4 of table A, insert operation 1 of table B, insert operation 2 of table B, insert operation 3 of table B, insert operation 4 of table B, insert operation 1 of table C, insert operation 2 of table C, insert operation 3 of table C, insert operation 4 of table C.
[0080] It should be noted that the operations of different tables are grouped together after sorting, such as insert operation 1 of table A, insert operation 2 of table A, insert operation 3 of table A, and insert operation 4 of table A. At this time, these four operations have no sequential dependency and can be loaded in parallel, thereby improving the loading rate.
[0081] The technical solution of the embodiment of the present invention determines the operation-related tables corresponding to the target operation, including the belonging table, the belonging table dependent table and the belonging table dependent table, and establishes an insert queue, an update queue and a delete queue for each operation-related table to store operations of different operation types. Finally, the placement of the target operation is determined according to each operation queue to extract the sequential operations from each operation queue to generate an operation sorting result, thereby improving the integrity and consistency of the data and reducing data redundancy. There is no sequential dependency in the operation sorting result, thereby improving the parallelism of operation loading and improving the loading rate in database synchronization.
[0082] Embodiment 3
[0083] Figure 5 This is a schematic diagram of the structure of an operation ranking result generating device provided by Embodiment 3 of the present invention. Figure 5 As shown, the device includes: a target operation and related table acquisition module 310, which is used to acquire the target operation and determine the operation related table corresponding to the target operation, wherein the operation related table includes a belonging table, a belonging table dependent table and a belonging table dependent table;
[0084] An operation queue generating module 320, configured to generate each operation queue according to the operation related table, wherein the operation queue includes operations of the same operation type;
[0085] The operation sorting result generating module 330 is used to determine the placement status of the target operation according to each operation queue, and generate the operation sorting result according to the placement status and each operation queue.
[0086] Optionally, the target operation and related table acquisition module 310, the operation related table acquisition unit, is used to: determine the target table identifier corresponding to the target operation; obtain a database, wherein the database includes dependency relationships corresponding to each table identifier; match the target table identifier through the database to obtain a target dependency relationship that matches the target table identifier; and use the belonging table, the belonging table dependent table and the belonging table dependent table in the target dependency relationship as operation related tables.
[0087] Optionally, the operation queue generation module 320 is specifically used to: take each table in the operation-related table as the target table in turn; obtain each operation contained in the target table, and determine the operation type corresponding to each operation, where the operation type includes insert operation, update operation and delete operation; group each operation according to the operation type to generate each operation queue.
[0088] Optionally, the operation sorting result generation module 330 specifically includes: an insertion situation determination unit, which is used to: obtain the target primary key column data corresponding to the target operation, and determine the target operation type corresponding to the target operation; determine the comparison primary key column data according to the target operation type; determine whether the target primary key column data and the comparison primary key column data have the same data, and if so, determine that the insertion situation is that the insertion cannot be sorted; otherwise, determine that the insertion situation is that the insertion can be sorted.
[0089] Optionally, the placement situation determination unit specifically includes: a primary key column data comparison determination subunit, which is used to: determine whether the target operation type is a deletion operation, and if so, use the insert queue and update queue corresponding to the corresponding table as the first target queue, and use the primary key column data of each operation in the first target queue as the comparison primary key column data; otherwise, use the delete queue corresponding to the corresponding table as the second target queue, and use the primary key column data of each operation in the second target queue as the comparison primary key column data.
[0090] Optionally, the operation sorting result generating module 330 specifically includes: an operation sorting result generating unit, used to: determine whether the placement situation is suitable for placement sorting, and if so, determine the third target queue corresponding to the target operation according to the target operation type, place the target operation into the third target queue to generate each updated operation queue, and determine the number of operations in the updated third target queue, and generate the operation sorting result according to the number of operations; otherwise, directly extract each operation queue according to the preset extraction rules to generate each first sorting operation queue, delete the primary key column data in each first sorting operation queue, and extract the operations in each first sorting operation queue in turn to generate the operation sorting result.
[0091] Optionally, the operation sorting result generating unit specifically includes: an operation sorting result generating sub-unit, used to: when the number of operations reaches a preset sorting number limit, extract each updated operation queue according to a preset extraction rule to generate each second sorting operation queue; delete the primary key column data in each second sorting operation queue; and use each second sorting operation queue as the operation sorting result.
[0092] The technical solution of the embodiment of the present invention determines the operation-related tables corresponding to the target operation, including the belonging table, the belonging table dependent table and the belonging table dependent table, and establishes an insert queue, an update queue and a delete queue for each operation-related table to store operations of different operation types. Finally, the placement of the target operation is determined according to each operation queue to extract the sequential operations from each operation queue to generate an operation sorting result, thereby improving the integrity and consistency of the data and reducing data redundancy. There is no sequential dependency in the operation sorting result, thereby improving the parallelism of operation loading and improving the loading rate in database synchronization.
[0093] An operation ranking result generating device provided by an embodiment of the present invention can execute an operation ranking result generating method provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.
[0094] Embodiment 4
[0095] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0096] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0097] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0098] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 performs the various methods and processes described above, such as a method for generating an operation sorting result. That is: obtaining a target operation, determining an operation-related table corresponding to the target operation, wherein the operation-related table includes a belonging table, a belonging table dependency table, and a belonging table dependent table; generating each operation queue according to the operation-related table, wherein the operation queue includes operations of the same operation type; determining the placement of the target operation according to each operation queue, and generating an operation sorting result according to the placement and each operation queue.
[0099] In some embodiments, an operation ranking result generating method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the operation ranking result generating method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform an operation ranking result generating method in any other appropriate manner (e.g., by means of firmware).
[0100] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0101] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0102] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0103] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0104] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0105] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0106] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0107] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating operation sorting results, It is characterized in that include: Acquire a target operation, and determine an operation-related table corresponding to the target operation, wherein the operation-related table includes a belonging table, a belonging table dependent table, and a belonging table dependent table; generating each operation queue according to the operation-related table, wherein the operation queue includes operations of the same operation type; The placement status of the target operation is determined according to each of the operation queues, and an operation sorting result is generated according to the placement status and each of the operation queues.
2. The method according to claim 1, It is characterized in that The determining of the operation-related table corresponding to the target operation includes: Determine a target table identifier corresponding to the target operation; Acquire a database, wherein the database includes dependency relationships corresponding to table identifiers; Matching the target table identifier through the database to obtain a target dependency relationship matching the target table identifier; The belonging table, the belonging table dependent table and the belonging table dependent table in the target dependency relationship are used as the operation-related tables.
3. The method according to claim 2, It is characterized in that The generating each operation queue according to the operation related table includes: Taking each table in the operation-related table as the target table in turn; Acquire each operation contained in the target table, and determine the operation type corresponding to each operation, wherein the operation type includes an insert operation, an update operation, and a delete operation; The operations are grouped according to the operation type to generate operation queues.
4. The method according to claim 1, It is characterized in that Determining the placement of the target operation according to each of the operation queues includes: Acquire target primary key column data corresponding to the target operation, and determine the target operation type corresponding to the target operation; Determine the primary key column data for comparison according to the target operation type; Determine whether the target primary key column data and the comparison primary key column data have the same data, and if so, determine that the placement situation is unable to be placed and sorted; Otherwise, it is determined that the placement situation is suitable for placement sorting.
5. The method according to claim 4, It is characterized in that The determining and comparing primary key column data according to the target operation type includes: Determine whether the target operation type is a delete operation, and if so, use the insert queue and update queue corresponding to the table as the first target queue, and use the primary key column data of each operation in the first target queue as the comparison primary key column data; Otherwise, the deletion queue corresponding to the table is used as the second target queue, and the primary key column data of each operation in the second target queue is used as the comparison primary key column data.
6. The method according to claim 4, It is characterized in that The generating the operation sorting result according to the placement situation and each of the operation queues includes: Determine whether the placement situation is suitable for placement sorting, and if so, determine a third target queue corresponding to the target operation according to the target operation type, place the target operation into the third target queue to generate each updated operation queue, determine the number of operations in the updated third target queue, and generate an operation sorting result according to the number of operations; Otherwise, directly extract each of the operation queues according to the preset extraction rules to generate each first sorting operation queue, delete the primary key column data in each of the first sorting operation queues, and extract the operations in each of the first sorting operation queues in sequence to generate the operation sorting result.
7. The method according to claim 6, It is characterized in that Generating the operation sorting result according to the operation quantity includes: When the number of operations reaches a preset sorting number limit, extracting each of the updated operation queues according to a preset extraction rule to generate each second sorting operation queue; Deleting the primary key column data in each of the second sorting operation queues; Each of the second sorting operation queues is used as the operation sorting result.
8. An operation sorting result generating device, It is characterized in that include: A target operation and related table acquisition module, used to acquire the target operation and determine the operation related table corresponding to the target operation, wherein the operation related table includes a belonging table, a belonging table dependent table and a belonging table dependent table; An operation queue generating module, used for generating each operation queue according to the operation related table, wherein the operation queue includes operations of the same operation type; The operation sorting result generating module is used to determine the placement status of the target operation according to each of the operation queues, and generate the operation sorting result according to the placement status and each of the operation queues.
9. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 7.
10. A computer storage medium, It is characterized in that The computer storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method according to any one of claims 1 to 7 when executed.
