Method and device for processing remote transaction business, and computer-readable storage medium
By analyzing and optimizing the query language of remote transaction data tables, and adding index conditions to improve data splitting efficiency, we solve the problems of slow data splitting and low operating efficiency in remote transaction business, and achieve efficient and low-cost data processing.
Patent Information
- Application Number
- CN202110292952.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2041-03-18
AI Technical Summary
When the existing technology handles off-site transaction business, data splitting is slow, data operation efficiency is low, maintenance costs are high, and uncertainty is high.
By obtaining the off-site transaction data table, analyze the execution speed of the data query task. If it is lower than the preset speed threshold, store the query language in the target data table, and add index conditions according to the preset index rules to split the off-site transaction business data. , to improve data operation efficiency.
It realizes highly automated reporting of remote transaction business, reduces maintenance costs, and improves data operation efficiency and accuracy of maintenance results.
Smart Images

Figure CN113010521B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a method and device for processing remote transaction business, and a computer-readable storage medium. Background Art
[0002] Currently, the China Banking and Insurance Regulatory Commission requires EAST to report the integrity of data exchange flows and related information, so when each province reports EAST data, it is necessary to complete the information of off-site transactions. For example: if a customer opens a card in Province A and trades in Province B, then the customer's transaction information in Province B needs to be synchronized to the transaction information of the data reported by Province A EAST, and the customer information in the customer information table of Province A must also be reflected in the EAST report data of Province B. Completing the off-site transaction information, customer information, and institutional information of each province is what the off-site transaction business needs to accomplish.
[0003] In the related technology, the existing practice for handling off-site transaction business is: 1. Run the head office data first; 2. Split and complete the work directly in the script for splitting provincial data. Among them, when processing the customer table, more than 10 reports such as transactions, accounts, institutions, etc. are associated to obtain an off-site transaction table, and this table is associated to distinguish when splitting. However, this approach has obvious disadvantages, such as the slow execution of off-site SQL data query tasks and the difficulty of SQL optimization and maintenance. In addition, the off-site split transaction mainly uses solidified scripts as the solution. The script must be regularly maintained by developers, which not only has high personnel costs, but also has high uncertainty in maintenance results.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for processing off-site transaction business, and a computer-readable storage medium, so as to at least solve the technical problems in the related art of slow data splitting and low data operation efficiency when splitting off-site data.
[0006] According to one aspect of an embodiment of the present invention, a method for processing off-site transaction business is provided, including: obtaining an off-site transaction data table; analyzing the execution speed of each data query task when performing data query on the off-site transaction data table; if the execution speed is lower than a preset speed threshold, storing the query language corresponding to the data query task in a target data table of a preset database; adding index conditions to the execution conditions of the query language in the target data table according to preset index rules; and splitting the off-site transaction business data by using the attribute identifier corresponding to the query language after adding the index conditions to obtain the transaction data of each region.
[0007] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules includes: determining the primary key data column in the target data table according to the preset index rules, and adding index conditions to the primary key data column; and / or determining the foreign key data column in the target data table according to the preset index rules, and adding index conditions to the foreign key data column.
[0008] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules also includes: obtaining the historical query times of each data column in the target data table, and adding index conditions to the data columns whose historical query times are greater than a first preset time threshold; and / or, obtaining the query range of each data column in the target data table, and adding index conditions to the data columns whose query range is within a specified range.
[0009] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules also includes: obtaining the total number of times each data column in the target data table is used in the preset query statement, and adding index conditions to the data columns whose total number of times used in the preset query statement is greater than a second preset number threshold; and / or, obtaining the total number of occurrences of each field in the target data table that appears after the preset query keyword, and adding index conditions to the fields whose total number of occurrences is greater than the second preset number threshold.
[0010] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules also includes: analyzing the index type corresponding to the fields in the target data table that appear after the execution conditions; if the index type is a composite index, establishing an index according to the frequency of the fields appearing in the execution conditions.
[0011] Optionally, before obtaining the off-site transaction data table, the processing method also includes: encapsulating the structure of the historical query language into a target data structure; if a new script requirement is received, caching the script to be loaded in the new script requirement into the target data structure; if a new query task is received, determining whether the query language corresponding to the new query task is the same as the historical query language; if the same, reading the same data as the historical query language from the language of the target data structure.
[0012] Optionally, after caching the script to be loaded in the new script requirement into the target data structure, the processing method further includes: performing a non-empty check and / or a correctness check on the target data structure, wherein the non-empty check is used to check whether the key value in the target data structure is empty, and the correctness check is used to check whether the execution conditions of the query language are correct.
[0013] Optionally, the step of splitting the off-site transaction business data by adding the attribute identifier corresponding to the query language after the index condition is added to obtain all the transaction data for each region includes: if the attribute identifier starts with a preset character, it is determined that the current business process is an off-site transaction business, and the off-site transaction business data is split to obtain all the transaction data for each region; if the attribute identifier does not start with a preset character, it is determined that the current business process is a normal process business, and there is no need to split the off-site transaction business data.
[0014] According to another aspect of an embodiment of the present invention, a processing device for off-site transaction business is also provided, including: an acquisition unit, used to acquire an off-site transaction data table; an analysis unit, used to analyze the execution speed of each data query task when performing data query on the off-site transaction data table; a storage unit, used to store the query language corresponding to the data query task in a target data table of a preset database when the execution speed is lower than a preset speed threshold; an adding unit, used to add index conditions to the execution conditions of the query language in the target data table according to preset index rules; and a splitting unit, used to split the off-site transaction business data by using the attribute identifier corresponding to the query language after adding the index condition, so as to obtain the transaction data of each region.
[0015] Optionally, the adding unit includes: a first determination module, used to determine the primary key data column in the target data table according to the preset index rule, and add index conditions to the primary key data column; and / or, a second determination module, used to determine the foreign key data column in the target data table according to the preset index rule, and add index conditions to the foreign key data column.
[0016] Optionally, the adding unit also includes: a first acquisition module, used to obtain the historical query times of each data column in the target data table, and add index conditions to the data columns whose historical query times are greater than a first preset time threshold; and / or, a second acquisition module, used to obtain the query range of each data column in the target data table, and add index conditions to the data columns whose query range is within a specified range.
[0017] Optionally, the adding unit also includes: a third acquisition module, used to obtain the total number of times each data column in the target data table is used in a preset query statement, and add index conditions to data columns whose total number of times used in the preset query statement is greater than a second preset number threshold; and / or, a fourth acquisition module, used to obtain the total number of occurrences of each field in the target data table that appears after a preset query keyword, and add index conditions to fields whose total number of occurrences is greater than a second preset number threshold.
[0018] Optionally, the adding unit also includes: a first analysis module, used to analyze the index type corresponding to the field appearing after the execution condition in the target data table; and a first establishment module, used to establish the index according to the frequency of the field appearing in the execution condition when the index type is a composite index.
[0019] Optionally, the processing device also includes: a first encapsulation module, used to encapsulate the structure of the historical query language into a target data structure before obtaining the off-site transaction data table; a first caching module, used to cache the script to be loaded in the new script requirement into the target data structure when a new script requirement is received; a first judgment module, used to judge whether the query language corresponding to the new query task is the same as the historical query language when a new query task is received; and a first reading module, used to read data that is the same as the historical query language from the language of the target data structure when the data is the same.
[0020] Optionally, the processing device also includes: a first verification module, used to perform a non-empty check and / or a correctness check on the target data structure after caching the script to be loaded in the new script requirement into the target data structure, wherein the non-empty check is used to verify whether the key value in the target data structure is empty, and the correctness check is used to verify whether the execution conditions of the query language are correct.
[0021] Optionally, the splitting unit includes: a third determination module, used to determine that the current business process is an off-site transaction business when the attribute identifier starts with preset characters, and split the off-site transaction business data to obtain all transaction data for each region; a fourth determination module, used to determine that the current business process is a normal process business when the attribute identifier does not start with preset characters, and there is no need to split the off-site transaction business data.
[0022] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, wherein the storage medium is used to store a computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located controls the execution of the above-mentioned method for processing cross-regional transaction business.
[0023] In an embodiment of the present invention, a remote transaction data table can be obtained, and then the execution speed of each data query task when performing data query on the remote transaction data table is analyzed. If the execution speed is lower than the preset speed threshold, the query language corresponding to the data query task is stored in the target data table of the preset database, and then according to the preset index rule, the index condition is added to the execution condition of the query language in the target data table. Finally, the remote transaction business data is split by the attribute identifier corresponding to the query language after adding the index condition to obtain the transaction data of each region. In this embodiment, by regularizing the process of remote split transactions and designing business standardization, highly automated reporting of remote transactions is achieved, which greatly improves the efficiency of data operations, and has low maintenance costs, and the maintenance results are effective and accurate, thereby solving the technical problems of slow data splitting and low data operation efficiency when splitting the remote data in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0025] Figure 1 is a flow chart of an optional method for processing a remote transaction business according to an embodiment of the present invention;
[0026] Figure 2 is a schematic diagram of another optional rule assembly engine process based on SQL tuning technology according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of an optional device for processing a remote transaction service according to an embodiment of the present invention; DETAILED DESCRIPTION
[0028] 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.
[0029] 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.
[0030] To facilitate those skilled in the art to understand the present invention, some terms or nouns involved in the embodiments of the present invention are explained below:
[0031] EAST, short for Examination and Analysis System Technology, is an inspection and analysis system with independent intellectual property rights, which aims to meet the development trend of big data and help regulatory authorities improve inspection efficiency. The system includes functional modules such as bank standardized data extraction, on-site inspection project management, data model generation tools, data model publishing and management, etc.
[0032] PG, database (PostgreSQL) is a powerful open source object-relational database system that uses and extends the SQL language and combines many features for secure storage and expansion of the most complex data workloads.
[0033] The MAP data structure is a dictionary data structure used to store unique keys and is a collection of key-value pairs.
[0034] The following embodiments of the present invention involve rapid processing of off-site transaction business data when reporting EAST data. The databases involved in the processing include but are not limited to: PG database, SQL database, etc., through the automatic reporting of off-site split transaction business. Furthermore, the present invention can also solve the problem of too high complexity of configuration items in the prior art and many restrictions on development or users through the SQL tuning rule engine.
[0035] The present invention is described in detail below in conjunction with various embodiments.
[0036] Embodiment 1
[0037] According to an embodiment of the present invention, an embodiment of a method for processing off-site transaction business is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0038] Figure 1 is a flowchart of an optional method for processing a remote transaction service according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0039] Step S102, obtaining a remote transaction data table;
[0040] Step S104, analyzing the execution speed of each data query task when performing data query on the remote transaction data table;
[0041] Step S106, if the execution speed is lower than the preset speed threshold, the query language corresponding to the data query task is stored in the target data table of the preset database;
[0042] Step S108, adding index conditions to the execution conditions of the query language in the target data table according to the preset index rules;
[0043] Step S110, splitting the cross-region transaction business data by adding the attribute identifier corresponding to the query language after the index condition is added, so as to obtain the transaction data of each region.
[0044] Through the above steps, the off-site transaction data table can be obtained, and then the execution speed of each data query task is analyzed when performing data query on the off-site transaction data table. If the execution speed is lower than the preset speed threshold, the query language corresponding to the data query task is stored in the target data table of the preset database, and then according to the preset index rule, the index condition is added to the execution condition of the query language in the target data table. Finally, the off-site transaction business data is split by the attribute identifier corresponding to the query language after adding the index condition to obtain the transaction data of each region. In this embodiment, by regularizing the process of off-site split transactions and designing business standardization, highly automated reporting of off-site transactions is achieved, which greatly improves the efficiency of data operation, and has low maintenance cost, and the maintenance results are effective and accurate, thereby solving the technical problems of slow data splitting and low data operation efficiency when splitting off-site data in related technologies.
[0045] The embodiments of the present invention are described in detail below in combination with the above-mentioned implementation steps.
[0046] Step S102, obtaining the off-site transaction data table.
[0047] In this embodiment, the off-site transaction data table is obtained by associating multiple reports such as transaction information, customer account information, and institution information, wherein the transaction information includes but is not limited to: purchasing physical items (for example, food, clothes, toys, jewelry, etc.), purchasing virtual items (for example, funds, stocks, etc.), transferring money between others, making deposits and withdrawals, etc. Customer account information includes but is not limited to: name, age, mobile phone number, ID number, card number, card type, card age, card level, etc. Institution information includes but is not limited to: issuing bank number, address, telephone number, business information, information on other institutions that have transactions with the card, etc.
[0048] Optionally, before obtaining the off-site transaction data table, the processing method also includes: encapsulating the structure of the historical query language into a target data structure; if a new script requirement is received, caching the script to be loaded in the new script requirement into the target data structure; if a new query task is received, determining whether the query language corresponding to the new query task is the same as the historical query language; if the same, reading the same data as the historical query language from the language of the target data structure.
[0049] In this embodiment, the structure of the historical query language can be encapsulated as a target data structure, and the structure of the historical query language includes but is not limited to: existing SQL rules, etc. The target data structure includes but is not limited to: MAP data structure and other data structures that can be expressed in the form of a dictionary. In the embodiment of the present invention, the object can be used as the KEY of MAP in the form of table name English name_field name English name_script type_script serial number, and the SQL rule can be used as the VALUE value of MAP. Each time a new script is loaded, it will be cached in MAP, and the next time the same rule is queried, it can be directly obtained from the cache, reducing the number of database operations, using space for time, and improving efficiency.
[0050] Optionally, after caching the script to be loaded in the new script requirement into the target data structure, the processing method also includes: performing a non-empty check and / or a correctness check on the target data structure, wherein the non-empty check is used to verify whether the key value in the target data structure is empty, and the correctness check is used to verify whether the execution conditions of the query language are correct.
[0051] In this embodiment, the non-empty check only needs to check whether the VALUE value in the target data structure (for example, MAP) is not empty. The correctness check of the query language can be performed by writing a pre-executed script in the stored procedure, for example:
[0052]
[0053]
[0054] Finally, the corresponding judgment can be made based on the result of the returned @result variable.
[0055] Step S104, analyzing the execution speed of each data query task when performing data query on the remote transaction data table.
[0056] Step S106: if the execution speed is lower than the preset speed threshold, the query language corresponding to the data query task is stored in a target data table of a preset database.
[0057] In this embodiment, all query languages with slow execution speed in data query tasks can be extracted regularly and stored in the target data table of the slow query language in the preset database (for example, real-time table and historical table) to facilitate comparison of optimization results.
[0058] Step S108: adding index conditions to the execution conditions of the query language in the target data table according to the preset index rules.
[0059] In this embodiment, the method for optimizing the slow query language is to automatically add an index: analyze the obtained slow query language, add an index to the execution condition of the slow query language, and then delete the index. This not only improves the query efficiency, but also does not affect the write operation of the database.
[0060] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules includes: determining the primary key data column in the target data table according to the preset index rules, and adding index conditions to the primary key data column; and / or determining the foreign key data column in the target data table according to the preset index rules, and adding index conditions to the foreign key data column.
[0061] In this embodiment, an index is created for the data column defining the primary key, and an index is created for the data column defining the foreign key. An index may also be created for the data column that is frequently queried.
[0062] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules also includes: obtaining the historical query times of each data column in the target data table, and adding index conditions to the data columns whose historical query times are greater than a first preset time threshold; and / or, obtaining the query range of each data column in the target data table, and adding index conditions to the data columns whose query range is within a specified range.
[0063] Another optional step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules also includes: obtaining the total number of times each data column in the target data table is used in the preset query statement, and adding index conditions to the data columns whose total number of times used in the preset query statement is greater than a second preset number threshold; and / or, obtaining the total number of occurrences of each field in the target data table that appears after the preset query keyword, and adding index conditions to the fields whose total number of occurrences is greater than the second preset number threshold.
[0064] In this embodiment, the preset query keywords include but are not limited to: order by, group by, distinct, etc.
[0065] Optionally, the step of adding index conditions to the execution conditions of the query language in the target data table according to preset index rules also includes: analyzing the index type corresponding to the fields in the target data table that appear after the execution conditions; if the index type is a composite index, establishing an index according to the frequency of the fields appearing in the execution conditions.
[0066] In this embodiment, in a composite index, the records can be sorted by the first field first, and for records with the same value in the first field, the system will sort by the value of the second field, and so on. Therefore, only when the first field of the composite index appears in the query condition, the index may be used. Therefore, placing the field with high application frequency in front of the composite index will make the system use this index as much as possible and give full play to the role of the index.
[0067] Step S110, splitting the cross-region transaction business data by adding the attribute identifier corresponding to the query language after the index condition is added, so as to obtain the transaction data of each region.
[0068] Optionally, the step of splitting the off-site transaction business data by adding attribute identifiers corresponding to the query language after the index conditions are added to obtain all the transaction data for each region includes: if the attribute identifier starts with preset characters, it is determined that the current business process is an off-site transaction business, and the off-site transaction business data is split to obtain all the transaction data for each region; if the attribute identifier does not start with preset characters, it is determined that the current business process is a normal process business, and there is no need to split the off-site transaction business data.
[0069] Taking SQL rules as the query language as an example, the remote transaction business is split according to the attribute ID corresponding to the SQL rule. If the ID generated by the SQL rule starts with a lowercase letter A, then the SQL to be assembled is judged to be a remote transaction business that needs to be split. Otherwise, it is regarded as a normal process business and there is no need to split the remote transaction business.
[0070] In this embodiment, the method of splitting the data of remote transaction business by querying the attribute identifier corresponding to the language has high scalability and versatility. If other businesses are added to the remote split business later, it is also applicable. This method circumvents the conditions of business judgment. By inheriting the abstract method, new businesses can be expanded and the business type can be automatically identified. New businesses to be added can be configured in the configuration file. Its abstract method can be implemented by inheriting the abstract class. The newly implemented business type can be injected into the service. It can be injected by name, name = attribute value in the configuration file. The design pattern used in this method is: template design pattern + strategy design pattern.
[0071] Figure 2 FIG. 1 is a schematic diagram of another optional rule assembly engine process based on SQL tuning technology according to an embodiment of the present invention. Figure 2 As shown in the figure, the engine process mainly includes five parts: preliminary basic data preparation, SQL rule acquisition and encapsulation, SQL rule verification, SQL rule tuning, and SQL rule assembly.
[0072] Part 1: Preliminary basic data preparation
[0073] SQL rule data is stored in the database, that is, the SQL structure used as the query condition is imported into the PG database to prepare for subsequent steps.
[0074] Part 2: SQL rule acquisition encapsulation
[0075] Encapsulate the existing SQL rules into a MAP data structure, and then use the object as the KEY of MAP in the form of table name in English_field name in English_script type_script serial number, and use the SQL rule as the VALUE of MAP. Each time a new script is loaded, it will be cached in MAP, and the next time the same rule is queried, it can be directly obtained from the cache, reducing the number of database operations, using space in exchange for time, and improving efficiency.
[0076] Part 3: SQL rule verification
[0077] Including non-empty check and SQL syntax correctness check.
[0078] Part 4: Automatic tuning of SQL rules
[0079] Because when executing SQL in the database, you will find that many SQLs are executed very slowly, and then you need to manually query the database one by one and optimize manually. This method is inefficient and affects the work efficiency of developers and databases as well as business docking. This embodiment can automatically tune in the following ways:
[0080] 1. Optimize data preparation
[0081] All slow SQL statements in the scheduled extraction task are stored in the database slow SQL real-time table and history table to facilitate comparison of optimization results.
[0082] 2. Optimize the slow SQL execution
[0083] The slow SQL optimization method can be to automatically add indexes: according to the slow SQL in data preparation, analyze the execution conditions of the slow SQL and add indexes for execution, and then delete the index, which not only improves the efficiency of the query, but also does not affect the write operation of the database. This embodiment can establish indexes according to the following principles: 1), the data column defining the primary key must be indexed; 2), the data column defining the foreign key must be indexed; 3), it is best to establish indexes for frequently queried data columns; 4), for data columns that need to be quickly or frequently queried within a specified range; 5), data columns that are often used in the WHERE clause; 6), the fields that often appear after the keywords order by, group by, and distinct are indexed, but if a composite index is established, the order of the index fields must be consistent with the order of the fields after these keywords, otherwise the index will not be used; 7), columns that are rarely involved in queries and columns with more repeated values should not be indexed; 8), columns defined as text, image, and bit data types should not be indexed; 9), avoid indexing frequently accessed columns; 10), limit the number of indexes on the table. For a table with a large number of update operations, the number of indexes should generally not exceed 3, and at most 5. Although indexes improve access speed, too many indexes will affect data update operations; 11) For composite indexes, indexes are created according to the frequency of the fields appearing in the query conditions. In a composite index, records are first sorted by the first field. For records with the same value in the first field, the system sorts them by the value of the second field, and so on. Therefore, only when the first field of the composite index appears in the query conditions can the index be used. Therefore, placing the fields with high application frequency in front of the composite index will make the system use this index to the greatest extent possible and give full play to the role of the index.
[0084] In this embodiment, the problem of index invalidation can be automatically optimized and prompted: when the SQL uses <>, not in, not equals, !=, like "%aaa", function calculation of column name, implicit conversion and other operations, the index corresponding to the column where the SQL condition is located will not work. For example, if the <> not equal symbol is used for matching in SQL, the system will query the corresponding field in the dictionary table for matching optimization to be within a certain range, or precisely = a certain value to maintain the validity of the index. Otherwise, the system will automatically store the problem in the SQL problem table. In the optimization process of a large number of SQLs, the troubleshooting action of SQL optimization is reduced, and the focus is on the optimization work of SQL itself, and the efficiency is greatly improved.
[0085] In this embodiment, the problem of multiple slow automatic optimization of SQL can be automatically prompted: the purpose of the slow SQL history table is to better understand which slow SQLs appear multiple times, so that these stubborn slow SQLs can be solved with concentrated efforts.
[0086] Part 5: SQL rule assembly
[0087] SQL rule assembly splits the remote transaction business through the attribute ID corresponding to the SQL rule. If the ID generated by the SQL rule starts with a lowercase letter A, the SQL to be assembled is judged to be a remote transaction business that needs to be split. Otherwise, it is regarded as a normal process business and there is no need to split the remote transaction business.
[0088] For existing off-site split transaction solutions that mainly use solidified scripts, the scripts must be regularly maintained by developers, which is redundant and has poor maintainability. It also places high demands on developers, who need to know the business process and have a high level of attainment in SQL optimization, resulting in high personnel costs and high uncertainty in maintenance results depending on the level of the personnel.
[0089] In this embodiment, the process of splitting transactions in different places is regularized and the business is standardized. Design innovation is carried out, and the business process interface is configured and the performance optimization package is automatically configured, thereby reducing the loss caused by human factors. The main features of this embodiment are low maintenance cost, high effectiveness and accuracy, reducing labor and thus supporting the automation of existing businesses.
[0090] The present invention is described below in conjunction with another optional embodiment.
[0091] Embodiment 2
[0092] The embodiment of the present invention provides a processing device for cross-regional transaction services, and each implementation unit included in the processing device corresponds to each implementation step in the above-mentioned embodiment 1.
[0093] Figure 3is a schematic diagram of an optional processing device for a remote transaction service according to an embodiment of the present invention, such as Figure 3 As shown, the processing device of the remote transaction business includes: an acquisition unit 30, an analysis unit 32, a storage unit 34, an adding unit 36, and a splitting unit 38, wherein:
[0094] An acquisition unit 30 is used to acquire a remote transaction data table;
[0095] The analysis unit 32 is used to analyze the execution speed of each data query task when performing data query on the remote transaction data table;
[0096] A storage unit 34 is used to store the query language corresponding to the data query task into a target data table of a preset database when the execution speed is lower than a preset speed threshold;
[0097] An adding unit 36, configured to add index conditions to the execution conditions of the query language in the target data table according to a preset index rule;
[0098] The splitting unit 38 is used to split the cross-region transaction business data by adding the attribute identifier corresponding to the query language after the index condition is added, so as to obtain the transaction data of each region.
[0099] The processing device of the above-mentioned off-site transaction business can obtain the off-site transaction data table through the acquisition unit 30, and then analyze the execution speed of each data query task when performing data query on the off-site transaction data table through the analysis unit 32. If the execution speed is lower than the preset speed threshold, the query language corresponding to the data query task is stored in the target data table of the preset database through the storage unit 34, and then according to the preset index rule, the execution condition of the query language in the target data table is added by the adding unit 36. Index conditions are added, and finally, the attribute identifier corresponding to the query language after adding the index condition is split by the splitting unit 38 to split the off-site transaction business data to obtain the transaction data of each region. In this embodiment, by regularizing the process of off-site split transactions and designing business standardization, highly automated reporting of off-site transactions is realized, the efficiency of data operation is greatly improved, and the maintenance cost is low, and the maintenance results are effective and accurate, thereby solving the technical problems of slow data splitting and low data operation efficiency when splitting the off-site data in the related technology.
[0100] Optionally, the adding unit includes: a first determination module, used to determine the primary key data column in the target data table according to preset index rules, and add index conditions to the primary key data column; and / or, a second determination module, used to determine the foreign key data column in the target data table according to preset index rules, and add index conditions to the foreign key data column.
[0101] Optionally, the adding unit also includes: a first acquisition module, used to obtain the historical query times of each data column in the target data table, and add index conditions to the data columns whose historical query times are greater than a first preset time threshold; and / or, a second acquisition module, used to obtain the query range of each data column in the target data table, and add index conditions to the data columns whose query range is within a specified range.
[0102] Optionally, the adding unit also includes: a third acquisition module, used to obtain the total number of times each data column in the target data table is used in the preset query statement, and add index conditions to the data columns whose total number of times used in the preset query statement is greater than a second preset number threshold; and / or, a fourth acquisition module, used to obtain the total number of occurrences of each field in the target data table that appears after the preset query keyword, and add index conditions to the fields whose total number of occurrences is greater than the second preset number threshold.
[0103] Optionally, the adding unit also includes: a first analysis module for analyzing the index type corresponding to the field appearing after the execution condition in the target data table; and a first establishment module for establishing the index according to the frequency of the field appearing in the execution condition when the index type is a composite index.
[0104] Optionally, the processing device also includes: a first encapsulation module, used to encapsulate the structure of the historical query language into a target data structure before obtaining the off-site transaction data table; a first caching module, used to cache the script to be loaded in the new script requirement into the target data structure when a new script requirement is received; a first judgment module, used to judge whether the query language corresponding to the new query task is the same as the historical query language when a new query task is received; and a first reading module, used to read data that is the same as the historical query language from the language of the target data structure if they are the same.
[0105] Optionally, the processing device also includes: a first verification module, which is used to perform a non-empty check and / or a correctness check on the target data structure after caching the script to be loaded in the new script requirement into the target data structure, wherein the non-empty check is used to verify whether the key value in the target data structure is empty, and the correctness check is used to verify whether the execution conditions of the query language are correct.
[0106] Optionally, the splitting unit includes: a third determination module, which is used to determine that the current business process is an off-site transaction business when the attribute identifier starts with preset characters, and split the off-site transaction business data to obtain all transaction data for each region; a fourth determination module, which is used to determine that the current business process is a normal process business when the attribute identifier does not start with preset characters, and there is no need to split the off-site transaction business data.
[0107] The above-mentioned processing device may also include a processor and a memory. The above-mentioned acquisition unit 30, analysis unit 32, storage unit 34, adding unit 36, splitting unit 38, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0108] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and by adjusting the kernel parameters, index conditions are added to the execution conditions of the query language in the target data table according to the preset index rules, and finally the attribute identifiers corresponding to the query language after the index conditions are added are split into the cross-regional transaction business data to obtain the transaction data of each region.
[0109] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0110] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, and the storage medium is used to store a computer program, wherein the computer program, when executed by a processor, controls the device where the computer-readable storage medium is located to execute the above-mentioned method for processing cross-site transaction business.
[0111] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: obtaining an off-site transaction data table, then analyzing the execution speed of each data query task when performing data query on the off-site transaction data table, and then adding index conditions to the execution conditions of the query language in the target data table according to preset index rules, and finally performing off-site transaction business data splitting on the attribute identifiers corresponding to the query language after adding the index conditions to obtain transaction data for each region.
[0112] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0113] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0114] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0116] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0117] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0118] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for processing off-site transaction business, characterized in that: include: Get the remote transaction data table; Analyze the execution speed of each data query task when performing data query on the remote transaction data table; If the execution speed is lower than a preset speed threshold, the query language corresponding to the data query task is stored in a target data table of a preset database; According to the preset index rules, adding index conditions to the execution conditions of the query language in the target data table includes: determining the primary key data column in the target data table according to the preset index rules, and adding index conditions to the primary key data column; and / or, determining the foreign key data column in the target data table according to the preset index rules, and adding index conditions to the foreign key data column; The cross-regional transaction business data is split by adding the attribute identifier corresponding to the query language after the index condition is added to obtain the transaction data of each region.
2. The processing method according to claim 1, characterized in that: The step of adding index conditions to the execution conditions of the query language in the target data table according to the preset index rules also includes: Obtaining the historical query times of each data column in the target data table, and adding index conditions to the data columns whose historical query times are greater than a first preset times threshold; and / or, The query range of each data column in the target data table is obtained, and index conditions are added to the data columns whose query range is within the specified range.
3. The processing method according to claim 2, characterized in that: The step of adding index conditions to the execution conditions of the query language in the target data table according to the preset index rules also includes: Obtaining the total number of times each data column in the target data table is used in a preset query statement, and adding an index condition to a data column whose total number of times used in the preset query statement is greater than a second preset number threshold; and / or, The total number of occurrences of each field that appears after the preset query keyword in the target data table is obtained, and an index condition is added to the field whose total number of occurrences is greater than a second preset number threshold.
4. The processing method according to claim 3, characterized in that: The step of adding index conditions to the execution conditions of the query language in the target data table according to the preset index rules also includes: Analyze the index type corresponding to the field in the target data table that appears after the execution condition; If the index type is a composite index, the index is created according to the frequency with which the field appears in the execution condition.
5. The processing method according to claim 1, characterized in that: Before obtaining the off-site transaction data table, the processing method further includes: Encapsulate the structure of the historical query language into a target data structure; If a new script requirement is received, the script to be loaded in the new script requirement is cached in the target data structure; If a new query task is received, determining whether the query language corresponding to the new query task is the same as the historical query language; If they are the same, data identical to the historical query language is read from the language of the target data structure.
6. The processing method according to claim 5, characterized in that: After caching the script to be loaded in the new script requirement into the target data structure, the processing method further includes: A non-empty check and / or a correctness check is performed on the target data structure, wherein the non-empty check is used to check whether the key value in the target data structure is empty, and the correctness check is used to check whether the execution condition of the query language is correct.
7. The processing method according to claim 1, characterized in that: The steps of splitting the cross-region transaction business data by adding the attribute identifier corresponding to the query language after the index condition is added to obtain all the transaction data of each region include: If the attribute identifier begins with a preset character, the current business process is determined to be a cross-region transaction business, and the cross-region transaction business data is split to obtain all transaction data for each region; If the attribute identifier does not start with a preset character, it is determined that the current business process is a normal process business, and there is no need to split the off-site transaction business data.
8. A device for processing cross-regional transaction services, characterized in that: include: An acquisition unit, used to acquire a remote transaction data table; An analysis unit, used for analyzing the execution speed of each data query task when performing data query on the remote transaction data table; A storage unit, used for storing the query language corresponding to the data query task into a target data table of a preset database when the execution speed is lower than a preset speed threshold; An adding unit is used to add index conditions to the execution conditions of the query language in the target data table according to preset index rules, and the adding unit includes: a first determining module, used to determine the primary key data column in the target data table according to the preset index rules, and add index conditions to the primary key data column; and / or, a second determining module, used to determine the foreign key data column in the target data table according to the preset index rules, and add index conditions to the foreign key data column; The splitting unit is used to split the cross-region transaction business data by adding the attribute identifier corresponding to the query language after the index condition is added, so as to obtain the transaction data of each region.
9. A computer-readable storage medium, characterized in that: The storage medium is used to store a computer program, wherein the computer program, when executed by a processor, controls the device where the computer-readable storage medium is located to execute the method for processing off-site transaction business as described in any one of claims 1 to 7.
