Access method of HTAP system, middleware and related product

By automatically forwarding the client's SQL statements to the appropriate storage engine of the HTAP system through middleware, the problem of business systems having to determine the storage engine type themselves in existing technologies is solved, thus improving the user experience of the HTAP system.

CN122086989APending Publication Date: 2026-05-26HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
Filing Date
2024-11-26
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing HTAP systems, business systems need to determine the storage engine type themselves, which leads to a degraded user experience.

Method used

A middleware is provided that connects to multiple storage engines of an HTAP system, receives SQL statements from clients, and automatically forwards them to the appropriate storage engine based on a set of pre-configured routing policies, including routing policies based on specified storage engine type, keywords in the SQL statement, execution cost, and historical execution time.

Benefits of technology

This improves the user experience of the HTAP system, allowing clients to select a more suitable storage engine for access without having to determine the storage engine type themselves.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122086989A_ABST
    Figure CN122086989A_ABST
Patent Text Reader

Abstract

The invention provides an access method of an HTAP system, middleware and a related product. The use experience of the HTAP system can be improved. The method can be applied to middleware of the HTAP system, the middleware is connected with multiple types of storage engines in the HTAP system, and the multiple types of storage engines comprise at least two of a TP engine, an AP engine and an HTAP engine. The method comprises the following steps that middleware receives a target SQL statement, the target type of a storage engine is determined according to the target SQL statement and a routing strategy set configured in the middleware, then a target storage engine is determined, the target storage engine is one or more of storage engines of the target type, and the target storage engine is one or more of the storage engines of the target type; the target type is one of the multiple types of storage engines, the routing strategy set comprises one or more routing strategies, and each routing strategy comprises a judgment condition and a corresponding storage engine type. And then, the middleware sends the target SQL statement to the target storage engine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of databases, and more particularly to an access method, middleware, and related products for a hybrid transactional analytical processing (HTAP) system. Background Technology

[0002] With the development of the Internet, the Internet of Things (IoT), and e-commerce, the amount of data generated by business systems during the operation of related businesses continues to grow, and the demand for data analysis and query is also increasing. As a result, more and more users are choosing to use HTAP systems to manage the data generated by business systems.

[0003] Currently, HTAP systems typically include two types of storage engines: transaction processing (TP) engines and analytical processing (AP) engines. TP engines handle transaction processing, such as inserting, updating, or deleting single data entries, while AP engines handle analytical processing, such as large-scale data aggregation and computation. When a business system wants to access an HTAP system, it first needs to determine the type of storage engine to use based on its business logic. Then, it selects one or more of these storage engines and sends a Structured Query Language (SQL) statement. The storage engines then execute the corresponding data operations based on the received SQL statement, thus enabling the business system to access the HTAP system. Understandably, this approach requires the business system to manually determine the storage engine type for each HTAP system access, which degrades the user experience. Summary of the Invention

[0004] This application provides an access method, middleware, and related products for an HTAP system, which can improve the user experience of the HTAP system.

[0005] Firstly, this application provides an access method for an HTAP system. This method can be applied to middleware within an HTAP system. Specifically, the middleware connects to multiple storage engines within the HTAP system. The middleware can forward multiple SQL statements from clients of the HTAP system to the various storage engines connected to it. These storage engines include at least two of the following: TP engine, AP engine, and HTAP engine. Taking a target SQL statement from a client as an example, the middleware can forward the target SQL statement to the target storage engine in the HTAP system through the following steps: The middleware receives the target SQL statement, then determines the target type of the storage engine based on the target SQL statement and a set of routing policies configured in the middleware, thereby determining the target storage engine. The target storage engine is one or more storage engines of the target type, and the target type is one of the aforementioned multiple storage engine types. The routing policy set includes one or more routing policies, each including a decision condition and a corresponding storage engine type. Afterward, the middleware sends the target SQL statement to the target storage engine.

[0006] In the technical solution provided in this application, the middleware can automatically forward SQL statements from the client to the corresponding storage engine according to a pre-configured set of routing policies, thereby enabling access to the HTAP system. Throughout the access process, the HTAP system client (such as a business system) only needs to send SQL statements, improving the user experience of the HTAP system.

[0007] In one possible implementation, the routing policy set includes one or more of the following: a routing policy based on a specified storage engine type, a routing policy based on keywords in the SQL statement, a routing policy based on the execution cost of the SQL statement, and a routing policy based on the historical execution time of the SQL statement. Here, the routing policy based on a specified storage engine type is used to instruct the forwarding of the SQL statement based on the storage engine type specified by the user. The user can add a specific field to the SQL statement to indicate the storage engine type; this specific field can be a hint.

[0008] In one possible implementation, the middleware determines the target type of the storage engine based on the target SQL statement and the set of routing strategies, including the following steps: the middleware determines the judgment conditions satisfied by the SQL statement, and then determines the target type of the storage engine as the storage engine type corresponding to the judgment conditions based on the determined judgment conditions.

[0009] In one possible implementation, when the routing policy set includes multiple routing policies, the middleware also configures the priorities of these multiple routing policies. Then, the middleware determines the target type of the storage engine based on the target SQL statement and the routing policy set, including the following steps: The middleware determines the target type of the storage engine based on the target SQL statement, the routing policy set, and the priorities of the multiple routing policies in the routing policy set.

[0010] In one possible implementation, the routing policy set includes a first routing policy and a second routing policy, with the first routing policy having a higher priority than the second. The middleware then determines the target type of the storage engine based on the target SQL statement, the routing policy set, and the priorities of the multiple routing policies within the set. This involves the following steps: The middleware first determines whether the target SQL statement meets the criteria in the first routing policy. If the target SQL statement meets a certain criterion in the first routing policy, the middleware can determine the target type of the storage engine based on that criterion. Conversely, if the target SQL statement does not meet any of the criterion conditions in the first routing policy, the middleware can determine the target type of the storage engine based on the second routing policy.

[0011] Through the above implementation method, the middleware can select a more suitable storage engine from the various storage engines of the HTAP system (such as a storage engine of user-specified type or a storage engine with better access performance) to access the HTAP system.

[0012] In one possible implementation, the middleware also provides a configuration interface that includes multiple candidate routing strategies. These candidate strategies include at least two of the following: a routing strategy based on a specified storage engine type, a routing strategy based on keywords in the SQL statement, a routing strategy based on the execution cost of the SQL statement, and a routing strategy based on the historical execution time of the SQL statement. The middleware can receive user selections of the multiple candidate routing strategies through the configuration interface, and then determine the set of routing strategies based on these selections.

