Outline binding method and apparatus, and storage medium

By generating formatted query statements and matching the target outline, the performance problem caused by too many IN queries in the database is solved, and multiple query statements are implemented to jointly bind a formatted outline, improving binding flexibility and reliability.

WO2025113003A1PCT designated stage expired Publication Date: 2025-06-05BEIJING OCEANBASE TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/126728
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-11-30
Filing Date
2024-10-23
Publication Date
2025-06-05

AI Technical Summary

Technical Problem

When there are too many IN queries in the database, it may cause excessive use of the central processor of the database server, resulting in the inability to execute the business and the inability to effectively bind the execution plan outline.

Method used

By obtaining the query statement, generating the corresponding formatted query statement, and determining the matching target outline in the pre-created outline, using the target outline to generate the plan of the query statement, implementing multiple query statements to jointly bind a formatted outline.

Benefits of technology

Without modifying the business logic, improve the flexibility of outline binding, ensure the correctness and reliability of outline effectiveness, and avoid performance problems caused by unlimited IN queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024126728_05062025_PF_FP_ABST
    Figure CN2024126728_05062025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present disclosure are an outline binding method and apparatus, and a storage medium. The method comprises: acquiring a query statement; generating a formatted query statement corresponding to the query statement; determining, from among at least one pre-created first-type outline, a target outline that matches the formatted query statement, wherein the first-type outline is a formatted outline that can be bound with a plurality of normalized query statements; and using the target outline to generate a plan corresponding to the query statement. The present disclosure can allow a plurality of query statements to be bound with the same formatted outline, and can realize the binding of the formatted outline without the need to modify the service logic, thereby improving the flexibility of outline binding and ensuring the correctness and reliability of the effectiveness of the outline.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, and storage medium for binding execution plan outline Technical Field

[0001] One or more embodiments of the present disclosure relate to the field of database processing, and more particularly to a method, device, and storage medium for binding an execution plan outline. Background Art

[0002] Currently, during the execution of certain businesses, if there are too many IN queries (which are used to search for specified values ​​in the database), this may cause the database server's central processing unit to be over-occupied, potentially preventing business execution. This requires temporarily mitigating the loss by adjusting the primary and backup nodes of a single table.

[0003] Therefore, when there is no limit on the number of IN queries, it is impossible to better bind the execution plan (outline).

[0004] Summary of the Invention

[0005] According to a first aspect of one or more embodiments of the present disclosure, a method for binding an execution plan outline is proposed, comprising: obtaining a query statement; generating a formatted query statement corresponding to the query statement; determining a target outline that matches the formatted query statement in at least one pre-created first-type outline; wherein the first-type outline is a formatted outline that is commonly bound to multiple query statements that can be normalized; and using the target outline, generating a plan corresponding to the query statement.

[0006] According to a second aspect of one or more embodiments of the present disclosure, a device for binding an execution plan outline is proposed, comprising: an acquisition module for acquiring a query statement; a generation module for generating a formatted query statement corresponding to the query statement; a determination module for determining a target outline that matches the formatted query statement in at least one pre-created first-type outline; wherein the first-type outline is a formatted outline commonly bound to multiple query statements that can be normalized; and an execution module for using the target outline to generate a plan corresponding to the query statement.

[0007] According to a third aspect of one or more embodiments of the present disclosure, a server is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the method of binding an execution plan outline as described in any one of the above items by running the executable instructions.

[0008] According to a fourth aspect of one or more embodiments of the present disclosure, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method for binding an execution plan outline as described in any one of the above items are implemented.

[0009] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:

[0010] In the present disclosure, multiple query statements can be bound to a formatted outline. Without modifying the business logic, the formatted outline binding is achieved, the flexibility of the outline binding is improved, and the correctness and reliability of the outline effectiveness are ensured. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] FIG1 is a flowchart of a method for binding an execution plan outline provided by an exemplary embodiment.

[0012] FIG2 is a flowchart of another method for binding an execution plan outline provided by an exemplary embodiment.

