Database processing method

By introducing batch pre-compilation and execution requests into the database system, the problems of network round trips and resource overhead when the database system processes multi-statement templates are solved, achieving efficient multi-statement template processing and improving system performance and throughput.

CN121658012AActive Publication Date: 2026-03-13JIANGSU HUAKU DATA TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-06
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing technologies, database systems suffer from frequent network round trips, high resource consumption, and significant protocol overhead when processing a large number of statement templates, leading to performance bottlenecks, especially in high-latency network environments.

Method used

By defining new batch pre-compilation requests and batch execution requests, clients are allowed to encapsulate multiple statement templates in a single network communication and perform batch pre-compilation and execution at the database kernel level, reducing the number of network interactions, lowering server resource load, and improving the overall system throughput.

Benefits of technology

It enables efficient and reliable batch processing of multi-statement templates in database systems, reducing network latency and server load, and improving system performance and throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121658012A_ABST
    Figure CN121658012A_ABST
Patent Text Reader

Abstract

The invention provides a database processing method which can be applied to the technical field of data processing. The method comprises the following steps: receiving a batch pre-compiling request from a client; performing batch pre-compilation on the plurality of statement templates indicated by the batch pre-compilation request to generate an executable resource set comprising respective executable resources of the plurality of statement templates; according to the executable resource set, a batch execution plan identifier and a plurality of execution plan identifiers are created, and the execution plan identifiers are used for citing executable resources corresponding to the statement template in the executable resource set; sending a batch execution plan identifier and a plurality of execution plan identifiers to the client, the batch execution plan identifier and the plurality of execution plan identifiers being provided by the client in a batch execution request sent to a database, the batch execution request is used for indicating the database to execute the executable resource set according to the batch execution plan identifier, the plurality of execution plan identifiers and template parameters provided by the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically to a database processing method. Background Technology

[0002] Database systems typically employ prepared statement mechanisms to optimize the performance of repeatedly executing the same structured statements. However, this approach suffers from frequent network round trips when dealing with a large number of statement templates. Summary of the Invention

[0003] In view of the above problems, this application provides a database processing method.

[0004] According to a first aspect of the embodiments of this application, a database processing method is provided, comprising: receiving a batch pre-compilation request from a client; performing batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request to generate an executable resource set including executable resources of each of the multiple statement templates; creating a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set, wherein the batch execution plan identifier is used to reference the executable resource set, and the execution plan identifiers are used to reference executable resources in the executable resource set corresponding to the statement templates; and sending the batch execution plan identifier and multiple execution plan identifiers to the client, wherein the batch execution plan identifier and multiple execution plan identifiers are provided by the client in a batch execution request sent to the database, and the batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, the multiple execution plan identifiers, and template parameters provided by the client.

[0005] Optionally, the database processing method further includes: receiving a batch execution request from a client, wherein the batch execution request indicates a batch execution plan identifier, multiple execution plan identifiers, and at least one template parameter associated with each of the multiple execution plan identifiers; determining an executable resource set including executable resources of multiple statement templates based on the batch execution plan identifiers; binding the multiple template parameters to the executable resources of the statement templates corresponding to the execution plan identifiers, based on the execution plan identifiers associated with each of the multiple template parameters, to obtain multiple executable tasks; executing the multiple executable tasks to obtain the execution results of each of the multiple executable tasks; and sending the multiple execution results to the client.

[0006] Optionally, executing multiple executable tasks and obtaining the execution results of each of the multiple executable tasks includes: executing multiple executable tasks in the order determined by a predetermined execution strategy and obtaining the execution results of each of the multiple executable tasks, wherein the predetermined execution strategy includes executing in the order indicated by the batch execution request or executing in the order determined by the execution attributes of the executable tasks.

[0007] Optionally, the database operations indicated by the batch execution request are executed within a single database transaction. These database operations are generated by executing multiple executable tasks and involve reading and writing to the database's persistent state.

[0008] Optionally, sending multiple execution results to the client includes: generating at least one execution data packet based on the multiple execution results, wherein the number of execution data packets is less than the number of execution results; and sending at least one execution data packet to the client.

[0009] Optionally, multiple statement templates indicated by the batch pre-compilation request are batch pre-compiled to generate an executable resource set including the executable resources of each statement template. This includes: performing batch syntax analysis and batch semantic analysis on the multiple statement templates indicated by the batch pre-compilation request, wherein multiple statement templates with a structural similarity greater than or equal to a predetermined threshold share the analysis results; and generating the executable resources of each statement template based on the analysis results to obtain the executable resource set.

[0010] Optionally, based on the analysis results, generate executable resources for each of the multiple statement templates, including: if the analysis results determine that multiple statement templates access the same database object, generate executable resources for each of the multiple statement templates based on the access permission verification results performed on the database object.

[0011] Optionally, based on the analysis results, multiple executable resources for each statement template are generated to obtain an executable resource set, including: generating multiple executable resources for each statement template in parallel based on the analysis results to obtain an executable resource set.

[0012] A second aspect of this application provides a database processing method, comprising: sending a batch pre-compilation request to a database, so that the database performs batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request to generate an executable resource set including executable resources of each of the multiple statement templates; creating a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set, wherein the batch execution plan identifier is used to reference the executable resource set, and the execution plan identifiers are used to reference the executable resources in the executable resource set corresponding to the statement templates; and receiving the batch execution plan identifier and multiple execution plan identifiers from the database, wherein the batch execution plan identifier and multiple execution plan identifiers are provided by the client in a batch execution request sent to the database, and the batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, the multiple execution plan identifiers, and template parameters provided by the client.

[0013] Optionally, the batch pre-compilation request is obtained by configuring the request type field and the first payload field in the application layer protocol, wherein the request type field is used to identify the batch pre-compilation request as a new pre-compilation request, and the first payload field is used to carry multiple statement templates; and / or, wherein sending the batch pre-compilation request to the database includes: sending the batch pre-compilation request to the database via a single communication; and / or, wherein the batch execution request is obtained by configuring the command code field, the batch execution plan identifier field, and the second payload field in the remote execution protocol, wherein the command code field is used to identify the batch execution request as a new execution request, and the second payload field is used to carry the batch execution plan identifier, multiple execution plan identifiers, and template parameters provided by the client; and / or, wherein the batch execution request is sent by the client to the database via a single communication.