[0013] Through the above implementation method, users can configure a set of routing policies according to actual business needs, so that the business's access to the HTAP system can meet the needs of the business.

[0014] Secondly, this application provides middleware. This middleware is deployed in an HTAP system and connects to multiple storage engines within the HTAP system. Through these connections, the middleware can forward multiple SQL statements from clients in the HTAP system to the various storage engines connected to it. These storage engines include at least two of the following: TP engine, AP engine, and HTAP engine. The middleware includes an acquisition module, a routing module, and a sending module. Taking a target SQL statement from a client as an example, the modules in the middleware are described as follows: The acquisition module receives the target SQL statement. The routing module determines the target storage engine type based on the target SQL statement and a set of routing policies configured in the middleware, and then determines the target storage engine. The target storage engine is one or more storage engines of the target type, and the target type is one of the aforementioned multiple storage engine types. The routing policy set includes one or more routing policies, each including a decision condition and a corresponding storage engine type. The sending module sends the target SQL statement to the target storage engine.

[0015] In one possible implementation, the routing policy set includes one or more of the following: a routing policy based on a specified storage engine type, a routing policy based on keywords in the SQL statement, a routing policy based on the execution cost of the SQL statement, and a routing policy based on the historical execution time of the SQL statement. The routing policy based on a specified storage engine type is used to instruct the forwarding of the SQL statement based on the user-specified storage engine type. The user can add a specific field to the SQL statement to indicate the storage engine type; this specific field can be a hint.

[0016] In one possible implementation, the routing module is used to determine the criteria that the SQL statement satisfies, and based on the determined criteria, to determine the target type of the storage engine as the storage engine type corresponding to the criteria.

[0017] In one possible implementation, when the routing policy set includes multiple routing policies, the middleware also configures the priorities of these multiple routing policies. Then, the routing module is used to determine the target type of the storage engine based on the target SQL statement, the routing policy set, and the priorities of the multiple routing policies within the routing policy set.

[0018] In one possible implementation, the routing strategy set includes a first routing strategy and a second routing strategy, with the first routing strategy having a higher priority than the second. The routing module first determines whether the target SQL statement meets the criteria in the first routing strategy. If the target SQL statement meets any criterion in the first routing strategy, the target storage engine type is determined based on that criterion. Conversely, if the target SQL statement does not meet any of the criteria in the first routing strategy, the target storage engine type is determined based on the second routing strategy.

[0019] In one possible implementation, the middleware also includes a configuration module. This configuration module provides a configuration interface that includes multiple candidate routing strategies. These strategies include at least two of the following: routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, routing strategies based on the execution cost of the SQL statement, and routing strategies based on the historical execution time of the SQL statement. The configuration module also receives user selections of the multiple candidate routing strategies through the configuration interface and determines a set of routing strategies based on these selections.

[0020] Thirdly, this application provides a computing device. The computing device includes a processor and a memory, wherein the processor executes instructions stored in the memory to cause the computing device to perform some or all of the methods described in the first aspect and any implementation thereof.

[0021] Fourthly, this application provides a computing device cluster. The computing device cluster includes at least one computing device, each computing device including a processor and a memory. The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, causing the computing device cluster to perform some or all of the methods described in the first aspect and any implementation thereof.

[0022] Fifthly, this application provides a computer program product containing instructions. This computer program product may be a software or program product containing instructions that can run on a computing device or be stored on any usable medium. When the computer program product is run on a computing device, it causes the computing device to perform some or all of the methods described in the first aspect and any implementation thereof.

[0023] Sixthly, this application provides a computer-readable storage medium. The computer storage medium includes computer program instructions that, when executed by a computing device, cause the computing device to perform some or all of the methods described in the first aspect and any implementation thereof. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of an access scenario for an HTAP system provided in this application;

[0025] Figure 2 This is a schematic diagram of an application scenario provided in this application;

[0026] Figure 3 This is a flowchart illustrating an access method for an HTAP system provided in this application;

[0027] Figure 4 This is a schematic diagram of the structure of a middleware provided in this application;

[0028] Figure 5 This is a schematic diagram of the structure of a computing device provided in this application;

[0029] Figure 6 This is a schematic diagram of the structure of a computing device cluster provided in this application;

[0030] Figure 7 This is a schematic diagram of another computing device cluster provided in this application. Detailed Implementation

[0031] To improve the user experience of HTAP systems, this application provides a method for accessing HTAP systems. This method can be applied to middleware deployed within the HTAP system and connected to multiple storage engines (such as TP and AP engines). Specifically, the middleware receives SQL statements sent by clients of the HTAP system, determines the appropriate storage engine from among the connected storage engines based on the SQL statement, and then forwards the SQL statement to the determined storage engine. The storage engine can then execute corresponding data operations based on the received SQL statement, thus enabling access to the HTAP system. As can be seen, in this access process, the client only needs to send SQL statements, improving the user experience of the HTAP system.

[0032] The technical solution provided in this application will be described below with reference to the accompanying drawings.

[0033] See Figure 1 , Figure 1 A schematic diagram illustrating an access scenario for an HTAP system to which this application applies is shown. For example... Figure 1 As shown, the scenario includes a client 100 and an HTAP system 200, wherein the client 100 and the HTAP system 200 are connected via a network, which can be a wide area network or a local area network.

[0034] Client 100 can be a system running business operations (i.e., a business system), such as sales management, expense reimbursement, and financial reconciliation. In specific implementations, client 100 can be implemented through a single computing device or a cluster of computing devices consisting of multiple computing devices. The computing device can be a server, such as a central server or edge server in a cloud data center or a local server in a local data center, or it can be a terminal device, such as a desktop computer, laptop computer, or smartphone.

[0035] Client 100 needs to access HTAP system 200 during business operations. Taking sales management as an example, client 100 can send various transaction data generated during business operations (such as order information, customer information, product details, etc.) to HTAP system 200 for storage. In addition, when users want to view the sales performance of various products in different time periods and regions, client 100 can query relevant data from HTAP system 200.

[0036] HTAP System 200 is a database system that supports both online transaction processing (OLTP) and online analytical processing (OLAP).

