Business processing method and device, electronic equipment and storage medium
By dynamically selecting the target node to process the pending services, the problem that the HTAP database cannot fully demonstrate its computing capabilities when processing OLTP and OLAP services is solved, and more efficient service processing performance is achieved.
Patent Information
- Application Number
- CN202411881962.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-28
AI Technical Summary
When handling OLTP and OLAP services, the existing HTAP database has different focus, which makes it impossible to fully demonstrate the computing power and advantages of transaction processing and analysis processing at the same time.
By obtaining the pending services and analyzing the initial statement, obtaining the operation table group that has an interactive relationship with the initial statement, selecting different target nodes according to the type of the initial statement, and performing business processing on the pending services.
It realizes dynamic selection of target nodes based on business types, solves the problem that the database cannot fully demonstrate its computing capabilities when processing different business types, and improves the overall performance and efficiency of the database.
Smart Images

Figure CN119719227A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to a business processing method, device, electronic device and storage medium. Background Art
[0002] With the development of the Internet, distributed databases, as the mainstream way of data storage and processing, have been widely used in the field of information technology with their advantages such as high scalability, high availability and high performance.
[0003] According to the way data is stored on disk, distributed databases can be divided into row-based databases and column-based databases. Row-based databases are suitable for processing OLTP (online transaction processing) services, which usually require high concurrency, real-time, and strict transaction processing capabilities. Column-based databases are more suitable for processing OLAP (online analytical processing) services, which require fast query, complex analysis, and report generation for large amounts of data. However, with the continuous changes and development of business needs, more stringent requirements are placed on the capabilities of databases, requiring databases to have strong data analysis capabilities while ensuring transaction processing capabilities. Therefore, a single row-based or column-based database can no longer meet complex and changing business needs.
[0004] In the related technologies, although HTAP databases have achieved the integration of online transaction processing (OLTP) and online analytical processing (OLAP) services, there are still limitations in the specific implementation. Some HTAP databases tend to strengthen analytical processing capabilities and weaken transaction processing capabilities, resulting in poor performance when processing OLTP services. Some HTAP databases tend to strengthen transaction processing capabilities and weaken analytical processing capabilities, resulting in low efficiency when processing OLAP services. Due to the different focuses, it is impossible to fully demonstrate the computing capabilities and advantages of transaction processing and analytical processing databases at the same time. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a business processing method, device, electronic device and storage medium to solve the problem that the database cannot fully demonstrate its computing power and advantages due to the different emphasis of the database on different business types. The specific technical solution is as follows:
[0006] In a first aspect of an embodiment of the present application, a service processing method is first provided, the method comprising:
[0007] Obtaining the business to be processed, and parsing the business to be processed to obtain an initial statement;
[0008] Acquire an operation table group, where the operation table group is a set of tables that have an interactive relationship with the business to be processed;
[0009] If the initial statement is a first type of statement, selecting a first target node according to the operation table group, and performing business processing on the business to be processed;
[0010] If the initial statement is a statement of the second category, a second target node is selected according to the initial statement to perform business processing on the business to be processed.
[0011] In an optional implementation, the parsing of the service to be processed to obtain an initial statement includes:
[0012] The business to be processed is parsed by a hybrid transaction computing engine to obtain an initial statement.
[0013] In an optional implementation, if the initial statement is a first type of statement, selecting a first target node according to the operation table group and performing business processing on the to-be-processed business includes:
[0014] If the initial statement is a first-category statement, then obtaining the types of all tables in the operation table group;
[0015] A first target node is selected according to types of all tables in the operation table group to perform business processing on the to-be-processed business, wherein the types of tables in the operation table group include real-time update tables and non-real-time update tables.
[0016] In an optional implementation, the selecting a first target node according to the types of all tables in the operation table group to perform business processing on the to-be-processed business includes:
[0017] If the types of all tables in the operation table group are real-time update tables, a global transaction identifier is obtained from a global transaction management node, where the global transaction identifier is used for consistency when executing the pending business between a row storage data node and a column storage data node;
[0018] Combining the global transaction identifier with the business to be processed to form a combined statement, and converting the combined statement to obtain a first converted statement;
[0019] According to performance parameters of the current row-storage data nodes and column-storage data nodes, select an optimal node from the row-storage data nodes and the column-storage data nodes as the first target node;
[0020] The first conversion statement is sent to the first target node to perform business processing on the business to be processed.
[0021] In an optional embodiment, the method further comprises:
[0022] If the types of all tables in the operation table group include one or more non-real-time update tables, converting the initial statement to obtain a second converted statement;
[0023] The row storage data node is used as the first target node, the second conversion statement is sent to the first target node, and business processing is performed on the business to be processed.
[0024] In an optional implementation, if the initial statement is a statement of the second category, selecting a second target node according to the initial statement and performing business processing on the business to be processed includes:
[0025] If the initial statement is a second type statement, obtaining a label type of the initial statement;
[0026] A second target node is selected according to the label type of the initial statement to perform business processing on the business to be processed, wherein the label type of the initial statement includes a first type of label and a second type of label, and the label type is pre-set according to the characteristics of the initial statement.
[0027] In an optional implementation, selecting a second target node according to the label type of the initial statement to perform business processing on the to-be-processed business includes:
[0028] If the label type of the initial statement is a first type label, the column storage data node is used as the second target node, the initial statement is sent to the second target node, and the business to be processed is processed;
[0029] If the label type of the initial statement is a second type label, the to-be-processed business is evaluated according to the statistical information of the row-stored data node and the column-stored data node to obtain an evaluation result;
[0030] Selecting an optimal node from the row-stored data nodes and the column-stored data nodes as the second target node according to the evaluation result;
[0031] The initial statement is sent to the second target node, and business processing is performed on the business to be processed.
[0032] In a second aspect of the embodiments of the present application, a service processing device is further provided, the device comprising:
[0033] The initial module obtains the business to be processed and parses the business to be processed to obtain an initial statement;
[0034] An acquisition module is used to acquire an operation table group, where the operation table group is a set of tables that have an interactive relationship with the initial statement;
[0035] A first processing module, if the initial statement is a first type of statement, selects a first target node according to the operation table group, and performs business processing on the to-be-processed business;
[0036] The second processing module selects a second target node according to the initial statement if the initial statement is a second type of statement, and performs business processing on the business to be processed.
[0037] In a third aspect of the embodiments of the present application, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0038] Memory, used to store computer programs;
[0039] The processor is used to implement the business processing method described in any one of the first aspects above when executing the program stored in the memory.
[0040] In a fourth aspect of an embodiment of the present application, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the storage medium is executed on a computer, the computer executes the business processing method described in any one of the first aspects above.
[0041] In a fifth aspect of the embodiments of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the business processing method described in any one of the first aspects above.
[0042] The above technical solution provided by the embodiment of the present application obtains the business to be processed, and parses the business to be processed to obtain the initial statement, obtains the operation table group, and the operation table group is a collection of tables that have an interactive relationship with the initial statement. If the initial statement is a first-class statement, the first target node is selected according to the operation table group, and the business to be processed is processed. If the initial statement is a second-class statement, the second target node is selected according to the initial statement, and the business to be processed is processed. In this way, different target nodes are selected according to the type of the business to be processed, and the business to be processed is processed, which can solve the problem that the computing power and advantages of the database cannot be fully demonstrated due to the different emphasis of the database on different business types. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0045] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0046] Figure 1 A schematic diagram of an implementation flow of a business processing method provided in an embodiment of the present application;
[0047] Figure 2 A schematic diagram of an implementation flow of another business processing method provided in an embodiment of the present application;
[0048] Figure 3 A schematic diagram of an implementation flow of performing business processing on a business to be processed based on a table type provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of an implementation flow of performing business processing on a business to be processed based on a tag type provided in an embodiment of the present application;
[0050] Figure 5 A schematic diagram of the structure of a service processing device provided in an embodiment of the present application;
[0051] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0053] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0054] In order to solve the problem in the prior art, although the HTAP database has realized the integration of online transaction processing (OLTP) type business and online analytical processing (OLAP) type business, there are still limitations in the specific implementation. Some HTAP databases tend to strengthen analytical processing capabilities and weaken transaction processing capabilities, resulting in poor performance when processing OLTP type business. Some HTAP databases tend to strengthen transaction processing capabilities and weaken analytical processing capabilities, resulting in low efficiency when processing OLAP type business. Due to the different focuses, the technical problem that the computing power and advantages of transaction processing and analytical processing databases cannot be fully demonstrated at the same time, the present application provides a business processing method, device, electronic device and storage medium, by selecting different target nodes according to the type of business to be processed, and performing business processing on the business to be processed, which can solve the problem that the computing power and advantages of the database cannot be fully demonstrated due to the different focuses of the database on different business types.
[0055] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a business processing method provided in an embodiment of the present application, which may specifically include the following steps:
[0056] S101, obtaining the business to be processed, and parsing the business to be processed to obtain an initial statement.
[0057] In some embodiments of the present application, when a business request is received, it is first necessary to identify and obtain the pending business. This business can be operations such as querying, inserting, updating or deleting data in the database. The pending business can be direct input or request from the user, such as querying or modifying data initiated by the user through the application program interface, or it can be from other components or services within the system, such as scheduled tasks or data synchronization tasks. After obtaining the pending business, the pending business is parsed, and the parsing process includes understanding the essential needs of the business, that is, the specific operations that the user or system wants to perform, such as data query, insertion, update or deletion. Then extract the key operation instructions or query conditions from the business request and convert them into initial statements that the system can understand and execute.
[0058] For example, take querying all the information of students in class 10 as an example. It is known that Table 1 is the "class information table" and Table 2 is the "student information table" (a field in Table 2 points to the class ID of Table 1, which is used to associate classes and students). When the business request obtained is "query all the information of students in class 10", the pending business of the business request is the "query operation". The pending business is parsed. When parsing the business request, the class ID (class 10) to be queried is identified, and then the corresponding class record is found in the "class information table" according to the class ID. Then, all the student information belonging to this class is queried in the "student information table" according to these records, and then the index is selected to speed up the query process. Finally, the following SQL query statement is constructed as the initial statement, namely: SELECT student information table.*; FROM student information; JOIN class information table ON student information table.class ID = class information table.class ID; WHERE class information table.class name = 'class 10'.
[0059] S102, obtaining an operation table group, where the operation table group is a collection of tables that have an interactive relationship with the initial statement.
[0060] In some embodiments of the present application, after obtaining the initial statement, it is necessary to identify all tables that have an interactive relationship with the initial statement to form an operation table group. The tables in the operation table group include tables directly involved in business operations (main tables), and tables indirectly involved due to business logic (such as association tables, index tables, or views, etc.). These indirectly involved tables may be associated with the main table through foreign key relationships, business rules, or query conditions, etc., and this application example does not limit this.
[0061] For example, the initial statement that has been constructed is: SELECT student information table.*; FROM student information; JOIN class information table ON student information table.class ID = class information table.class ID; WHERE class information table.class name = '10 class'. Then the operation table group includes "student information table" and "class information table". Among them, "student information table" is the main table, because it directly contains the student information that the user wants to query; and "class information table" is an associated table, because it is connected to "student information table" through a foreign key relationship, and provides a screening condition (that is, the class name is "10 class") to limit the query results.
[0062] S103: If the initial statement is a first type statement, select a first target node according to the operation table group to perform business processing on the business to be processed.
[0063] In some embodiments of the present application, the first type of statement may be an SQL statement involving data changes, including an UPDATE statement (i.e., an SQL update statement, used for data update), an INSERT statement (i.e., an SQL insert statement, used for adding new data), or a DELET statement (i.e., an SQL delete statement, used for deleting data). When the initial statement is parsed to be a statement of the first type, the first target node may be selected according to the operation table group, and then the business to be processed may be processed.
[0064] For example, to update the grade information of all students in class 10 to grade 3, the initial statement is: UPDATE student information table; SET grade = 'grade 3'; WHERE class ID IN (SELECT class ID FROM class information table WHERE class name = 'class 10'); the initial statement is an UPDATE statement, which belongs to the first category of statements. According to the operation table group (including "class information table" and "student information table"), select the corresponding first target node, execute the UPDATE operation, and complete the business processing of updating the grade information of all students in class 10 to grade 3.
[0065] S104: If the initial statement is a statement of the second category, select a second target node according to the initial statement to perform business processing on the business to be processed.
[0066] In some embodiments of the present application, the second type of statement may be an SQL statement involving data query, i.e., a SELECT statement (i.e., an SQL query statement for data retrieval). When the initial statement is parsed to be a second type of statement, a second target node may be selected according to the initial statement, and then business processing may be performed on the business to be processed.
[0067] For example, to query the student records with missing grade information in class 10, the initial statement is: SELECT student information table.student ID, student information table.name; FROM student information table; JOIN class information table ON student information table.class ID = class information table.class ID; WHERE class information table.class name = 'class 10' AND student information table.grade IS NULL; the initial statement is a SELECT statement, which belongs to the second category of statements. According to the initial statement, the corresponding second target node is selected, and the SELECT operation is executed to complete the business processing of querying the student records with missing grade information in class 10.
[0068] Through the above description of the technical solution provided by the embodiment of the present application, the business to be processed is obtained, and the operation table group is obtained. The operation table group is a collection of tables that have an interactive relationship with the business to be processed. The business to be processed is parsed to obtain an initial statement. If the initial statement is a first-class statement, the first target node is selected according to the operation table group, and the business to be processed is processed. If the initial statement is a second-class statement, the second target node is selected according to the business to be processed, and the business to be processed is processed. In this way, different target nodes are selected according to the type of the business to be processed, and the business to be processed is processed. This can solve the problem that the database's computing power and advantages cannot be fully demonstrated due to the different emphasis of the database on different business types.
[0069] like Figure 2 FIG. 1 is a schematic diagram of an implementation flow of another service processing method provided in an embodiment of the present application, which may specifically include the following steps:
[0070] S201, obtaining the business to be processed, and parsing the business to be processed to obtain an initial statement.
[0071] In some embodiments of the present application, this step is similar to the above-mentioned step S101, and the embodiments of the present application will not be described one by one here.
[0072] S202, parsing the business to be processed by the hybrid transaction computing engine to obtain an initial statement.
[0073] In some embodiments of the present application, a hybrid transaction computing engine is introduced, that is, a component that can handle complex business logic and database operations. The hybrid transaction computing engine can not only understand the business logic, but also convert it into initial statements for database operations, and the initial statements can be executed directly on the database. The hybrid transaction computing engine parses the business to be processed to obtain the initial statement. As an intermediate layer, the hybrid transaction computing engine decouples the business logic from the specific database operation statements. When the business logic changes, it is only necessary to update the relevant logic in the hybrid transaction computing engine without directly modifying the database operation statements. At the same time, during the parsing process, the hybrid transaction computing engine can handle business logic involving multiple tables, multiple conditions, and complex calculations, and convert these complex business logics into simple and efficient initial statements.
[0074] For example, the hybrid transaction computing engine parses the business to be processed, and the initial statement obtained can be a SELECT statement (i.e., SQL query statement, used for data retrieval), an UPDATE statement (i.e., SQL update statement, used for data update), an INSERT statement (i.e., SQL insert statement, used for adding new data), or a DELET statement (i.e., SQL delete statement, used for deleting data). Taking the example of updating the grade information of all students in class 10, the initial statement is an UPDATE statement, which is used to update the value of the grade field in the "student information table".
[0075] S203: If the initial statement is a first-category statement, then the types of all tables in the operation table group are obtained.
[0076] In some embodiments of the present application, the first type of statement may be an SQL statement involving data changes, including an UPDATE statement (i.e., an SQL update statement, used for data update), an INSERT statement (i.e., an SQL insert statement, used for adding new data), or a DELET statement (i.e., an SQL delete statement, used for deleting data). When the initial statement is parsed to be a statement of the first type, the types of all tables in the operation table group are obtained.
[0077] For example, when the initial statement is UPDATE student information table; SET grade = 'third grade'; WHERE class ID IN (SELECT class ID FROM class information table WHERE class name = 'class 10'); the initial statement is an UPDATE statement, which belongs to the first type of statement, then the types of the class information table and the student information table in the operation table group will be obtained.
[0078] S204, selecting a first target node according to the types of all tables in the operation table group, and performing business processing on the business to be processed, wherein the types of tables in the operation table group include real-time update tables and non-real-time update tables.
[0079] In some embodiments of the present application, the first target node is selected according to the types of all tables in the operation table group to perform business processing on the pending business. Among them, the types of all tables in the operation table group can be divided into real-time update tables and non-real-time update tables according to whether the tables can reflect the changes of the data source in real time. The real-time update table can immediately capture and synchronize the changes of the data source to the database, while the non-real-time update table cannot capture and synchronize the changes of the data source to the database. This application example does not limit this.
[0080] For example, the student information table includes basic student information (such as name, student number, class, contact information, etc.). When student information changes (such as student transfer, contact information update, grade entry, etc.), the student information table can immediately capture these changes and synchronize the updates to the database. In this case, the student information table is a real-time update table. On the contrary, when student information changes (such as student transfer, contact information update, grade entry, etc.), the student information table cannot immediately capture these changes. In this case, the student information table is a non-real-time update table.
[0081] Specifically, the first target node is selected according to the types of all tables in the operation table group to perform business processing on the business to be processed. Figure 3 As shown, a schematic diagram of an implementation process of performing business processing on a business to be processed based on a table type provided in an embodiment of the present application may include the following steps:
[0082] S301: If the types of all tables in the operation table group are real-time update tables, a global transaction identifier is obtained from a global transaction management node. The global transaction identifier is used for consistency when executing pending services between row storage data nodes and column storage data nodes.
[0083] In some embodiments of the present application, the real-time update table may be a table that requires frequent insert, update, or delete operations, which require the data to reflect the latest status in real time. When all tables in the operation table group meet this condition, a request is sent to the global transaction management node to obtain a globally unique transaction identifier (i.e., a global transaction identifier) to ensure consistency when executing pending business between row storage data nodes and column storage data nodes. The global transaction management node is responsible for generating, allocating, and managing these transaction identifiers, and ensuring their uniqueness and consistency in the entire distributed database system.
[0084] For example, when all tables in the operation table group are real-time update tables, the global transaction identifier 1 is obtained from the global transaction management node. When data changes in the row storage data node or the column storage data node, the global transaction identifier 1 is used to ensure the consistency of these data changes between the row storage data node and the column storage data node.
[0085] S302, combining the global transaction identifier with the initial statement to form a combined statement, and converting the combined statement to obtain a first converted statement.
[0086] In some embodiments of the present application, after obtaining the global transaction identifier, the global transaction identifier is combined with the initial statement to obtain a combined statement. The combination method is usually to add a parameter of the global transaction identifier to the initial statement. Then, the combined statement is converted to obtain a first converted statement, wherein the conversion of the combined statement can be to adjust the syntax, semantics or execution plan of the combined statement so that the first converted statement can adapt to the execution mode of the row storage data node or the column storage data node. Thereby ensuring that the first converted statement can be correctly executed on the target data node and is consistent with the data of other data nodes.
[0087] For example, if a transaction needs to update the data in the row-stored data node and the column-stored data node, the global transaction identifier can be added to the update statement, that is, the global transaction identifier "GID_12345" is added to the UPDATE statement, and the statement is converted to adapt to the storage and execution methods of different data nodes. Then, the system will send the converted statements to the row-stored data node and the column-stored data node for execution, thereby ensuring the integrity and consistency of the transaction.
[0088] S303: Select an optimal node from the row-storage data nodes and the column-storage data nodes as a first target node according to performance parameters of the current row-storage data nodes and the column-storage data nodes.
[0089] In some embodiments of the present application, when selecting the first target node, the optimal node is selected as the first target node according to the performance parameters of the current row storage data node and column storage data node, wherein these performance parameters may include the processing capacity, load condition, network delay, etc. of the node. The efficiency and effect of different nodes in executing the first conversion statement are evaluated according to the performance parameters, and the optimal node is selected as the first target node. Among them, the evaluation process can comprehensively consider multiple factors, such as the stronger the processing capacity of the node, the higher the efficiency of executing the task; the lower the load of the node, the more likely it is to respond quickly to new task requests; the smaller the network delay, the faster the data transmission and synchronization speed, and then based on the evaluation results, the optimal node is dynamically selected as the first target node, that is, the selection of the target node is dynamically adjusted according to the real-time changing performance parameters. This helps to ensure that the optimal resources can always be used to process tasks, thereby improving overall performance and efficiency.
[0090] For example, if a row-stored data node currently has a lower load and higher processing capacity, and the network latency is relatively small, then this node will be selected as the first target node to execute the first conversion statement. Conversely, if a column-stored data node performs better in these aspects, then this node will be selected as the first target node.
[0091] S304: Send the first conversion statement to the first target node to perform business processing on the business to be processed.
[0092] In some embodiments of the present application, after determining the first target node, the first conversion statement is sent to the first target node for business processing. This business processing process involves operations such as reading, writing, updating or deleting data, depending on the type and requirements of the business to be processed. The first target node will perform corresponding operations on the business to be processed according to the received first conversion statement, and this application example does not limit this.
[0093] For example, if the first conversion statement is a data update operation (such as an UPDATE statement), then the first conversion statement contains the data content to be updated and the global transaction identifier. After receiving this statement, the first target node will ensure the consistency of the data between the row storage data node and the column storage data node based on the global transaction identifier, and perform the corresponding data update operation.
[0094] S305: If the types of all tables in the operation table group include one or more non-real-time update tables, the initial statement is converted to obtain a second converted statement.
[0095] In some embodiments of the present application, if the operation table group includes a non-real-time update table, the initial statement will be converted to generate a second conversion statement that is more suitable for the characteristics of the non-real-time update table. Among them, the non-real-time update table can be a table that does not need to frequently perform insert, update or delete operations, or these operations do not require high real-time data. In this case, the initial statement will be converted according to the characteristics of the non-real-time update table and the needs of the pending business to obtain the second conversion statement. Among them, the conversion process can optimize the query conditions to reduce unnecessary data scanning and calculations, thereby increasing the query speed, and can also optimize the use of indexes. It is also possible to adjust the join order, reduce redundancy, and other operations on the initial statement, and the examples of this application are not limited to this.
[0096] For example, the initial statement is a complex query operation involving the joining of multiple tables and filtering of multiple conditions. When the operation table group contains a non-real-time update table, this query is optimized and converted to generate a more efficient second conversion statement by adjusting the join order, reducing unnecessary join operations, and using indexes to speed up queries. Then, this second conversion statement is sent to the row storage data node for execution to obtain faster query results.
[0097] S306: Use the row storage data node as the first target node, send the second conversion statement to the first target node, and perform business processing on the business to be processed.
[0098] In some embodiments of the present application, after obtaining the second conversion statement, since the data of the non-real-time update table does not need to be frequently analyzed or aggregated, it is more suitable to be managed in a row storage manner. Therefore, the row storage data node is selected as the first target node by default. Then, the second conversion statement is sent to the row storage data node to perform business processing on the business to be processed. The row storage data node will perform corresponding operations according to the received second conversion statement.
[0099] For example, for a join query involving a real-time update table and a non-real-time update table in a pending business, after identifying that the operation table group includes a non-real-time update table, a second conversion statement will be generated, which improves query efficiency by adjusting query conditions, optimizing the join order, or using indexes. Then, this optimized second conversion statement is sent to the row storage data node, and the corresponding operation is performed on the pending business according to the received second conversion statement.
[0100] S205: If the initial statement is a second-category statement, obtain the label type of the initial statement.
[0101] In some embodiments of the present application, the second type of statement may be an SQL statement involving data query, namely a SELECT statement (ie, an SQL query statement for data retrieval). When the initial statement is parsed to be a second type of statement, the label type of the initial statement is obtained.
[0102] For example, when the initial statement is: SELECT student information table.student ID, student information table.name; FROM student information table; JOIN class information table ON student information table.class ID = class information table.class ID; WHERE class information table.class name = 'Class 10' AND student information table.grade IS NULL; the initial statement is a SELECT statement, which belongs to the second type of statement, then the label type of the initial statement will be obtained.
[0103] S206, selecting a second target node according to the label type of the initial statement, and performing business processing on the business to be processed, wherein the label type of the initial statement includes a first type of label and a second type of label, and the label type is pre-set according to the characteristics of the initial statement.
[0104] In some embodiments of the present application, a second target node is selected according to the label type of the initial statement, and business processing is performed on the business to be processed. The label type of the initial statement is pre-set according to the characteristics of the initial statement by adding labels to the data query language (DQL) statement. It is mainly divided into a first type of label and a second type of label. Among them, the first type of label is usually an AP (Analytical Processing) label for online analytical processing (OLAP) type business. The second type of label includes a TP (Transaction Processing) label for online transaction processing (OLTP) type business, as well as those queries that are not marked with an AP label but belong to online analytical processing (OLAP) type business. This application example is not limited to this.
[0105] For example, when the business to be processed is an online analytical processing (OLAP) business, but is not tagged with an AP tag, the tag type of the business to be processed is a second-class tag.
[0106] Specifically, a second target node is selected according to the tag type of the service to be processed, and the service to be processed is processed, such as Figure 4 As shown, a schematic diagram of an implementation process of performing business processing on a pending business based on a tag type provided in an embodiment of the present application may include the following steps:
[0107] S401: If the label type of the initial statement is a first-class label, the column-stored data node is used as a second target node, the initial statement is sent to the second target node, and the business to be processed is processed.
[0108] In some embodiments of the present application, when the tag type of the initial statement is a first-class tag, since the business of the first-class tag mainly focuses on data analysis and report generation, the real-time requirements for data are relatively low, but a large amount of data aggregation and calculation are required. Therefore, when the system recognizes that the initial statement has an AP tag, it will select a column-stored data node that is more suitable for complex data analysis and calculation as the second target node.
[0109] For example, if the business to be processed is to update student grade information, and the initial statement is an UPDATE statement, a large amount of student grade data needs to be summarized, analyzed, and queried in multiple dimensions, such as by class, subject, or individual student. This type of business obviously meets the characteristics of data analysis business, so the initial statement will be marked with an AP label. In this case, the initial statement is sent to the column storage data node to process the business to be processed.
[0110] S402: If the label type of the initial statement is a second-type label, the business to be processed is evaluated according to the statistical information of the row-stored data nodes and the column-stored data nodes to obtain an evaluation result.
[0111] In some embodiments of the present application, when the label type of the initial statement is a second-class label, for businesses with TP labels and OLAP-type business queries that are not labeled with AP labels, it is impossible to directly determine the optimal data processing node based on the label type. Therefore, it is necessary to conduct a comprehensive evaluation of the business to be processed based on the statistical information of the row-stored and column-stored data nodes, where the statistical information includes various statistics of the data in the table (such as the number of rows, column selectivity, data distribution, etc.) and real-time performance parameters such as the current load, processing capacity, network delay, etc. of the node. The evaluation result is obtained by evaluating the statistical information, and the examples of the present application are not limited to this.
[0112] For example, the business to be processed is to query the names and student numbers of students in a specific class. If the row-stored data node stores the student information table, and the number of data rows in the table is small and the column selectivity is high, and the current load of the row-stored data node is low and the processing capacity is strong, then it will be evaluated that the cost of executing the query on the row-stored data node is low. On the contrary, if the column-stored data node has advantages in data compression, column scanning, or parallel processing, then the evaluation results show that the cost of executing the query on the column-stored data node is lower.
[0113] S403: Select an optimal node from the row-stored data nodes and the column-stored data nodes as a second target node according to the evaluation result.
[0114] In some embodiments of the present application, an optimal node is selected from the row-stored data nodes and the column-stored data nodes as the second target node according to the evaluation result.
[0115] For example, if it is evaluated that the cost of executing the query on a row-stored data node is lower, then the row-stored data node is used as the second target node; if it is evaluated that the cost of executing the query on a column-stored data node is lower, then the column-stored data node is used as the second target node.
[0116] S404: Send the initial statement to the second target node to perform business processing on the business to be processed.
[0117] In some embodiments of the present application, the initial statement is sent to the second target node to perform business processing on the business to be processed. According to the specific type of business (such as query, update, delete, etc.), the second target node will perform corresponding database operations, such as reading data, calculating aggregate values, updating records, etc. During the processing, the consistency, integrity and security of the data are ensured, and the processing progress and performance are monitored so that adjustments or optimizations can be made when necessary.
[0118] For example, if the business to be processed is to query the grade ranking of all students in a class, and the system has determined that the column-stored data node is the best second target node, then the query request will be sent to the column-stored data node. The column-stored data node will use its own advantages (such as efficient data compression, fast column scanning, etc.) to perform the query operation and return the result to the requester. The entire processing process will ensure the accuracy of the data and the efficiency of the query, thereby meeting the user's business needs.
[0119] Corresponding to the above method embodiment, the embodiment of the present application also provides a service processing device, such as Figure 5 As shown, the device may include an initial module 501 , an acquisition module 502 , a first processing module 503 , and a second processing module 504 .
[0120] Initial module 501, obtains the business to be processed, and parses the business to be processed to obtain an initial statement;
[0121] Acquisition module 502, acquiring an operation table group, where the operation table group is a set of tables that have an interactive relationship with the initial statement;
[0122] The first processing module 503 selects a first target node according to the operation table group and performs business processing on the business to be processed if the initial statement is a first type of statement;
[0123] The second processing module 504 selects a second target node according to the initial statement and performs business processing on the business to be processed if the initial statement is a second type of statement.
[0124] The present application also provides an electronic device, such as Figure 6 As shown, it includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0125] Memory 603, used for storing computer programs;
[0126] In one embodiment of the present application, the processor 601, when used to execute the program stored in the memory 603, implements the following steps:
[0127] Obtain the business to be processed, parse the business to be processed, obtain the initial statement, and obtain the operation table group. The operation table group is a collection of tables that have an interactive relationship with the initial statement. If the initial statement is a first-category statement, select the first target node according to the operation table group and perform business processing on the business to be processed. If the initial statement is a second-category statement, select the second target node according to the initial statement and perform business processing on the business to be processed.
[0128] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0129] The communication interface is used for communication between the above electronic device and other devices.
[0130] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0131] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0132] In another embodiment provided in the present application, a storage medium is provided, in which instructions are stored. When the storage medium is executed on a computer, the computer executes the business processing method described in any one of the above embodiments.
[0133] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the business processing methods described in the above embodiments.
[0134] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium, or transmitted from one storage medium to another storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0135] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0136] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0137] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A business processing method, characterized in that: The method comprises: Obtaining the business to be processed, and parsing the business to be processed to obtain an initial statement; Acquire an operation table group, where the operation table group is a set of tables that have an interactive relationship with the initial statement; If the initial statement is a first type of statement, selecting a first target node according to the operation table group, and performing business processing on the business to be processed; If the initial statement is a statement of the second category, a second target node is selected according to the initial statement to perform business processing on the business to be processed.
2. The method according to claim 1, characterized in that The parsing of the business to be processed to obtain an initial statement includes: The business to be processed is parsed by a hybrid transaction computing engine to obtain an initial statement.
3. The method according to claim 1, characterized in that If the initial statement is a first type of statement, selecting a first target node according to the operation table group, and performing business processing on the to-be-processed business, includes: If the initial statement is a first-category statement, then obtaining the types of all tables in the operation table group; A first target node is selected according to types of all tables in the operation table group to perform business processing on the to-be-processed business, wherein the types of tables in the operation table group include real-time update tables and non-real-time update tables.
4. The method according to claim 3, characterized in that The selecting a first target node according to the types of all tables in the operation table group and performing business processing on the to-be-processed business includes: If the types of all tables in the operation table group are real-time update tables, a global transaction identifier is obtained from a global transaction management node, where the global transaction identifier is used for consistency when executing the pending business between a row storage data node and a column storage data node; Combining the global transaction identifier with the initial statement to form a combined statement, and converting the combined statement to obtain a first converted statement; According to performance parameters of the current row-storage data nodes and column-storage data nodes, select an optimal node from the row-storage data nodes and the column-storage data nodes as the first target node; The first conversion statement is sent to the first target node to perform business processing on the business to be processed.
5. The method according to claim 4, characterized in that The method further comprises: If the types of all tables in the operation table group include one or more non-real-time update tables, converting the initial statement to obtain a second converted statement; The row storage data node is used as the first target node, the second conversion statement is sent to the first target node, and business processing is performed on the business to be processed.
6. The method according to claim 1, characterized in that If the initial statement is a statement of the second category, selecting a second target node according to the initial statement, and performing business processing on the business to be processed includes: If the initial statement is a second type statement, obtaining a label type of the initial statement; A second target node is selected according to the label type of the initial statement to perform business processing on the business to be processed, wherein the label type of the initial statement includes a first type of label and a second type of label, and the label type is pre-set according to the characteristics of the initial statement.
7. The method according to claim 6, characterized in that The selecting a second target node according to the label type of the initial statement and performing business processing on the business to be processed includes: If the label type of the initial statement is a first type label, the column storage data node is used as the second target node, the initial statement is sent to the second target node, and the business to be processed is processed; If the label type of the initial statement is a second type label, the to-be-processed business is evaluated according to the statistical information of the row-stored data node and the column-stored data node to obtain an evaluation result; Selecting an optimal node from the row-stored data nodes and the column-stored data nodes as the second target node according to the evaluation result; The initial statement is sent to the second target node, and business processing is performed on the business to be processed.
8. A service processing device, characterized in that: The device comprises: The initial module obtains the business to be processed and parses the business to be processed to obtain an initial statement; An acquisition module is used to acquire an operation table group, where the operation table group is a set of tables that have an interactive relationship with the initial statement; A first processing module, if the initial statement is a first type of statement, selects a first target node according to the operation table group, and performs business processing on the to-be-processed business; The second processing module selects a second target node according to the initial statement if the initial statement is a second type of statement, and performs business processing on the business to be processed.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-7 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.