[0014] A third aspect of this application provides a database processing apparatus, comprising: a request receiving module for receiving a batch pre-compilation request from a client; a pre-compilation module for batch pre-compiling multiple statement templates indicated by the batch pre-compilation request to generate an executable resource set including executable resources of each of the multiple statement templates; a creation module for creating a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set, wherein the batch execution plan identifier is used to reference the executable resource set, and the execution plan identifier is used to reference the executable resources in the executable resource set corresponding to the statement templates; and an identifier sending module for sending the batch execution plan identifier and multiple execution plan identifiers to the client, wherein the batch execution plan identifier and multiple execution plan identifiers are provided by the client in a batch execution request sent to the database, and the batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, the multiple execution plan identifiers, and template parameters provided by the client.

[0015] A fourth aspect of this application provides a database processing apparatus, comprising: a request sending module, configured to send a batch pre-compilation request to a database, so that the database performs batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request, generating an executable resource set including executable resources of each of the multiple statement templates; and creating a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set, wherein the batch execution plan identifier is used to reference the executable resource set, and the execution plan identifiers are used to reference executable resources in the executable resource set corresponding to the statement templates; and an identifier receiving module, configured to receive the batch execution plan identifier and multiple execution plan identifiers from the database, wherein the batch execution plan identifier and multiple execution plan identifiers are provided by a client in a batch execution request sent to the database, and the batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, the multiple execution plan identifiers, and template parameters provided by the client.

[0016] A fifth aspect of this application provides an electronic device, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the database processing method described above.

[0017] A sixth aspect of this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed, are used to implement the database processing method described above.

[0018] A seventh aspect of this application provides a computer program product including computer-executable instructions that, when executed, implement the method described above. Attached Figure Description

[0019] The above and other objects, features and advantages of this application will become clearer from the following description of embodiments of this application with reference to the accompanying drawings.

[0020] Figure 1 A schematic diagram of the system architecture of a database according to an embodiment of this application is shown.

[0021] Figure 2 A flowchart of a database processing method according to an embodiment of this application is shown.

[0022] Figure 3 A flowchart of batch pre-compilation according to an embodiment of this application is shown.

[0023] Figure 4 A flowchart of a database processing method according to another embodiment of this application is shown.

[0024] Figure 5A A schematic diagram illustrating the processing of batch pre-compilation requests according to an embodiment of this application is shown.

[0025] Figure 5B A schematic diagram illustrating the processing of batch execution requests according to an embodiment of this application is shown.

[0026] Figure 6 A structural block diagram of a database processing apparatus according to an embodiment of this application is shown.

[0027] Figure 7 A structural block diagram of a database processing apparatus according to another embodiment of this application is shown.

[0028] Figure 8 A block diagram of an electronic device suitable for implementing a database processing method according to an embodiment of this application is shown. Detailed Implementation

[0029] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.

[0030] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0031] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0032] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0033] The pre-compilation process involves the client first sending a statement template to the database for pre-compilation. The server returns a plan identifier representing the pre-compiled statement. The client uses the plan identifier along with different parameters and sends it to the database. The database executes the relevant pre-compilation plan resources based on the plan identifier and parameters.

[0034] In related technologies, when a client needs to process multiple different statement templates in a single transaction or business logic, such as mixing INSERT, UPDATE, and DELETE statement templates in a complex order processing flow, the database architecture has the following performance bottlenecks.

[0035] First, there is significant network latency. Each statement template requires an independent network round trip (request-response) for pre-compilation. In a processing scenario involving N statement templates, the pre-compilation stage alone requires N network round trips. In high-latency network environments, such as wide area networks, cross-cloud service calls, or microservice architectures, the accumulated network latency becomes a performance bottleneck.

[0036] Secondly, it incurs significant resource overhead. The database needs to perform a series of CPU-intensive operations sequentially for each independent pre-compiled request, including syntax analysis, semantic checking, permission verification, and execution plan generation. When a large number of statement templates are requested for pre-compilation simultaneously, this can cause multiple spikes in CPU resource load and increase the overall latency of query processing.

[0037] Third, the protocol overhead is significant. Both independent pre-compilation requests and execution requests include fixed protocol header and footer overhead. For a large number of short statement templates, this accumulated protocol overhead consumes a significant portion of network bandwidth, reducing network transmission efficiency.

[0038] In summary, although the relevant technologies allow for batch processing of parameters for the same statement template, they are unable to fundamentally solve the performance bottleneck in the pre-compilation stage of multiple statement templates.

[0039] In view of this, embodiments of this application provide a database processing method. By defining a new batch pre-compilation request, a client can encapsulate multiple statement templates in a single network communication and submit them to the database all at once. A batch pre-compilation processor is added at the database kernel level, thereby supporting the parsing of batch pre-compilation requests and the batch pre-compilation processing of multiple statement templates. A batch execution plan identifier and multiple execution plan identifiers are sent in a single network communication. A new batch execution request is also defined, allowing the client to send the batch execution plan identifier, multiple execution plan identifiers, and client-provided template parameters in a single network communication, thus enabling batch execution by the database. This native addition at the database kernel level and the client-database interaction protocol level achieves end-to-end performance optimization from the client to the database kernel, supporting efficient batch processing of multiple statement templates. This reduces the number of network interactions, lowers server resource load, and improves overall system throughput. In high-latency networks or microservice architectures, it reduces network latency and improves performance, solving the problem of multiple network round trips and high server load caused by individual pre-compilation of multiple statement templates. By merging multiple pre-compilation requests and multiple execution requests for multiple statement templates into a single pre-compilation request and a single execution request, protocol header and footer overhead is reduced, and network transmission efficiency is improved.

[0040] To facilitate understanding of the technical solutions in the embodiments of this application, some terms involved in the embodiments of this application will be explained below.

[0041] A batch pre-compile request is used to instruct the batch pre-compile of multiple statement templates.