[0037] The HTAP system 200 includes multiple storage nodes 210, which are used to store data. These storage nodes can be implemented using disks, solid-state drives (SSDs), shingled magnetic recording hard drives, storage arrays, or other types of storage media. The storage nodes 210 in the HTAP system 200 can include row storage nodes, column storage nodes, and hybrid row-column storage nodes. Row storage nodes store data using a row-based storage method, where data is stored row by row, with each row storing all fields of one data entry. Column storage nodes store data using a column-based storage method, where data is stored column by column, with each column corresponding to one field of the data. Hybrid row-column storage nodes include data stored using both row and column storage methods.

[0038] The HTAP system 200 also includes multiple storage engines 220, which are used to write data to storage nodes 210 and manage the data in storage nodes 210. Storage engines 220 can be computing devices, such as servers or virtual machines. The storage engines 220 in the HTAP system 200 can include TP engines and AP engines, and optionally, also include HTAP engines. The TP engine is a storage engine used for transaction processing; specifically, the TP engine can read data from row storage nodes or perform insert, update, or delete operations on data in row storage nodes. The AP engine is a storage engine used for analytical processing; specifically, the AP engine can perform complex analytical queries and calculations based on column storage nodes. For example, the AP engine can read data from column storage nodes and perform analytical processing on the read data. The TP engine can also synchronize data from row storage nodes to column storage nodes through the AP engine. The HTAP engine is a storage engine that can be used for both transaction processing and analytical processing; specifically, the HTAP engine can perform transaction processing and analysis by accessing row storage nodes, column storage nodes, and mixed row-column storage nodes.

[0039] The HTAP system 200 also includes one or more middleware 230, for ease of description, Figure 1 Only one middleware 230 is shown, and the following embodiments will be described using this middleware 230. Figure 1 As shown, the middleware 230 establishes connections with the client 100 and multiple storage engines 220 in the HTAP system 200. The connection between the middleware 230 and the client 100 can be a network (such as a wide area network or a local area network), and the connection between the middleware 230 and the storage engines 220 can be a wired connection or a wireless connection. The storage engines 220 that establish connections with the middleware 230 can include at least two types of TP engines, AP engines, and HTAP engines.

[0040] Middleware 230 forwards multiple SQL statements from client 100 to multiple storage engines connected to it. Specifically, middleware 230 is configured with a routing policy set, which includes one or more routing policies, each including a decision condition and a corresponding storage engine type. When client 100 wants to access HTAP system 200, it sends an SQL statement to middleware 230. Middleware 230 then determines the target storage engine type based on the received SQL statement and the routing policy set, and further determines the target storage engine. The target storage engine is one or more storage engines of a target type, which is one of the types of storage engines connected to middleware 230, and the target type is the storage engine type corresponding to the decision condition satisfied by the SQL statement. Middleware 230 then forwards the SQL statement from client 100 to the target storage engine, enabling the target storage engine to perform the corresponding data operations. Furthermore, middleware 230 can also return the execution result of the target storage engine to client 100.

[0041] In a specific implementation, the middleware 230 can be implemented through a single computing device or a cluster of computing devices consisting of multiple computing devices. The computing device can be a server, such as a central server or edge server in a cloud data center or a local server in a local data center, or a terminal device, such as a desktop computer or a laptop computer.

[0042] As one possible implementation, such as Figure 2 As shown, the HTAP system 200 can be deployed in a data center. In this case, the HTAP system 200 can be provided to users as a cloud service based on the basic resources (including computing resources, storage resources, and network resources) provided by the data center. Users (such as enterprises) can register an account on the cloud management platform through a local client, log in to the cloud management platform through the account, and purchase the aforementioned cloud services on the cloud management platform. After successful purchase, the client 100 running business operations can access the HTAP system 200 through the middleware 230. It should be understood that the middleware 230 can be provided to users not only as part of the functionality of the HTAP system 200, but also as a standalone cloud service; this application does not limit this.

[0043] Next, combined Figure 3 The flowchart shown illustrates the access method of the HTAP system, providing a more detailed explanation of how the middleware 230 enables the client 100 to access the HTAP system 200.

[0044] Step 301: Middleware 230 obtains the routing policy set.

[0045] The routing policy set includes one or more routing policies. Each routing policy includes decision conditions and the storage engine type corresponding to the decision conditions. The number of decision conditions in each routing policy can be one or more.

[0046] For example, the routing policy set may include one or more of the following routing policies:

[0047] (1) Routing strategy based on specified storage engine type

[0048] A routing policy based on a specified storage engine type is used to instruct which storage engine to forward SQL statements from client 100 to, based on the user-specified storage engine type. Specifically, the routing policy based on a specified storage engine type includes the user-specified storage engine type. This user-specified storage engine type can be indicated by adding a specific field to the SQL statement; for example, this specific field could be a hint in the SQL statement.

[0049] As one possible implementation, when the storage engine type specified by the user is indicated by adding a hint in the SQL statement, the decision condition of the above routing strategy can define a hint template. The hint template is used to describe the format and content of the target hint, where the target hint is the storage engine type specified by the user in the SQL statement.

[0050] For example, assuming the storage engine 220 connected to the database middleware 230 includes TP engine, AP engine, and HTAP engine types, the routing policy based on the specified storage engine type can include decision condition 1, decision condition 2, and decision condition 3. Decision condition 1 is "The SQL statement includes the following hint: / *+route:TP* / ", and the storage engine type corresponding to decision condition 1 is TP engine. Decision condition 2 is "The SQL statement includes the following hint: / *+route:AP* / ", and the storage engine type corresponding to decision condition 2 is AP engine. Decision condition 3 is "The SQL statement includes the following hint: / *+route:HTAP* / ", and the storage engine type corresponding to decision condition 2 is HTAP engine.

[0051] (2) Routing strategy based on keywords in SQL statements

[0052] The routing policy based on keywords in the SQL statement is used to determine which storage engine to forward an SQL statement from client 100 to, based on the keywords in the SQL statement. The decision criteria in this routing policy can be configured based on the keywords included in the SQL statement.

[0053] For example, assuming the storage engine 220 connected to the database middleware 230 includes TP engine, AP engine, and HTAP engine types, the routing strategy based on keywords in the SQL statement can include decision condition 1, decision condition 2, and decision condition 3. Decision condition 1 is "the SQL statement includes the keywords 'join' and 'sum'", and the storage engine type corresponding to decision condition 1 is AP engine. Decision condition 2 is "the SQL statement includes the keywords 'distinct' and 'count'", and the storage engine type corresponding to decision condition 2 is HTAP engine. Decision condition 3 is "the SQL statement does not include the keywords 'join', 'sum', 'distinct', and 'count'", and the storage engine type corresponding to decision condition 3 is TP engine.