[0013] FIG3A is a flowchart of another method for binding an execution plan outline provided by an exemplary embodiment.

[0014] FIG3B is a flowchart of another method for binding an execution plan outline provided by an exemplary embodiment.

[0015] FIG4 is a block diagram of an apparatus for binding an execution plan outline provided by an exemplary embodiment.

[0016] FIG5 is a schematic structural diagram of a server provided by an exemplary embodiment. DETAILED DESCRIPTION

[0017] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. When the following description refers to the drawings, identical numerals in different figures represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible implementations consistent with one or more embodiments of the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of the present disclosure, as detailed in the appended claims.

[0018] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this disclosure. In some other embodiments, the method may include more or fewer steps than those described in this disclosure. In addition, a single step described in this disclosure may be broken down into multiple steps for description in other embodiments; and multiple steps described in this disclosure may be combined into a single step for description in other embodiments.

[0019] Before introducing the solution of the present disclosure, the terms involved in the present disclosure are first introduced.

[0020] Parameterization: When processing a structured query language (SQL) syntax tree, the process of removing constants from the syntax tree according to some rules.

[0021] Query statement identifier (sql-id): After the text of the sql statement is parameterized, the message digest algorithm (MD5) value is calculated using the obtained text.

[0022] Outline: A mechanism that controls the execution plan of SQL statements based on hints.

[0023] Binding outline: A common method for stabilizing plans.

[0024] Formatting binding outline: A mechanism that can specify a rule to control the execution plan of multiple SQL statements.

[0025] Hint: Information used to guide plan generation.

[0026] Currently, if you do not limit the number of IN queries, you cannot bind the outline well. An example is as follows:

[0027] Suppose there are three SQL statements:

[0028] 1. select*from A where col in(1,2);

[0029] 2. select*from A where col in(1,2,3);

[0030] 3. select*from A where col in(1,2,3,4);

[0031] For the above three SQL statements, the following statements are obtained after parameterization:

[0032] select*from A where col in(?,?);

[0033] select*from A where col in(?,?,?);

[0034] select*from A where col in(?,?,?,?).

[0035] If you need to bind the outlines of the three SQL statements above, you need to create an outline for each SQL statement. Obviously, this is inefficient and time-consuming.

[0036] Currently, outline binding can be performed in the following ways:

[0037] Method 1: Temporary table method

[0038] The basic idea is to insert the IN constant into a temporary table and then change the right branch of the IN in the SQL syntax tree into a subquery. Specifically, this method can include the following implementation solutions:

[0039] A. Use bind variable names (BIND VARIABLES).

[0040] When creating an Outline, use the bind variable name instead of the constant value, as shown below:

[0041] CREATE OUTLINE my_outline FOR SELECT*FROM my_table WHERE column1 IN(:list);

[0042] In this way, when the above SQL statement is used, my_outline can be used to optimize the query plan and the value in the bind variable can be passed to it instead of the constant value in the IN clause.

[0043] B. Any operator.

[0044] DO$$

[0045] DECLARE

[0046] sql_stmt text:='SELECT*FROM my_table WHERE my_column=ANY($1)';

[0047] BEGIN

[0048] --Save the query plan to OUTLINE

[0049] SELECT pg_create_logical_replication_slot('my_outline');

[0050] SELECT pg_create_physical_replication_slot('my_outline');

[0051] EXECUTE'EXPLAIN(FORMAT JSON)'||sql_stmt INTO@my_plan;

[0052] PERFORM pg_replication_origin_xact_setup('my_outline');

[0053] PERFORM pg_logical_emit_message(CAST(@my_plan AS TEXT),NULL,'my_outline');

[0054] END;

[0055] $$;

[0056] --

[0057] expression operator ANY(array expression)

[0058] C. PS-like protocol.

[0059] Use prepared statements and execute statements to implement shared SQL execution plans without IN constant restrictions. The specific steps are as follows:

[0060] Use prepared statements to define a placeholder and replace the constant in the IN statement with the placeholder, as follows:

[0061] PREPARE my_query FROM'SELECT*FROM my_table WHERE my_column IN(?)';

[0062] Use the execute statements statement to execute the query and pass the constant value into the placeholder.

[0063] EXECUTE my_query USING(1,2,3,4,5);

[0064] The Starrocks / Doris / Impala / Spark approach.

[0065] Method 2: Array method

[0066] It can extract the right branch of IN in the SQL syntax tree into an array, but the extraction method of each database may be different.

[0067] In method 2, the query can be rewritten as a temporary table query:

[0068] First, you can create a temporary table and insert the constants in the IN statement into the temporary table.

[0069] CREATE GLOBAL TEMPORARY TABLE temp_table(col1 NUMBER);

[0070] INSERT INTO temp_table(col1)SELECT column_value

[0071] FROM TABLE(SYS.ODCINUMBERLIST(1,2,3,4,5));

[0072] Second, use the JOIN operation to connect the temporary table and the main query statement.

[0073] SELECT*FROM my_table WHERE my_column IN(SELECT col1 FROM temp_table);

[0074] However, all of the above methods require modifying the business logic, and the cost of binding the outline is high.

[0075] To better bind outlines when the number of IN queries is unlimited and avoid modifying business logic, the present disclosure provides the following method, device, and storage medium for binding execution plan outlines. These methods allow multiple query statements to be bound to a formatted outline, enabling formatted outline binding without modifying business logic. This improves the flexibility of outline binding and ensures the correctness and reliability of outline validation.

[0076] Figure 1 is a flowchart of a method for binding an execution plan outline, provided by an exemplary embodiment. Referring to Figure 1 , this method can be executed by a server. Specifically, the server can be a server that deploys a database. The database can support at least one query statement, including but not limited to SQL statements. The following description uses SQL statements as an example, but the disclosed solution is not limited to scenarios where the database uses SQL statements. The method includes steps 101 through 104.

[0077] In step 101, a query statement is obtained.

[0078] In the present disclosure, when a plan needs to be generated, a corresponding query statement can be obtained.

[0079] For example, the query statement is select * from t where c1 in (1, 2, 3).

[0080] In step 102, a formatted query statement corresponding to the query statement is generated.

[0081] In an embodiment of the present disclosure, a formatted query statement corresponding to the query statement may be generated. Exemplarily, the query statement may be parameterized to obtain the formatted query statement.

[0082] For example, the query statement is select * from t where c1 in (1, 2, 3), and the formatted query statement is select * from t where c1 in (?).

[0083] In step 103, a target outline matching the formatted query statement is determined from at least one pre-created first type outline.

[0084] The first type of outline and the formatted outline in this disclosure can be interchangeable.

[0085] In the disclosed embodiment, the first type of outline is a formatted outline that is commonly bound to multiple normalized query statements. Normalization refers to the folding of parameters within the query statements. The parameters of the normalized query statements can be folded due to similar parameter patterns.

[0086] For example, select*from A where col in(?,?);

[0087] select*from A where col in(?,?,?);

[0088] select*from A where col in(?,?,?,?);

[0089] The above three query statements have similar parameter patterns, so they can be normalized. The query statement obtained after normalization is elect*from A where col in(?).

[0090] In the embodiment of the present disclosure, multiple query statements that can be normalized can be bound together into one outline, which is called a formatted outline, that is, a first type of outline.

[0091] In one example, if multiple query statements cannot be normalized but their grammatical similarity reaches or exceeds a preset threshold, a formatted outline may be bound to these query statements. The formatted outline is also the first type of outline.

[0092] This disclosure does not restrict whether multiple query statements can be normalized or whether their syntactic similarity reaches or exceeds a preset threshold. For example, if multiple query statements cannot be normalized and their syntactic similarity is low, assuming it is below a preset threshold, but in order to reduce the number of IN queries or other queries (such as select, from, where, etc.), these query statements can be bound to the same formatted outline.