[0042] The statement template is a pre-compiled and parameterized Structured Query Language (SQL) template. For example, the statement template is SELECT c1,c2 FROM t1 WHERE id=?.

[0043] An executable resource representation consists of a sequence of execution operations with placeholders but no parameters. During execution, an execution plan can be generated by binding external template parameters, eliminating the need for further parsing and optimization. An executable resource set comprises multiple executable resources.

[0044] Batch execution plan identifiers are used to reference sets of executable resources. Execution plan identifiers are used to reference the executable resources within the executable resource set that correspond to the statement template.

[0045] A batch execution request is used to instruct the database to execute a set of executable resources based on the batch execution plan identifier, multiple execution plan identifiers, and template parameters provided by the client.

[0046] Template parameters are used to define replaceable placeholders or configurable variables, allowing the same statement template to generate different execution results based on the input parameters.

[0047] Figure 1 A schematic diagram of the system architecture of a database according to an embodiment of this application is shown.

[0048] like Figure 1 As shown, database 110 includes a protocol processor, an identifier manager, a batch pre-compilation processor, a syntax / semantic processor, an execution plan generator, a resource manager, a batch execution engine, and a database storage layer.

[0049] More specifically, client 120 sends a batch pre-compilation request to the database via a single network communication. This batch pre-compilation request encapsulates multiple statement templates. The protocol processor identifies the batch pre-compilation request and sends it to the pre-compilation processor. The pre-compilation processor parses the batch pre-compilation request. The batch syntax / semantic analyzer analyzes the multiple statement templates. The batch execution plan generator generates executable resources for each statement template, resulting in an executable resource set. The resource manager allocates resources and memory, and sends the executable resource set to the database storage layer, implementing caching of the executable resource set. The identifier manager generates a batch execution plan identifier for the executable resource set and an execution plan identifier for each executable resource, and sends the batch execution plan identifier and multiple execution plan identifiers to the pre-compilation processor. The pre-compilation processor then sends the batch execution plan identifier and multiple execution plan identifiers to the client via the protocol processor.

[0050] Optionally, the client sends a batch execution request to the database via a single network communication. The protocol processor identifies the batch execution request and sends it to the batch execution engine. The batch execution engine parses the batch execution request to obtain the batch execution plan identifier, execution plan identifier, and template parameters. It then calls the resource manager to sequentially retrieve executable resources corresponding to the execution plan identifiers from the cache and resource pool, and sends these executable resources to the batch execution engine. The batch execution engine binds multiple template parameters to the executable resources, resulting in multiple executable tasks. Within a single transaction, these multiple executable tasks are submitted to the database storage layer in sequence or an optimized order. The execution results of these multiple executable tasks are obtained, and the batch execution results are combined. The database storage layer then sends the batch execution results to the client via the protocol processor.

[0051] It should be noted that the sequence numbers of the operations in the following methods are for descriptive purposes only and should not be considered as indicating the execution order of the operations. Unless explicitly stated otherwise, the method does not need to be executed in the exact order shown.

[0052] Figure 2 A flowchart of a database processing method according to an embodiment of this application is shown.

[0053] like Figure 2 As shown, the method 200 includes operations S210 to S240.

[0054] In operation S210, a batch pre-compilation request is received from the client.

[0055] In operation S220, multiple statement templates indicated by the batch pre-compilation request are batch pre-compiled to generate an executable resource set including the executable resources of each statement template.

[0056] In operation S230, a batch execution plan identifier and multiple execution plan identifiers are created based on the executable resource set.

[0057] In operation S240, a batch execution plan identifier and multiple execution plan identifiers are sent to the client.

[0058] The database processing method is executed by the database server. It receives batch pre-compilation requests sent by the client via a single network communication, adds a batch pre-compilation processor in the database kernel, calls the pre-compilation processor in the database to parse the batch pre-compilation requests, and obtains multiple statement templates indicated by the batch pre-compilation requests.

[0059] For example, the client sends a batch pre-compilation request BATCH_PREPARE to the database. The database parses the batch pre-compilation request and obtains the number of statement templates sql_count=3, and the statement templates sql1="INSERT...", sql2="UPDATE...", and sql3="DELETE...".

[0060] The batch pre-compilation process may include: calling a batch syntax and semantic analyzer to perform unified parsing and verification of multiple statement templates; after verification, calling a batch execution plan generator to generate executable resources for each of the multiple statement templates; and the executable resource set includes multiple executable resources.

[0061] The executable resource set is cached in the execution plan cache. The resource manager is called to allocate memory for multiple statement templates and create the corresponding internal structure in the pre-compiled statement pool. Then, the identifier manager is called to generate a unique batch execution plan identifier batch_statement_id for the executable resource set and a unique execution plan identifier sub_handles for each executable resource.

[0062] The database sends a batch execution plan identifier and multiple execution plan identifiers to the client. For example, the batch execution plan identifier is batch_statement_id=12345, and the execution plan identifier is sub_handle=[0, 1, 2].

[0063] After receiving the batch execution plan identifier and multiple execution plan identifiers, the client associates the template parameters with the execution plan identifiers based on the mapping relationship between the statement template and the template parameters, as well as the mapping relationship between the execution plan identifier and the statement template, to generate an association relationship, and then sends a batch execution request to the database via a single network communication.

[0064] For example, the client sends a batch execution request `BATCH_EXECUTE` to the database. The database's batch execution engine parses the request, obtaining the batch execution plan identifier `batch_statement_id=12345`, the number of associated relationships `params_count=3`, and the associated relationships `params_set=[{sub_handle:0, args:["val1"]},{sub_handle:1, args:["val2", 100]}, {sub_handle:0, args:["val3"]}]`. Here, `{sub_handle:0, args:["val1"]}` represents the execution plan identifier 0 being associated with the template parameter "val1", and `{sub_handle:1,args:["val2", 100]}` represents the association between the execution plan identifier 0 and the template parameter "val1". The execution plan identifier 1 is associated with the template parameter "val2" and 100. {sub_handle:0,args:["val3"]} represents the execution plan identifier 0 and the template parameter "val3". sub_handle is the execution plan identifier field and args is the template parameter field.