[0054] (3) Routing strategy based on the execution cost of SQL statements

[0055] A routing policy based on the execution cost of SQL statements is used to determine the storage engine type based on the SQL statement, where the execution cost of the SQL statement includes the resources and time required to execute the SQL statement. The decision criteria in this routing policy are configured based on the execution cost of the SQL statement.

[0056] For example, assuming the storage engine 220 connected to the database middleware 230 includes TP engine and AP engine types, the routing strategy based on the execution cost of the SQL statement can include decision condition 1 and decision condition 2. Decision condition 1 is "the execution cost of the SQL statement is greater than the cost threshold," and the storage engine type corresponding to decision condition 1 is AP engine. Decision condition 2 is "the execution cost of the SQL statement is less than or equal to the cost threshold," and the storage engine type corresponding to decision condition 2 is TP engine.

[0057] (4) Routing strategy based on the historical execution time of SQL statements

[0058] A routing strategy based on the historical execution time of SQL statements instructs the forwarding of SQL statements according to their historical execution time. The decision criterion in this routing strategy can be "the SQL statement matches an SQL statement template in the SQL statement library," and the storage engine type corresponding to this criterion is the storage engine type corresponding to the matching SQL statement template. The SQL statement library includes multiple SQL statement templates and a corresponding storage engine type for each template. Each SQL statement template indicates a type of SQL statement, describing its format and content. The storage engine type corresponding to the SQL statement template indicates the storage engine type that minimizes the execution time of the SQL statement indicated by the template.

[0059] It should be understood that the above examples are merely illustrative of several routing policies that may be included in the routing policy set. In practical applications, the routing policy set may also include other routing policies, which this application does not limit.

[0060] In specific implementation, the routing strategy set can be the default routing strategy set of middleware 230, or it can be obtained by middleware 230 through the following methods: Middleware 230 provides a configuration interface, which can be implemented through an application programming interface (API) or a graphical user interface (GUI). This configuration interface includes multiple candidate routing strategies, which can include at least two of the following: routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, routing strategies based on the execution cost of the SQL statement, and routing strategies based on the historical execution time of the SQL statement. Middleware 230 can receive the user's selection operation for multiple candidate routing strategies through the above configuration interface, and determine the routing strategy set according to the selection operation. The routing strategy set includes one or more routing strategies selected by the user.

[0061] Furthermore, when the routing policy set includes multiple routing policies, the middleware 230 also obtains the priorities of these multiple routing policies. Specifically, the priorities of the multiple routing policies in the routing policy set can be the default priorities of the middleware 230. The default priorities, from highest to lowest, can be ordered as follows: routing policies based on a specified storage engine type, routing policies based on keywords in the SQL statement, routing policies based on the execution cost of the SQL statement, and routing policies based on the historical execution time of the SQL statement. Alternatively, the priorities of the multiple routing policies in the routing policy set can be obtained by the middleware 230 in the following way: the configuration interface provided by the middleware 230 can also include configuration options for routing policy priorities. Therefore, the middleware 230 can receive the user's configuration of the priorities of the selected multiple routing policies through the above configuration interface.

[0062] In step 302, client 100 sends the target SQL statement to middleware 230. Correspondingly, middleware 230 receives the target SQL statement sent by client 100.

[0063] The target SQL statement is used to instruct the HTAP system 200 to perform corresponding data operations, which can be write or read data operations. Specifically, the target SQL statement can be a Data Manipulation Language (DML) statement such as INSERT, DELETE, UPDATE, or SELECT, or a Data Definition Language (DDL) statement such as CREATE, TRNCATE, or DROP. Other database operation statements are also possible, and this application does not limit their application.

[0064] Step 303: Middleware 230 determines the target type of the storage engine based on the target SQL statement and the set of routing strategies.

[0065] Specifically, the middleware 230 determines the judgment conditions that the SQL statement meets based on the target SQL statement and the routing policies in the routing policy set, and then determines the target storage engine type as the storage engine type corresponding to the judgment condition based on the determined judgment conditions.

[0066] Since the routing policy set can include one or more routing policies, the following sections will describe how middleware 230 determines the target type of the storage engine in these two scenarios:

[0067] Case 1) The routing policy set contains only one routing policy.

[0068] In this case, the middleware 230 can determine the target type of the storage engine by comparing the target SQL statement with the decision conditions in the routing policy. The target type of the storage engine is the type of storage engine corresponding to the decision conditions satisfied by the target SQL statement.

[0069] To make it easier to understand, several examples will be used to illustrate the point below.

[0070] Example ①: The routing policy set only includes routing policies based on the specified storage engine type.

[0071] When the routing policy set only includes routing policies based on a specified storage engine type, middleware 230 can parse the target SQL statement (including lexical analysis, syntax analysis, and semantic analysis) and identify hints in the target SQL statement. The number of identified hints can be one or more. Then, middleware 230 compares the hints in the target SQL statement with the hint templates in the decision conditions to determine the decision conditions satisfied by the target SQL statement, thereby determining the target storage engine type.

[0072] It should be understood that hints in SQL statements are usually represented as strings. Therefore, the comparison between the hint in the target SQL statement and the hint template in the judgment condition involved in the above process can be implemented by string comparison. When the hint to be compared is consistent with the hint template, it means that the two match. When the hint to be compared is inconsistent with the hint template, it means that the two do not match.

[0073] Example ②: The routing strategy set only includes routing strategies based on keywords in the SQL statement.

[0074] When the routing policy set only includes routing policies based on keywords in the SQL statement, middleware 230 can parse the target SQL statement and identify the keywords in the target SQL statement, wherein the number of identified keywords can be one or more. Then, middleware 230 compares the keywords in the target SQL statement with the keywords in the decision conditions to determine the decision conditions satisfied by the target SQL statement, and thus determines the target type of the storage engine.

[0075] It should be understood that keywords in SQL statements are usually represented in the form of strings. Therefore, the comparison between the keywords in the target SQL statement and the keywords in the judgment conditions involved in the above process can be implemented by string comparison. When the keywords to be compared are the same, it means that the two match; when the keywords to be compared are different, it means that the two do not match.

[0076] Example ③: The routing strategy set only includes routing strategies based on the execution cost of SQL statements.

[0077] When the routing strategy set only includes routing strategies based on the execution cost of SQL statements, middleware 230 can parse the target SQL statement to generate an abstract syntax tree (AST), and then perform syntax and semantic checks on the AST. After the syntax and semantic checks pass, multiple execution plans for the target SQL statement are generated, including various access paths and operation sequences. Next, middleware 230 evaluates the execution cost of each execution plan and uses the minimum execution cost as the execution cost of the target SQL statement. Then, middleware 230 determines the criteria that the execution cost of the target SQL statement satisfies, thereby determining the target storage engine type.