[0093] In one example, one or more first-type outlines may be created in any of the following ways, but not limited to.

[0094] Method 1: Create at least one outline of the first type based on the formatted query text.

[0095] Formatted query text can be referred to as "format sql-text," where sql-text refers to the original SQL statement with parameters executed by the user.

[0096] For example, its creation syntax is as follows:

[0097] / *Use SQL_TEXT to create an Outline* /

[0098] CREATE[OR REPLACE]FORMAT OUTLINE outline_name ON stmt[TO target_stmt]

[0099] Here, outline name refers to the name of the created outline.

[0100] Wherein, stmt refers to a first formatted query statement that is not bound to a prompt, and target_stmt refers to a second formatted query statement that is bound to a prompt.

[0101] In one example, the first type of outline may include a prompt and a first formatting query statement, such as CREATE [OR REPLACE] FORMAT OUTLINE outline_name ON stmt.

[0102] In one example, the first type of outline may include a prompt, a first formatted query statement, and a second formatted query statement, such as CREATE [OR REPLACE] FORMAT OUTLINE outline_name ON stmt TO target_stmt.

[0103] At this time, only query statements that include hints can use the first type of outline.

[0104] It should also be noted that the first formatted query statement and the second formatted query statement should completely match after removing the hint.

[0105] For example, to create the first type of outline:

[0106] create format outline otl1 on select* / +*no_rewrite* / from t where c1 in(1,2,3).

[0107] The first formatted query statement is: select * from t where c1 in (1, 2, 3), and the hint is: / +*no_rewrite* / .

[0108] Method 2: Create at least one outline of the first type based on the formatted query statement identifier.

[0109] Its creation syntax is as follows:

[0110] / *Create Outline using SQL_ID* /

[0111] CREATE[OR REPLACE]FORMAT OUTLINE outline_name ON format_sql_id USING HINT hint;

[0112] Here, outline name refers to the name of the created outline.

[0113] format_sql_id refers to a formatted query statement identifier, which can be obtained by querying a preset table to obtain a query statement identifier corresponding to the first formatted query statement or the second formatted query statement, and determining the query statement identifier obtained as the formatted query statement identifier.

[0114] For example, the preset table may include but is not limited to at least one of the following tables:

[0115] SQL audit view (gv$ob_sql_audit) table;

[0116] SQL execution plan cache view (gv$ob_plan_cache_plan_stat) table.

[0117] Accordingly, the first type of outline includes a hint and a formatted query statement identifier.

[0118] In one example, a target outline matching the formatted query statement may be determined from at least one pre-created first-type outline in the following manner.

[0119] Method 1: The first type of outline is created based on the formatted query text, and the query statement does not include a prompt.

[0120] The server may determine, among the first type of outlines that do not include the second formatted query statement, an outline that matches the formatted query statement as the target outline.

[0121] For example, the formatted query statement is select * from t where c1 in (?), which does not include the second formatted query statement. The matched first type of outline is otl1, and the server may determine otl1 as the target outline.

[0122] Method 2: The first type of outline is created based on the formatted query text, and the query statement includes a prompt.

[0123] The server may determine, among the first type of outlines including the second formatted query statement, an outline of the first type that matches the formatted query statement as the target outline.

[0124] Method 3: The first type of outline is created based on a formatted query statement identifier.

[0125] The server may query a preset table to obtain a formatted query statement identifier corresponding to the formatted query statement, and then determine an outline of the first type corresponding to the formatted query statement identifier as the target outline.

[0126] The preset tables include but are not limited to at least one of the following:

[0127] SQL audit view (gv$ob_sql_audit) table;

[0128] SQL execution plan cache view (gv$ob_plan_cache_plan_stat) table.

[0129] In step 104, a plan corresponding to the query statement is generated using the target outline.

[0130] In an embodiment of the present disclosure, after determining the target outline, the server may generate a plan using the target outline and store the target outline in a plan cache so as to execute the generated plan.