[0065] The database first determines the corresponding set of executable resources based on the batch execution plan identifier. Then, based on the template parameters associated with each of the multiple execution plan identifiers, it sequentially binds the template parameters associated with the execution plan identifiers to the executable resources corresponding to the execution plan identifiers in the set of executable resources to instantly generate physical execution plans. The physical execution plans are then executed to obtain the execution results of the statement templates corresponding to the executable resources.

[0066] For example, the execution result is that a row of data is successfully inserted into table c1.

[0067] By defining a new batch pre-compilation request, allowing clients to encapsulate multiple statement templates in a single network communication and submit them to the database server all at once, a new batch pre-compilation processor is added at the database server kernel level. This supports parsing the batch pre-compilation request and processing multiple statement templates in batches, sending batch execution plan identifiers and multiple execution plan identifiers in a single network communication. A new batch execution request is also defined, allowing clients to send batch execution plan identifiers, multiple execution plan identifiers, and client-provided template parameters in a single network communication, enabling batch execution by the database. This native addition at the database kernel level and the client-database interaction protocol level achieves end-to-end performance optimization from the client to the database kernel, supporting efficient batch processing of multiple statement templates. It reduces the number of network interactions, lowers server resource load, and improves overall system throughput. In high-latency networks or microservice architectures, it reduces network latency and improves performance, resolving the technical issues of multiple network round trips and high server load caused by separate pre-compilation of multiple statement templates.

[0068] Optionally, multiple statement templates indicated by the batch pre-compilation request are batch pre-compiled to generate an executable resource set including the executable resources of each statement template. This includes: performing batch syntax analysis and batch semantic analysis on the multiple statement templates indicated by the batch pre-compilation request, wherein multiple statement templates with a structural similarity greater than or equal to a predetermined threshold share the analysis results; and generating the executable resources of each statement template based on the analysis results to obtain the executable resource set.

[0069] The batch parser is invoked to perform unified batch parsing on multiple statement templates, including: performing lexical and grammatical checks on multiple statement templates in parallel or pipelined manner, generating parse trees, and obtaining a "grammatically correct or incorrect" status.

[0070] Based on grammatically correct results, the batch semantic analyzer is invoked to perform name parsing, type inference, permission verification, and view expansion on the parse tree, resulting in a "semantically correct or incorrect" status and analysis results.

[0071] Structural similarity represents the degree of similarity between multiple statement templates at the parse tree level, and can be quantified using algorithms such as edit distance or tree kernel functions. If the structural similarity exceeds a predetermined threshold, multiple statement templates can share this analysis result.

[0072] The predetermined threshold is a shareable threshold configured by the system and can be dynamically adjusted within the range of (0.8, 1.0).

[0073] The analysis results are reusable intermediate products obtained after performing syntax and semantic analysis on the statement template, including at least: parse tree, bound metadata (field type, precision, nullability), permission verification conclusion, and execution plan skeleton (excluding specific constants).

[0074] The analysis results are cached in a shared pool, and subsequent statement templates with similar structures can be directly referenced without having to go through the analysis process again.

[0075] The batch execution plan generator is invoked to generate executable resources based on the analysis results. Executable resources are binary or intermediate code that can be directly loaded and run by the database's batch execution engine. Executable resources include bytecode and pre-compiled entry addresses.

[0076] Each statement template corresponds to an executable resource.

[0077] The executable resource set is a collection of executable resources corresponding to all statement templates indicated by this batch pre-compilation request. It is returned to the client in the form of an array, a list of identifiers, or a mapping table for sequential invocation in subsequent "batch execution" phases.

[0078] Multiple statement templates can be subjected to one-time lexical, syntactic and semantic analysis. Multiple statement templates with high structural similarity can share the analysis results to improve efficiency. Batch syntactic analysis and batch semantic analysis allow the database kernel to optimize the parsing and compilation process, reduce repetitive syntactic and semantic analysis work, and thus reduce the server's computing resource overhead.

[0079] Optionally, based on the analysis results, generate executable resources for each of the multiple statement templates, including: if the analysis results determine that multiple statement templates access the same database object, generate executable resources for each of the multiple statement templates based on the access permission verification results performed on the database object.

[0080] Database objects are named entities in the database system directory that can be independently granted permissions, including tables, views, materialized views, sequences, stored procedures, functions, packages, synonyms, etc.

[0081] Database objects serve as the smallest unit of permission verification. If multiple statement templates access the same database object, permission checks will only be performed on that database object once.

[0082] For example, the database object is the table t_order.

[0083] Iterate through the analysis results of each statement template and determine whether multiple statement templates access the same database object based on the consistency of object identifiers within the analysis results.

[0084] The access permission verification result is the verification information obtained after performing permission judgment on the database object with the current session role. The access permission verification result is cached in the "object-permission cache pool". When the same database object is reused in subsequent statement templates, it is directly referenced and the system directory is not queried again.

[0085] If the access permission verification result is true (verification passed), the batch execution plan generator is invoked to convert the analysis results into executable resources; if the access permission verification result is false (verification failed), an "access denied" exception result is generated.

[0086] By defining the case where multiple statement templates access the same database object, an access permission verification is performed only once for the database object. This reduces the number of permission checks that originally increased linearly with the number of statement templates, thereby reducing permission verification latency in high-concurrency scenarios and improving overall batch processing throughput.

[0087] Optionally, based on the analysis results, multiple executable resources for each statement template are generated to obtain an executable resource set, including: generating multiple executable resources for each statement template in parallel based on the analysis results to obtain an executable resource set.

[0088] The batch execution plan generator is invoked to create executable resources in parallel for multiple statement templates. Based on the multiple executable resources, an executable resource set is obtained.

[0089] Based on the analysis results, including the parse tree, type vector, permission verification conclusions, and execution plan skeleton, executable resources that can be directly loaded by the batch execution engine are compiled.

[0090] By utilizing parallel computing resources, the pre-compilation time, which originally increased linearly with the number of statement templates, was compressed, thereby improving pre-compilation efficiency and reducing pre-compilation latency.

[0091] Figure 3 A flowchart of batch pre-compilation according to an embodiment of this application is shown.