[0078] Example 4: The routing strategy set only includes routing strategies based on the historical execution time of SQL statements.

[0079] When the routing policy set only includes routing policies based on the historical execution duration of SQL statements, the middleware 230 can determine the target storage engine type based on the matching relationship between the target SQL statement and the SQL statement template in the SQL statement library, where the target storage engine is the storage engine type corresponding to the matched SQL statement template.

[0080] Taking an SQL statement template (hereinafter referred to as "SQL statement template 1") from the SQL statement library as an example, middleware 230 can determine its matching relationship with the target SQL statement in the following way: Middleware 230 uses a word embedding model to embed the target SQL statement and SQL statement template 1 into a vector space, obtaining the vector corresponding to the target SQL statement and the vector corresponding to SQL statement template 1, and then calculates the similarity between the vector corresponding to the target SQL statement and the vector corresponding to SQL statement template 1. If the similarity between the two is greater than the similarity threshold, then the target SQL statement is determined to match SQL statement template 1; if the similarity between the two is less than or equal to the similarity threshold, then the target SQL statement is determined not to match SQL statement template 1.

[0081] It should be understood that the middleware 230 can also determine the matching relationship between other SQL statement templates in the SQL statement library and the target SQL statement in the same way as described above. For the sake of brevity, this will not be elaborated here.

[0082] Case 2) The routing policy set includes multiple routing policies.

[0083] In this scenario, middleware 230 can determine the target type of the storage engine by considering the target SQL statement, the set of routing policies, and the priority of multiple routing policies within the set of routing policies.

[0084] Specifically, assuming the routing policy set includes a first routing policy and a second routing policy, and the first routing policy has a higher priority than the second routing policy, then the middleware 230 can first compare the target SQL statement with the decision conditions in the first routing policy. If the target SQL statement satisfies a certain decision condition in the first routing policy, then the target storage engine type is determined to be the storage engine type corresponding to that decision condition. Conversely, if the target SQL statement does not satisfy all the decision conditions in the first routing policy, the middleware 230 compares the target SQL statement with the decision conditions in the second routing policy to determine the decision conditions in the second routing policy that the target SQL statement satisfies, and thus determines the target storage engine type.

[0085] To make it easier to understand, several examples will be used to illustrate the point below.

[0086] Example ①: The routing policy set includes routing policies based on a specified storage engine type and routing policies based on keywords in the SQL statement, and the routing policy based on the specified storage engine type has higher priority than the routing policy based on keywords in the SQL statement.

[0087] In this scenario, middleware 230 can first compare the target SQL statement with the decision conditions in the routing policy based on the specified storage engine type. If the target SQL statement satisfies one of the decision conditions in the routing policy based on the specified storage engine type, then the target storage engine type is determined to be the storage engine type corresponding to that decision condition. If the target SQL statement does not satisfy all the decision conditions in the routing policy based on the specified storage engine type, then the middleware 230 further compares the target SQL statement with the decision conditions in the routing policy based on keywords in the SQL statement to determine the decision conditions satisfied by the target SQL statement and obtain the target storage engine type.

[0088] Example ②: The routing strategy set includes routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, and routing strategies based on the historical execution time of the SQL statement. The priority of these routing strategies from high to low is as follows: routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, and routing strategies based on the historical execution time of the SQL statement.

[0089] In this scenario, middleware 230 can determine the target routing strategy through the following steps:

[0090] Step i: Middleware 230 compares the target SQL statement with the decision conditions in the routing policy based on the specified storage engine type. If the target SQL statement meets any decision condition in the routing policy based on the specified storage engine type, then the target storage engine type is determined to be the storage engine type corresponding to that decision condition. If the target SQL statement does not meet all decision conditions in the routing policy based on the specified storage engine type, then step ii is executed.

[0091] Step ii: Middleware 230 compares the target SQL statement with the criteria in the routing strategy based on keywords in the SQL statement. If the target SQL statement meets any criterion in the routing strategy based on keywords in the SQL statement, then the first storage engine type is determined and steps iii to v are executed, where the first storage engine type is the storage engine type corresponding to the aforementioned criterion. If the target SQL statement does not meet all the criterion in the routing strategy based on keywords in the SQL statement, then steps iii and vi are executed.

[0092] Step iii: Middleware 230 compares the target SQL statement with the SQL statement template in the SQL statement library to determine the second storage engine type, wherein the second storage engine type is the storage engine type corresponding to the matched SQL statement template.

[0093] Step iv: Determine if the first storage engine type and the second storage engine type are the same. If they are the same, determine that the target storage engine type is the first storage engine type. If they are different, proceed to step v.

[0094] Step v: Middleware 230 determines that the target type of the storage engine is the second storage engine type and prompts the user to update the routing policy based on the keywords in the SQL statement.

[0095] It should be understood that the decision conditions included in the routing strategy based on keywords in the SQL statement are configured by the user based on experience. Therefore, there may be a situation where the first storage engine type and the second storage engine type are inconsistent. In this case, executing steps iii to v can enable the middleware 230 to send the target SQL statement to a more suitable storage engine, thereby shortening the execution time of the target SQL statement. On the other hand, by prompting the user to update the routing strategy based on keywords in the SQL statement (specifically, updating the keywords in the decision conditions), the middleware 230 can ensure that the routing strategy accurately reflects which type of storage engine is more suitable.

[0096] Step vi, middleware 230 determines the target type of the storage engine as the second storage engine type.

[0097] Example ③: The routing strategy set includes routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, routing strategies based on the execution cost of the SQL statement, and routing strategies based on the historical execution time of the SQL statement. The priority of these routing strategies from high to low is as follows: routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, routing strategies based on the execution cost of the SQL statement, and routing strategies based on the historical execution time of the SQL statement.

[0098] In this scenario, middleware 230 can determine the target routing strategy through the following steps:

[0099] Step i: Middleware 230 compares the target SQL statement with the decision conditions in the routing policy based on the specified storage engine type. If the target SQL statement meets any decision condition in the routing policy based on the specified storage engine type, then the target storage engine type is determined to be the storage engine type corresponding to that decision condition. If the target SQL statement does not meet all decision conditions in the routing policy based on the specified storage engine type, then step ii is executed.