[0131] In the above embodiment, multiple query statements that can be normalized can be bound to a formatted outline. This allows for formatted outline binding without modifying business logic, thereby improving the flexibility of outline binding and ensuring the correctness and reliability of outline effectiveness.

[0132] In some embodiments, as shown in FIG. 2 , it is assumed that a statement for creating a first type of outline is as follows: create format outline otl1 on select* / +*no_rewrite* / from t where c1 in(1,2,3)

[0133] The server can extract the first formatted query statement: select * from t where c1 in (1, 2, 3) and the hint: / +*no_rewrite* / .

[0134] Write the above outline to all formatted outlines (first type of outline).

[0135] After obtaining the query statement select * from t where c1 in (1, 2, 3), a corresponding formatted query statement select * from t where c1 in (?) is generated. Then, a target outline that matches the formatted query statement is determined among all formatted outlines (first type of outlines). A plan is generated based on the target outline and stored in the plan cache.

[0136] In the above embodiment, multiple query statements that can be normalized can be bound to a formatted outline. This allows for formatted outline binding without modifying business logic, thereby improving the flexibility of outline binding and ensuring the correctness and reliability of outline effectiveness.

[0137] In some embodiments, one or more of the created formatted outlines (first type of outlines) may be deleted.

[0138] The delete syntax is as follows:

[0139] DROP FORMAT OUTLINE outline_name;

[0140] After deleting the first type of OUTLINE, the SQL statement will no longer be based on the deleted first type of outline when regenerating the plan.

[0141] In the above embodiment, the flexibility of outline creation and deletion is improved, ensuring the correctness and reliability of outline validation.

[0142] In some embodiments, Figure 3A is a flowchart of another method for binding an execution plan outline based on the embodiment shown in Figure 1. Referring to Figure 3A, the method further includes steps S105 and S106.

[0143] In step 105, the formatted query statement is matched with at least one pre-created outline of the second type.

[0144] The second type of outline is bound to a query statement one-to-one. It's understood that each second type of outline is bound to a query statement and is a precise outline corresponding to that query statement. The second type of outline can be understood as a traditional outline, different from a formatted outline.

[0145] In step 106, if there is an outline of the second type that matches the formatted query statement, the matched outline of the second type is determined as a target outline.

[0146] Furthermore, the above step 104 may be continued to be performed, in which a plan corresponding to the query statement is generated using the target outline.

[0147] In step 106 , if there is no outline of the second type that matches the formatted query statement, step 103 is performed to determine a target outline that matches the formatted query statement from at least one pre-created outline of the first type.

[0148] For example, select * from t where c1 in (1, 2);

[0149] select*from t where c1 in(1,2,3);

[0150] select*from t where c1 in(1,2,3,4);

[0151] These three SQL statements will share a first-type outline, otl1. SQL statement #2 corresponds to a second-type outline, otl2.

[0152] As shown in Figure 3B, after obtaining the query statement and generating the corresponding formatted query statement, it will prioritize matching the second type of outline. If the second type of outline cannot be matched, the first type of outline will be matched. If there is no first type of outline, it is determined that there is no outline.

[0153] In the above embodiment, by processing the compatibility of the traditional outline, the correctness and reliability of the outline validation are guaranteed, and the flexibility of the outline binding is enhanced.

[0154] Referring to Figure 4 , a device for binding an execution plan outline can be applied to a server, such as a server deployed with a database, to implement the technical solution disclosed herein. The device for binding an execution plan outline can include: an acquisition module 401 for acquiring a query statement; a generation module 402 for generating a formatted query statement corresponding to the query statement; a determination module 403 for determining a target outline that matches the formatted query statement from at least one pre-created first-type outline; wherein the first-type outline is a formatted outline that is commonly bound to multiple query statements that can be normalized; and an execution module 404 for using the target outline to generate a plan corresponding to the query statement.

[0155] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.