[0092] like Figure 3 As shown, batch pre-compilation includes operations S301 and S318.

[0093] When operating S301, receive batch pre-compilation requests.

[0094] In operation S302, parse batch pre-compilation requests.

[0095] In operation S303, extract multiple statement templates.

[0096] In operation S304, determine whether the number of templates is equal to the preset number of templates. If yes, proceed to operation S305; otherwise, proceed to operation S306.

[0097] Operation S305 returned an error response, and operation S318 was initiated.

[0098] In operation S306, batch syntax parsing.

[0099] During S307 operation, batch semantic parsing is performed.

[0100] Operating S308, performing batch permission verification.

[0101] In operation S309, determine if an error statement template exists. If yes, proceed to operation S310; otherwise, proceed to operation S311.

[0102] In operation S310, return the marked error statement template and proceed to operation S318.

[0103] In operation S311, determine whether parallel processing is supported. If yes, proceed to operation S312; otherwise, proceed to operation S313.

[0104] In operation S312, multiple executable resources are generated in parallel. Proceed to operation S314.

[0105] In operation S313, multiple executable resources are generated serially. Proceed to operation S314.

[0106] In operation S314, batch execution plan identifier and execution plan identifier are generated.

[0107] In operation S315, cache executable resources, batch execution plan identifiers, and execution plan identifiers.

[0108] In operation S316, a response data packet is generated.

[0109] When operating S317, a response data packet is sent to the client.

[0110] Operation S318 has ended.

[0111] Figure 4 A flowchart of a database processing method according to another embodiment of this application is shown.

[0112] like Figure 4 As shown, the method 400 includes operations S410 to S420.

[0113] In operation S410, a batch pre-compilation request is sent to the database so that the database can perform batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request, generate an executable resource set including the executable resources of each of the multiple statement templates, and create a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set.

[0114] In operation S420, a batch execution plan identifier and multiple execution plan identifiers are received from the database.

[0115] The database processing method is applied at the client layer. The client layer sends batch pre-compilation requests to the database, and the batch pre-compilation requests are bound to multiple statement templates.

[0116] The database parses the batch pre-compilation request to obtain multiple statement templates, performs batch pre-compilation on the multiple statement templates, generates an executable resource set including the executable resources of each statement template, and creates a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set.

[0117] The batch execution plan identifier is used to reference the set of executable resources, and the execution plan identifier is used to reference the executable resource in the set of executable resources that corresponds to the statement template.

[0118] The database sends a batch execution plan identifier and multiple execution plan identifiers to the client.

[0119] The client calls the parameter addition function addBatch() to add template parameters to the statement template. Based on the mapping relationship between the execution plan identifier and the statement template, the template parameters are associated with the execution plan identifier. Then, a batch execution request is sent to the database. The batch execution request carries the batch execution plan identifier and the template parameters associated with each of the multiple execution plan identifiers.

[0120] A batch execution request is used to instruct the database to execute a set of executable resources based on the batch execution plan identifier, multiple execution plan identifiers, and template parameters provided by the client.

[0121] The database sends a batch execution plan identifier and multiple execution plan identifiers to the client via a single network communication. The client then sends a batch execution request to the client via a single network communication. Thus, the database binds each of the multiple template parameters to the executable resource of the statement template corresponding to the execution plan identifier based on the execution plan identifier associated with each of the multiple template parameters. This means that the operation that originally required N network communications for execution plan identifiers and N network communications for execution requests for N statement templates can be completed in only 2 network communications, which greatly improves efficiency and reduces network latency.

[0122] Optionally, the batch pre-compilation request is obtained by configuring the request type field and the first payload field in the application layer protocol, wherein the request type field is used to identify the batch pre-compilation request as a new pre-compilation request, and the first payload field is used to carry multiple statement templates; and / or, wherein sending the batch pre-compilation request to the database includes: sending the batch pre-compilation request to the database via a single communication; and / or, wherein the batch execution request is obtained by configuring the command code field, the batch execution plan identifier field, and the second payload field in the remote execution protocol, wherein the command code field is used to identify the batch execution request as a new execution request, and the second payload field is used to carry the batch execution plan identifier, multiple execution plan identifiers, and template parameters provided by the client; and / or, wherein the batch execution request is sent by the client to the database via a single communication.

[0123] Application layer protocols are high-level communication specifications used between clients and database servers to exchange messages. They are responsible for message formatting, field encoding, request or response status maintenance, and error handling. An example is the Hypertext Transfer Protocol (HTTP).

[0124] In the application layer protocol, request type field, transaction identifier field, and first load field can be configured to obtain globally effective batch pre-compilation requests, thereby driving the database to perform batch pre-compilation analysis operations on multiple statement templates.

[0125] The request type field is used to identify whether a batch pre-compilation request is a new pre-compilation request.

[0126] The transaction identifier field is used to identify the global transaction corresponding to the batch pre-compilation request.

[0127] The first payload field is used to carry the template data package corresponding to the batch pre-compiled request. The template data package encapsulates multiple statement templates.

[0128] After the application layer protocol is configured, the client sends a batch pre-compilation request to the database via a single communication.

[0129] Remote execution protocols are variants that build upon application-layer protocols, adding command codes, message types, or extended headers to support advanced capabilities such as batch execution or scheduled cache reuse. For example, the Postgres Structured Query Language Extended Query Protocol (PSQLEQP).

[0130] Configure the command code field, batch execution plan identifier field, and second load field in the remote execution protocol to obtain a globally effective batch execution request, thereby driving the database to execute multiple execution tasks in batches within a transaction.

[0131] The command code field is used to identify batch execution requests as newly added execution requests.

[0132] The second payload field is used to carry the batch execution plan identifier, multiple execution plan identifiers, and template parameters provided by the client, which indicate the batch execution request.

[0133] After the remote execution protocol is configured, the client sends batch execution requests to the database via a single communication.