[0100] Step ii: Middleware 230 compares the target SQL statement with the criteria in the routing strategy based on keywords in the SQL statement. If the target SQL statement meets any criterion in the routing strategy based on keywords in the SQL statement, then the first storage engine type is determined and steps iii to v are executed, where the first storage engine type is the storage engine type corresponding to the aforementioned criterion. If the target SQL statement does not meet all the criterion in the routing strategy based on keywords in the SQL statement, then steps vi to ix are executed.

[0101] Step iii: Middleware 230 compares the target SQL statement with the SQL statement template in the SQL statement library to determine the second storage engine type, wherein the second storage engine type is the storage engine type corresponding to the matched SQL statement template.

[0102] Step iv: Middleware 230 determines whether the first storage engine type and the second storage engine type are consistent. If they are consistent, the target type of the storage engine is determined to be the first storage engine type. If they are inconsistent, step v is executed.

[0103] Step v: Middleware 230 determines that the target type of the storage engine is the second storage engine type and prompts the user to update the routing policy based on the keywords in the SQL statement.

[0104] Step vi and middleware 230 compare the target SQL statement with the criteria in the routing strategy based on the execution cost of the SQL statement. If the target SQL statement satisfies any criterion in the routing strategy based on the execution cost of the SQL statement, then the third storage engine type is determined and steps iii, vii, and viii are executed, where the third storage engine type is the storage engine type corresponding to the aforementioned criterion. If the target SQL statement does not satisfy all the criterion in the routing strategy based on the execution cost of the SQL statement, then step ix is ​​executed.

[0105] Step vii: Middleware 230 determines whether the first storage engine type and the third storage engine type are consistent. If they are consistent, the target storage engine type is determined to be the first storage engine type. If they are inconsistent, step viiii is executed.

[0106] Step viii: Middleware 230 determines that the target type of the storage engine is the second storage engine type and prompts the user to update the routing policy based on the execution cost of the SQL statement.

[0107] It should be understood that the cost threshold in the routing strategy based on the execution cost of SQL statements is configured by the user based on experience. Therefore, there may be a situation where the first storage engine type and the third storage engine type are inconsistent. In this case, executing steps iii, vii, and viii can enable middleware 230 to send the target SQL statement to a more suitable storage engine, thereby shortening the execution time of the target SQL statement. On the other hand, by prompting the user to update the routing strategy based on the execution cost of SQL statements (specifically, updating the cost threshold in the decision condition), middleware 230 can ensure that the routing strategy accurately reflects which type of storage engine is more suitable.

[0108] Step ix, middleware 230 determines the target type of the storage engine as the second storage engine type.

[0109] It should be understood that the above examples only illustrate the process by which middleware 230 determines the target type of the storage engine through several possible sets of routing strategies. In practical applications, the set of routing strategies may have other variations. For example, the set of routing strategies may include routing strategies based on a specified storage engine type and routing strategies based on the execution cost of SQL statements, or routing strategies based on the execution cost of SQL statements and routing strategies based on the historical execution time of SQL statements, or routing strategies based on a specified storage engine type, rule-based routing strategies, and routing strategies based on the execution cost of SQL statements, etc. For different sets of routing strategies, the process by which middleware 230 determines the target type of the storage engine can be referred to the relevant processes described in the three examples above. For the sake of brevity, these will not be elaborated further here.

[0110] In step 304, middleware 230 sends the target SQL statement to the target storage engine. Correspondingly, the target storage engine receives the target SQL statement sent by middleware 230.

[0111] The target storage engine can be one or more of the storage engines of the target type mentioned above. When there is only one target storage engine, the middleware 230 can directly send the target SQL statement to the target storage engine. When there are multiple target storage engines, the middleware 230 can send the target SQL statement to each of the multiple target storage engines, or it can select at least one target storage engine from the multiple target storage engines according to preset rules (such as data partitioning rules, load balancing rules, etc.), and then send the target SQL statement to the at least one target storage engine.

[0112] In step 305, the target storage engine executes the corresponding data operations based on the target SQL statement and sends the execution results to the middleware 230. Correspondingly, the middleware 230 receives the execution results sent by the target storage engine.

[0113] Specifically, the target storage engine generates an abstract syntax tree (AST) by parsing the target SQL statement. It then performs syntax and semantic checks on the AST. After passing these checks, it generates the optimal execution plan for the target SQL statement, which is the execution plan with the lowest execution cost. Next, the target storage engine accesses the corresponding storage node 210 according to the optimal execution plan. When the target SQL statement is a write request (e.g., inserting, deleting, or updating data), the target storage engine can insert, delete, or update data in the corresponding storage node 210. When the target SQL statement is a read request, the target storage engine can read the required data from storage node 210. Furthermore, the target storage engine can perform calculations (e.g., aggregation, analysis) on the read data and then send the results to middleware 230.

[0114] In step 306, the middleware 230 sends the execution result to the client 100. Accordingly, the client 100 receives the execution result sent by the middleware 230.

[0115] During the access process of the HTAP system 200 described in steps 301 to 306 above, the middleware 230 can automatically select a suitable storage engine 220 based on the SQL statement sent by the client 100, and send the SQL statement to that storage engine 220. After the storage engine 220 executes the SQL statement, it can also return the execution result to the client 100 through the middleware 230, thereby completing the access process of the client 100 to the HTAP system 200. Throughout the access process, the middleware 230 shields the client 100 from the underlying details of the HTAP system 200, ensuring that the client 100 does not participate in the specific process of which storage engine 220 is used for access, thus improving the user experience of the HTAP system 200.

[0116] It should be understood that although the access process of the HTAP system 200 described in steps 301 to 306 above is based on the target SQL statement, in actual applications, other SQL statements received by the middleware 230 can also refer to steps 301 to 306 above to reach the HTAP system 200, thereby realizing access to the HTAP system 200. For the sake of brevity, this application will not describe it in detail.

[0117] In some embodiments, as business expands, the data source (i.e., storage node 210) that client 100 needs to access may also change. The changed data source may include newly added data sources and / or data sources no longer accessed. The storage engine 220 corresponding to a newly added data source may not have established a connection with middleware 230, while the storage engine 220 corresponding to a no longer accessed data source may still have a connection with middleware 230. In this case, middleware 230 can also, according to user configuration, establish connections with other storage engines 220 in the HTAP system 200 (including the storage engine 220 corresponding to the newly added data source), or disconnect from storage engines 220 already connected in the HTAP system 200 (including the storage engine 220 corresponding to the no longer accessed data source). Thus, even after business expansion, access to the HTAP system 200 can still be achieved through middleware 230.