[0156] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0157] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0158] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0159] FIG5 is a schematic structural diagram of a server provided by an exemplary embodiment. Referring to FIG5 , at the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510, and may also include hardware required for other services. One or more embodiments of the present disclosure may be implemented based on software, such as the processor 502 reading the corresponding computer program from the non-volatile memory 510 into the memory 508 and then running it. Of course, in addition to software implementation, one or more embodiments of the present disclosure do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or logic devices.

[0160] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0161] The foregoing description describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0162] The terms used in one or more embodiments of the present disclosure are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present disclosure. The singular forms "a," "the," and "the" used in one or more embodiments of the present disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0163] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of the present disclosure, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0164] The above description is only one or more embodiments of the present disclosure and is not intended to limit the one or more embodiments of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present disclosure shall be included in the scope of protection of one or more embodiments of the present disclosure.

Claims

1. A method for binding an execution plan outline, comprising: Get the query statement; generating a formatted query statement corresponding to the query statement; Determine a target outline that matches the formatted query statement in at least one pre-created first-type outline; wherein the first-type outline is a formatted outline that is bound to a plurality of normalized query statements; Using the target outline, a plan corresponding to the query statement is generated.

2. The method according to claim 1, wherein: The method further comprises any of the following: Based on the formatted query text, create at least one outline of the first type; At least one outline of the first type is created based on the formatted query statement identifier.

3. The method according to claim 1 or 2, wherein: The first type of outline includes at least one of the following: hint; A first formatted query statement; wherein the first formatted query statement is not bound to the prompt; A second formatted query statement; wherein the second formatted query statement is bound to the prompt; Format query statement identifier.

4. The method according to claim 3, further comprising: Query a preset table to obtain the query statement identifier corresponding to the first formatted query statement or the second formatted query statement; The obtained query statement identifier is determined as the formatted query statement identifier.

5. The method according to claim 3, wherein: The determining of a target outline that matches the formatted query statement includes any of the following: The first type of outline is created based on the formatted query text, and the query statement does not include a prompt, then, among the first type of outlines that do not include the second formatted query statement, an outline that matches the formatted query statement is determined as the target outline; The first type of outline is created based on the formatted query text, and the query statement includes a prompt, then among the first type of outlines including the second formatted query statement, an outline of the first type matching the formatted query statement is determined as the target outline.

6. The method according to claim 3, wherein: The determining of a target outline matching the formatted query statement includes: The first type of outline is created based on the formatted query statement identifier, and a preset table is queried to obtain the formatted query statement identifier corresponding to the formatted query statement; An outline of the first type corresponding to the obtained formatted query statement identifier is determined as the target outline.

7. The method according to claim 1, further comprising: Matching the formatted query statement with at least one pre-created second type of outline; wherein the second type of outline is an outline bound one-to-one with the query statement; If there is an outline of the second type that matches the formatted query statement, determine the matched outline of the second type as a target outline, and execute the step of generating a plan using the target outline; If there is no outline of the second type that matches the formatted query statement, the step of determining a target outline that matches the formatted query statement from at least one pre-created outline of the first type is performed.

8. A device for binding an execution plan outline, comprising: The acquisition module is used to obtain the query statement; A generation module, used to generate a formatted query statement corresponding to the query statement; A determination module, configured to determine a target outline matching the formatted query statement from at least one pre-created first-type outline; wherein the first-type outline is a formatted outline commonly bound to a plurality of query statements capable of being normalized; The execution module is used to generate a plan corresponding to the query statement using the target outline.

9. A server, comprising: processor; a memory for storing processor-executable instructions; The processor implements the method for binding an execution plan outline as described in any one of claims 1 to 7 by running the executable instructions.

10. A computer-readable storage medium having computer instructions stored thereon, wherein: When the instruction is executed by the processor, the steps of the method for binding an execution plan outline as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Executive plan search method, and executive plan storage method and apparatus

    CN106897343A

  • Data query method, data query system, equipment and storage medium

    CN115269631A

  • Method and device for determining execution plan of database statement, electronic equipment and medium

    CN115630087A

  • Method and device for binding execution plan outline and storage medium

    CN117633001A