[0134] In the application layer protocol between the client and server, a new batch pre-compilation request is defined, allowing the client to encapsulate multiple statement templates in a single network request packet and submit it to the database all at once. Correspondingly, a new batch execution request is added to the remote execution protocol, allowing the client to encapsulate batch execution plan identifiers, multiple execution plan identifiers, and template parameters in a single network request packet and submit it to the database all at once. This reduces the network round trips that previously required N pre-compilation requests for N statement templates to a single request, and also reduces the network round trips that previously required N execution requests to a single request. In high-latency networks or microservice architectures, this improves performance, reduces network contention and server processing pressure, and enables the database to support higher concurrent transaction throughput. Furthermore, by merging multiple pre-compilation requests and multiple execution requests for multiple statement templates into a single pre-compilation request and a single execution request, protocol overhead is significantly reduced, and network transmission efficiency is improved.

[0135] Optionally, the database processing method further includes: receiving a batch execution request from a client, wherein the batch execution request indicates a batch execution plan identifier, multiple execution plan identifiers, and at least one template parameter associated with each of the multiple execution plan identifiers; determining an executable resource set including executable resources of multiple statement templates based on the batch execution plan identifiers; binding the multiple template parameters to the executable resources of the statement templates corresponding to the execution plan identifiers, based on the execution plan identifiers associated with each of the multiple template parameters, to obtain multiple executable tasks; executing the multiple executable tasks to obtain the execution results of each of the multiple executable tasks; and sending the multiple execution results to the client.

[0136] The client sends a batch execution request to the database. The extended protocol processor recognizes the batch execution request BATCH_EXECUTE and sends the batch execution request to the batch execution engine, which indicates the batch execution plan identifier, multiple execution plan identifiers, and at least one template parameter associated with each of the multiple execution plan identifiers.

[0137] The batch execution engine retrieves the set of executable resources corresponding to the batch execution plan identifier (batch_statement_id) from the cache and resource pool. The set of executable resources includes the executable resources corresponding to each of the multiple statement templates.

[0138] Based on the execution plan identifier associated with each of the multiple template parameters, the multiple template parameters are each bound to the executable resource of the statement template corresponding to the execution plan identifier, resulting in multiple executable tasks.

[0139] For example, the database receives a batch execution plan identifier `batch_statement_id=12345`, and at least one template parameter `args` associated with each of the multiple execution plan identifiers `sub_handle`. The template parameter `params_set=[{sub_handle:0,args:["val1"]}, {sub_handle:1, args:["val2", 100]}, {sub_handle:0, args:["val3"]}]`, where `{sub_handle:0, args:["val1"]}`. Based on `batch_statement_id=12345`, an executable resource set is determined. From this set, the executable resources corresponding to each statement template are retrieved. Based on the mapping relationship between executable resources and execution plan identifiers, the template parameter `val1` is first bound to the executable resource corresponding to execution plan identifier 0; then, the template parameters `val2` and `100` are bound to the executable resource corresponding to execution plan identifier 1; finally, the template parameter `val3` is bound to the executable resource corresponding to execution plan identifier 0.

[0140] The batch execution engine submits multiple executable tasks to the database storage layer in a single transaction, either sequentially or in an optimized order, obtains the execution results of each of the multiple executable tasks, and sends the multiple execution results to the client via a single network communication.

[0141] For example, the database sends multiple execution results to the client: results=[{affected_rows:1},{affected_rows:1},{affected_rows:1}], which means that one row in the table associated with statement template sql1 has been modified, one row in the table associated with statement template sql2 has been modified, and one row in the table associated with statement template sql3 has been modified.

[0142] Batch execution requests allow clients to use batch execution plan identifiers in a single request and submit a data structure containing multiple sets of template parameters. Each set of template parameters is associated with a statement template in the batch through the execution plan identifier. The database's batch execution engine binds the multiple template parameters to the executable resources of the statement templates corresponding to the execution plan identifiers, and executes multiple executable tasks efficiently in sequence or in an optimized order. Multiple execution results are sent to the client via a single network communication. Operations that originally required N network round trips for N statement templates can be completed in only one network round trip, greatly improving efficiency and reducing network latency.

[0143] Optionally, executing multiple executable tasks and obtaining the execution results of each of the multiple executable tasks includes: executing multiple executable tasks in the order determined by a predetermined execution strategy and obtaining the execution results of each of the multiple executable tasks, wherein the predetermined execution strategy includes executing in the order indicated by the batch execution request or executing in the order determined by the execution attributes of the executable tasks.

[0144] An executable task is the smallest unit of execution that is composed of executable resources and template parameters and can be directly scheduled by the database's batch execution engine.

[0145] In one embodiment, the predetermined execution strategy includes the association order between the batch execution request indication and the template parameters associated with each of the multiple execution plan identifiers, and the association order is consistent with the order in which the client adds the template parameters to the statement template.

[0146] For example, the associated order of the batch execution request instruction is params_set=[{sub_handle:0, args:["val1"]},{sub_handle:1,args:["val2",100]},{sub_handle:0,args:["val3"]}]. Therefore, the execution task containing the template parameter "val1" and the executable resource corresponding to the execution plan identifier 0 is executed first, resulting in execution result 1; then the execution task containing the template parameter "val2" and 100 and the executable resource corresponding to the execution plan identifier 1 is executed, resulting in execution result 2; finally, the execution task containing the template parameter "val3" and the executable resource corresponding to the execution plan identifier 0 is executed, resulting in execution result 3.

[0147] In one embodiment, the predetermined execution strategy includes executing multiple executable tasks in an order determined based on the execution attributes of the executable tasks.

[0148] Execution attributes are stored in the control metadata of the executable task header and are used to determine the execution order.

[0149] Within a single transaction, the system conveniently maintains consistency between the order in which multiple statement templates are executed in the database and the order in which template parameters are added or executed in the business logic, based on a predetermined execution strategy. This reduces the risk of data inconsistency, lowers the complexity of concurrent programming, and improves system reliability.

[0150] Optionally, the database operations indicated by the batch execution request are executed within a single database transaction. These database operations are generated by executing multiple executable tasks and involve reading and writing to the database's persistent state.

[0151] A single database transaction refers to a transaction in which all database operations indicated by a batch execution request are wrapped in one transaction, and the failure of any one task triggers a rollback of the entire transaction.