[0118] The above text combined Figures 1 to 3 This application details the access methods for the HTAP system provided in this application. The following section will combine... Figure 4 The structure of the middleware 230 that executes the above method is described.

[0119] See Figure 4 , Figure 4 A schematic diagram of the structure of a middleware 230 is shown. For example... Figure 4 As shown, the middleware 230 includes an acquisition module 231, a routing module 232, and a sending module 233. Optionally, the middleware 230 may also include a configuration module 234.

[0120] The acquisition module 231 is used to execute the step of receiving the target SQL statement sent by the client 100 in step 302 above, and the step of receiving the execution result sent by the target storage engine in step 305 above. The routing module 232 is used to execute the step 303 above. The sending module 233 is used to execute the steps 304 and 306 above. The configuration module 234 is used to execute the step 301 above, and the step of establishing or disconnecting the connection with the storage engine 220 in the HTAP system 200 according to the user's configuration.

[0121] It is understood that the specific details of any possible implementation of the relevant steps performed by each module of the middleware 230 can be referred to the relevant content of the foregoing method embodiments, and will not be repeated here.

[0122] In specific implementations, the acquisition module 231, routing module 232, sending module 233, and configuration module 234 can be implemented in software or hardware. For example, the implementation of the acquisition module 231 will be described below. Similarly, the implementation of the routing module 232, sending module 233, and configuration module 234 can refer to the implementation of the acquisition module 231.

[0123] As an example of a software functional unit, the acquisition module 231 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, the acquisition module 231 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0124] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0125] As an example of a hardware functional unit, the acquisition module 231 may include at least one computing device, such as a server. The acquisition module 231 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The aforementioned PLD can be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0126] The multiple computing devices included in the acquisition module 231 can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the acquisition module 231 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the acquisition module 231 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0127] It should be noted that, in other embodiments, the acquisition module 231 can be used to execute any step in the access method of the HTAP system described above, the routing module 232 can be used to execute any step in the access method of the HTAP system described above, the sending module 233 can be used to execute any step in the access method of the HTAP system described above, and the configuration module 234 can be used to execute any step in the access method of the HTAP system described above. The steps implemented by the acquisition module 231, the routing module 232, the sending module 233, and the configuration module 234 can be specified as needed. By implementing different steps in the access method of the HTAP system described above through the acquisition module 231, the routing module 232, the sending module 233, and the configuration module 234 respectively, all the functions of the middleware 230 can be realized.

[0128] This application also provides a computing device. The computing device can be a server, such as a server in a cloud data center, an edge server, or a local server in a local data center, or it can be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0129] See Figure 5 , Figure 5 An exemplary schematic diagram of a computing device is shown. For example... Figure 5 As shown, the computing device 300 includes a bus 301, a processor 302, a memory 303, and a communication interface 304, wherein the processor 302, the memory 303, and the communication interface 304 communicate via the bus 301. It should be understood that this application does not limit the number of processors 302 and memory 303 in the computing device 300; that is, the computing device 300 may include one or more processors 302 and one or more memories 303, but for ease of description... Figure 6 Only one processor 302 and one memory 303 are shown. The various parts of the computing device 300 are described in detail below.

[0130] Bus 301 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 5 The bus 301 is represented by only one line, but this does not mean that the computing device 300 has only one bus or one type of bus. The bus 301 may include a path for transmitting information between various components of the computing device 300 (e.g., processor 302, memory 303, and communication interface 304).

[0131] Processor 302 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0132] Memory 303 may include volatile memory, such as random access memory (RAM). Memory 303 may also include non-volatile memory, such as SSD, flash memory, read-only memory (ROM), or hard disk drive (HDD).

[0133] The memory 303 stores executable code. The processor 302 executes the code stored in the memory 303 to implement the functions of the acquisition module 231, the routing module 232, the sending module 233, and the configuration module 234, respectively, thereby realizing the access method of the HTAP system. That is to say, the memory 303 stores instructions for executing the access method of the HTAP system.

[0134] The communication interface 304 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 300 and other devices or communication networks. For example, the computing device 300 can communicate with the client 100 and the HTAP system 200 through the communication interface 304 to obtain the target SQL statement sent by the client 100 and forward the target SQL statement to the target storage engine.

[0135] It should be understood that the computing device 300 provided according to this application may correspond to the middleware 230 described above, and the functions of each component in the computing device 300 are respectively for implementing Figure 3 For the sake of brevity, the corresponding processes of each step in the method shown will not be elaborated here.

[0136] This application also provides a computing device cluster. The computing device cluster includes at least one computing device, which may be a server, such as a central server or edge server in a cloud data center, or a local server in a local data center. In some embodiments, the computing device in the computing device cluster may also be a terminal device such as a desktop computer, laptop computer, or smartphone.

[0137] See Figure 6 , Figure 6 An exemplary schematic diagram of a computing device cluster is shown. For example... Figure 6 As shown, the computing device cluster includes at least one computing device 300. The memory 303 of one or more computing devices 300 in the computing device cluster may store the same instructions for executing the access methods of the HTAP system described above.

[0138] In some possible implementations, the memory 303 of one or more computing devices 300 in the computing device cluster may also store partial instructions for executing the access method of the HTAP system described above. In other words, a combination of one or more computing devices 300 can jointly execute the instructions of the access method of the HTAP system described above.

[0139] It should be noted that the memory 303 of different computing devices 300 in the computing device cluster can store different instructions, which are used to execute some functions of the middleware 230 respectively. That is, the instructions stored in the memory 303 of different computing devices 300 can realize the functions of one or more modules among the acquisition module 231, routing module 232, sending module 233 and configuration module 234.

[0140] In some possible implementations, one or more computing devices 300 in a computing device cluster can be connected via a network, which can be a wide area network or a local area network, etc. Figure 7 One possible implementation is shown. For example... Figure 7As shown, computing devices 300A and 300B are connected via a network. Specifically, they are connected to the network through communication interfaces in computing devices 300A and 300B. In this implementation, the memory 303 in both computing devices 300A and 300B stores instructions for implementing the functions of the acquisition module 231, routing module 232, sending module 233, and configuration module 234.

[0141] Figure 7 The connection method between computing devices 300 in the computing device cluster shown can take into account high-concurrency computing scenarios, such as multiple clients 100 needing to access HTAP system 200 at the same time. In this case, computing devices 300A and 300B can jointly forward a large number of SQL statements from multiple clients 100, which can improve the access efficiency of HTAP system 200.