[0152] Database persistent state refers to the logical database content whose execution results from multiple executable tasks are stored on disk or persisted to shared storage, and remains visible even after a transaction is committed.

[0153] The changes are read or modified by executable tasks, and the changes are guaranteed to have transaction-level atomicity and durability through read and write logs.

[0154] After the database receives a batch pre-compilation request, the transaction execution engine assigns a globally unique transaction number, creates a transaction context and obtains a consistent snapshot. The database operations indicated by the batch execution request are also within this transaction. Each executable resource and template parameter in the batch execution request is encapsulated into an executable task, forming a task queue. Within this transaction, each executable task is scheduled sequentially or in parallel.

[0155] Read operations read the persistent state based on a snapshot. Write operations first write to the log, then update the memory buffer, holding the lock until the transaction ends.

[0156] Execute multiple executable tasks to obtain multiple execution results, and then commit the transaction.

[0157] The database operations indicated by the batch execution request are automatically placed in the same database transaction context to ensure the atomicity of the batch operations.

[0158] Optionally, sending multiple execution results to the client includes: generating at least one execution data packet based on the multiple execution results, wherein the number of execution data packets is less than the number of execution results; and sending at least one execution data packet to the client.

[0159] Multiple execution results are packaged to generate at least one execution data package.

[0160] The number of data packets to be executed can be determined based on the current network latency or bandwidth status, and then multiple execution results can be packaged together.

[0161] For example, high latency generates multiple efficient execution data packets, while narrow latency generates a single execution data packet to avoid congestion.

[0162] The database sends the entire execution data packet to the client via a single network communication.

[0163] Database servers respond to batch requests. Optimization strategies can be used to combine and optimize multiple execution results, reducing the number of responses and the size of data packets.

[0164] Figure 5A A schematic diagram illustrating the processing of batch pre-compilation requests according to an embodiment of this application is shown.

[0165] like Figure 5A As shown, a batch pre-compilation request is configured within the application layer protocol. The client sends a batch pre-compilation request (BATCH_PREPARE) to the database via a single network communication. The batch pre-compilation request encapsulates three statement templates: SQL1, SQL2, and SQL3. The protocol processor identifies the batch pre-compilation request and sends it to the pre-compilation processor. The pre-compilation processor parses the batch pre-compilation request to obtain the three statement templates. The batch syntax / semantic analyzer analyzes the three statement templates serially or in parallel. The batch execution plan generator generates executable resources for each of the three statement templates, resulting in an executable resource set, which is then sent to the pre-compilation processor. The resource manager allocates resources and memory, and the executable resource set is sent to the database storage layer to implement caching of the executable resource set. The identifier manager generates a unique batch execution plan identifier and a unique execution plan identifier for each executable resource, sending the batch execution plan identifier and multiple execution plan identifiers to the pre-compilation processor. The pre-compilation processor then sends the batch execution plan identifier and multiple execution plan identifiers to the client via the protocol processor.

[0166] Figure 5B A schematic diagram illustrating the processing of batch execution requests according to an embodiment of this application is shown.

[0167] like Figure 5BAs shown, a batch execution request is configured within the remote execution protocol. The client sends a batch execution request (BATCH_EXECUTE) to the database via a single network communication. BATCH_EXECUTE encapsulates the batch execution plan identifier (batch_statement_id) and multiple associations (params_set) between the execution plan identifier and template parameters. The protocol processor identifies the batch execution request and sends it to the batch execution engine. The batch execution engine parses the request to obtain the batch execution plan identifier, execution plan identifier, and template parameters, and sends these to the resource manager. The resource manager then retrieves executable resources corresponding to the execution plan identifiers from the cache and resource pool, and sends these resources to the batch execution engine. The batch execution engine binds multiple template parameters to the executable resources, resulting in multiple executable tasks. These tasks are submitted to the database storage layer in a single transaction, either sequentially or in an optimized order, yielding the execution results. These results are then combined to obtain the batch execution result. The database storage layer sends the batch execution result to the client via the protocol processor.

[0168] Based on the above database processing method, this application also provides a database processing apparatus. The following will be combined with... Figure 6 and Figure 7 The device is described in detail.

[0169] Figure 6 A structural block diagram of a database processing apparatus according to an embodiment of this application is shown.

[0170] like Figure 6 As shown, the database processing apparatus 600 of this embodiment includes a request receiving module 610, a pre-compilation module 620, a creation module 630, and an identifier sending module 640.

[0171] The request receiving module 610 is used to receive batch pre-compilation requests from the client.

[0172] The pre-compilation module 620 is used to perform batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request, generating an executable resource set that includes the executable resources of each statement template.

[0173] Module 630 is used to create a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set. The batch execution plan identifier is used to reference the executable resource set, and the execution plan identifier is used to reference the executable resource in the executable resource set that corresponds to the statement template.

[0174] The identifier sending module 640 is used to send a batch execution plan identifier and multiple execution plan identifiers to the client. The batch execution plan identifier and multiple execution plan identifiers are provided by the client in a batch execution request sent to the database. The batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, multiple execution plan identifiers and template parameters provided by the client.

[0175] Figure 7 A structural block diagram of a database processing apparatus according to another embodiment of this application is shown.

[0176] like Figure 7 As shown, the database processing apparatus 700 of this embodiment includes a request sending module 710 and an identifier receiving module 720.

[0177] The request sending module 710 is used to send a batch pre-compilation request to the database so that the database can perform batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request, generate an executable resource set including the executable resources of each of the multiple statement templates, and create a batch execution plan identifier and multiple execution plan identifiers based on the executable resource set. The batch execution plan identifier is used to reference the executable resource set, and the execution plan identifier is used to reference the executable resources in the executable resource set that correspond to the statement templates.

[0178] The identifier receiving module 720 is used to receive a batch execution plan identifier and multiple execution plan identifiers from the database. The batch execution plan identifier and multiple execution plan identifiers are provided by the client in a batch execution request sent to the database. The batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, multiple execution plan identifiers and template parameters provided by the client.

[0179] Figure 8 A block diagram of an electronic device suitable for implementing a database processing method according to an embodiment of this application is shown.

[0180] Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0181] like Figure 8As shown, a computer electronic device 800 according to an embodiment of this application includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a ROM 802 (read-only memory) or a program loaded from a storage portion 808 into a RAM 803 (random access memory). The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.

[0182] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 802 and / or RAM 803. It should be noted that programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in one or more memories.

[0183] Optionally, the electronic device 800 may also include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may also include one or more of the following components connected to the input / output (I / O) interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.

[0184] Optionally, the method flow according to the embodiments of this application can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of the embodiments of this application. Optionally, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0185] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the database processing method according to the embodiments of this application.

[0186] Optionally, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0187] For example, optionally, the computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.

[0188] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this application. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the database processing methods provided in the embodiments of this application.

[0189] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this application embodiment. Optionally, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0190] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0191] Optionally, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0192] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments of this application can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of this application.

[0193] The embodiments of this application have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of this application. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Without departing from the scope of this application, those skilled in the art can make various substitutions and modifications, all of which should fall within the scope of this application.

Claims

1. A database processing method, characterized in that, include: Receive batch pre-compilation requests from clients; The batch pre-compiles multiple statement templates indicated by the batch pre-compile request to generate an executable resource set including the executable resources of each statement template. Based on the executable resource set, a batch execution plan identifier and multiple execution plan identifiers are created, wherein the batch execution plan identifier is used to reference the executable resource set, and the execution plan identifier is used to reference the executable resource in the executable resource set that corresponds to the statement template; The batch execution plan identifier and the plurality of execution plan identifiers are sent to the client, wherein the batch execution plan identifier and the plurality of execution plan identifiers are provided by the client in a batch execution request sent to the database, and the batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, the plurality of execution plan identifiers and the template parameters provided by the client.

2. The method according to claim 1, characterized in that, Also includes: Receive a batch execution request from the client, wherein the batch execution request indicates a batch execution plan identifier, a plurality of execution plan identifiers, and at least one template parameter associated with each of the plurality of execution plan identifiers; Based on the batch execution plan identifier, determine an executable resource set that includes the executable resources of each of the multiple statement templates; Based on the execution plan identifier associated with each of the multiple template parameters, each of the multiple template parameters is bound to the executable resource of the statement template corresponding to the execution plan identifier, thereby obtaining multiple executable tasks; Execute multiple executable tasks to obtain the execution results of each executable task; Send multiple execution results to the client.

3. The method according to claim 2, characterized in that, Execute multiple executable tasks to obtain the execution results of each executable task, including: The multiple executable tasks are executed in the order determined by a predetermined execution strategy to obtain the execution results of each of the multiple executable tasks. The predetermined execution strategy includes executing in the order indicated by the batch execution request or executing in the order determined by the execution attributes of the executable tasks.

4. The method according to claim 2 or 3, characterized in that, The database operations indicated by the batch execution request are executed within a single database transaction. These database operations are generated by executing multiple executable tasks and involve reading and writing to the persistent state of the database.

5. The method according to claim 2 or 3, characterized in that, Send multiple execution results to the client, including: Based on the multiple execution results, at least one execution data packet is generated, wherein the number of execution data packets is less than the number of execution results; Send the at least one execution data packet to the client.

6. The method according to any one of claims 1 to 3, characterized in that, The batch pre-compiles multiple statement templates indicated by the batch pre-compile request to generate an executable resource set including the executable resources of each statement template, including: Batch syntax analysis and batch semantic analysis are performed on multiple statement templates indicated by the batch pre-compilation request, wherein multiple statement templates with structural similarity greater than or equal to a predetermined threshold share the analysis results; Based on the analysis results, executable resources for each of the multiple statement templates are generated, resulting in the executable resource set.

7. The method according to claim 6, characterized in that, Based on the analysis results, executable resources for each of the aforementioned statement templates are generated, including: If, based on the analysis results, it is determined that multiple statement templates access the same database object, the access permission verification results performed on the database object are used to generate executable resources for each of the multiple statement templates.

8. The method according to claim 6, characterized in that, Based on the analysis results, executable resources for each of the multiple statement templates are generated, resulting in the executable resource set, including: Based on the analysis results, multiple executable resources for each of the statement templates are generated in parallel to obtain the executable resource set.

9. A database processing method, characterized in that, include: A batch pre-compilation request is sent to the database so that the database performs batch pre-compilation on multiple statement templates indicated by the batch pre-compilation request, generating an executable resource set including the executable resources of each statement template. Based on the executable resource set, a batch execution plan identifier and multiple execution plan identifiers are created. The batch execution plan identifier is used to reference the executable resource set, and the execution plan identifier is used to reference the executable resources in the executable resource set that correspond to the statement templates. The client receives the batch execution plan identifier and the plurality of execution plan identifiers from the database. The batch execution plan identifier and the plurality of execution plan identifiers are provided by the client in a batch execution request sent to the database. The batch execution request is used to instruct the database to execute the executable resource set according to the batch execution plan identifier, the plurality of execution plan identifiers and the template parameters provided by the client.

10. The method according to claim 9, characterized in that, The batch pre-compilation request is obtained by configuring a request type field and a first payload field in the application layer protocol. The request type field identifies the batch pre-compilation request as a new pre-compilation request, and the first payload field carries multiple statement templates; and / or The step of sending a batch pre-compilation request to the database includes: sending the batch pre-compilation request to the database via a single communication; and / or; The batch execution request is obtained by configuring a command code field, a batch execution plan identifier field, and a second payload field in the remote execution protocol. The command code field identifies the batch execution request as a new execution request, and the second payload field carries the batch execution plan identifier, the multiple execution plan identifiers, and the template parameters provided by the client; and / or The batch execution request is sent by the client to the database in a single communication.

Citation Information

Patent Citations

  • Real-time task scheduling method, system and device and readable storage medium

    CN111400011A

  • Precoding method and system based on sub-library sub-table middleware

    CN114238407A

  • Updating statement execution method and device, electronic equipment and computer storage medium

    CN118427201A

  • SQL replay method and device, electronic equipment and storage medium

    CN118796675A

  • Execution plan construction method and system

    CN119646048A