[0142] It should be understood that Figure 7 The functions of the computing device 300A shown can also be performed by multiple computing devices 300. Similarly, the functions of the computing device 300B can also be performed by multiple computing devices 300.

[0143] It should also be understood that the computing device cluster provided according to this application may correspond to the middleware 230 described above, and the functions of each component in the computing device cluster are respectively for implementing Figure 3 For the sake of brevity, the corresponding processes of each step in the method shown will not be elaborated here.

[0144] This application also provides a computer program product containing instructions. This computer program product may be a software or program product containing instructions that can run on a computing device or be stored on any available medium. When the computer program product runs on a computing device, it causes the computing device to perform the access method of the HTAP system described above.

[0145] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives). The computer-readable storage medium includes instructions that instruct the computing device to perform the access method of the HTAP system described above.

[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. An access method for a hybrid transactional and analytical processing (HTAP) system, characterized in that, The method is applied to middleware of an HTAP system. The middleware is connected to multiple storage engines in the HTAP system. The middleware forwards multiple SQL statements from clients of the HTAP system to the multiple storage engines through the connection. The multiple storage engines include at least two of the following: transaction processing (TP) engine, analytical processing (AP) engine, and HTAP engine. The method includes: Receive the target Structured Query Language (SQL) statement from the client; Based on the target SQL statement and the set of routing strategies configured in the middleware, the target type of the storage engine is determined. The target type is one of the multiple types of storage engines. The set of routing strategies includes one or more routing strategies, and each routing strategy includes a decision condition and a corresponding storage engine type. Send the target SQL statement to the target storage engine, which is one or more storage engines of the target type.

2. The method according to claim 1, characterized in that, The routing strategy set includes one or more of the following: routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, routing strategies based on the execution cost of the SQL statement, and routing strategies based on the historical execution time of the SQL statement.

3. The method according to claim 1 or 2, characterized in that, The step of determining the target type of the storage engine based on the target SQL and the set of routing policies configured in the middleware includes: Determine the criteria that the SQL statement satisfies; Based on the determined criteria, the target type of the storage engine is determined to be the storage engine type corresponding to the determined criteria.

4. The method according to any one of claims 1 to 3, characterized in that, The routing policy set includes multiple routing policies, and the middleware is also configured with the priority of the multiple routing policies; The step of determining the target type of the storage engine based on the target SQL and the set of routing policies configured in the middleware includes: The target type of the storage engine is determined based on the target SQL statement, the routing policy set, and the priority of multiple routing policies in the routing policy set.

5. The method according to claim 4, characterized in that, The routing policy set includes a first routing policy and a second routing policy, wherein the first routing policy has a higher priority than the second routing policy. Determining the target type based on the target SQL statement, the routing policy set, and the priority includes: When the target SQL statement does not meet all the determination conditions in the first routing strategy, the target type of the storage engine is determined according to the second routing strategy.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: A configuration interface is provided, which includes multiple candidate routing policies; The configuration interface receives the user's selection of the multiple candidate routing strategies. The set of routing policies is determined based on the selection operation.

7. A middleware, characterized in that, The middleware is deployed on the HTAP system and is connected to multiple storage engines in the HTAP system. The middleware forwards multiple SQL statements from the HTAP system client to the multiple storage engines through the connection. The multiple storage engines include at least two of the following: transaction processing (TP) engine, analytical processing (AP) engine, and HTAP engine. The middleware includes: The acquisition module is used to receive the target Structured Query Language (SQL) statement from the client; The routing module is used to determine the target type of the storage engine based on the target SQL statement and the set of routing strategies configured in the middleware. The target type is one of the multiple types of storage engines. The set of routing strategies includes one or more routing strategies, and each routing strategy includes a decision condition and a corresponding storage engine type. The sending module is used to send the target SQL statement to the target storage engine, wherein the target storage engine is one or more storage engines of the target type.

8. The middleware according to claim 7, characterized in that, The routing strategy set includes one or more of the following: routing strategies based on a specified storage engine type, routing strategies based on keywords in the SQL statement, routing strategies based on the execution cost of the SQL statement, and routing strategies based on the historical execution time of the SQL statement.

9. The middleware according to claim 7 or 8, characterized in that, The routing module is used to determine the judgment conditions satisfied by the SQL statement; and based on the determined judgment conditions, to determine the target type of the storage engine as the storage engine type corresponding to the judgment conditions.

10. The middleware according to any one of claims 7 to 9, characterized in that, The routing policy set includes multiple routing policies, and the middleware is also configured with the priority of the multiple routing policies; The routing module is used to determine the target type of the storage engine based on the target SQL statement, the routing policy set, and the priority of multiple routing policies in the routing policy.

11. The middleware according to any one of claims 10, characterized in that, The routing policy set includes a first routing policy and a second routing policy, wherein the first routing policy has a higher priority than the second routing policy. The routing module is used to determine the target type of the storage engine according to the second routing strategy when the target SQL statement does not meet all the determination conditions in the first routing strategy.

12. The middleware according to any one of claims 7 to 11, characterized in that, The middleware also includes: A configuration module is used to provide a configuration interface, which includes multiple candidate routing strategies; through the configuration interface, the module receives user selection operations on the multiple candidate routing strategies; and determines the routing strategy set based on the selection operations.

13. A hybrid transactional and analytical processing (HTAP) system, characterized in that, Includes the middleware as described in any one of claims 1 to 6 and multiple types of storage engines, wherein the middleware is connected to the multiple types of storage engines, and the middleware forwards multiple SQL statements from the client of the HTAP system to the multiple types of storage engines through the connection, and the multiple types of storage engines include at least two of the following: transaction processing (TP) engine, analytical processing (AP) engine, and HTAP engine. The middleware is configured to receive a target Structured Query Language (SQL) statement from the client; determine the target type of the storage engine based on the target SQL statement and a set of routing strategies configured in the middleware, wherein the target type is one of the multiple types of storage engines, and the set of routing strategies includes one or more routing strategies, each of which includes a decision condition and a corresponding storage engine type; and send the target SQL statement to the target storage engine, wherein the target storage engine is one or more of the storage engines of the target type. The target storage engine is used to execute the target SQL statement.

14. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 6.

15. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the method as described in any one of claims 1 to 6.

16. A computer-readable storage medium, characterized in that, Includes computer program instructions, which, when executed by a cluster of computing devices, enable the computing devices to perform the method as described in any one of claims 1 to 6.