Database operation statement processing method and related product

By converting the NOT IN clause to the NOT EXISTS clause and using the LNNVL function to process the NULL value, the problem of low performance of the NOT IN clause is solved, and the semi-connection conversion of the NOT IN clause is realized, which improves the execution efficiency of database operations.

CN119311722APending Publication Date: 2025-01-14CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411311440.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In existing database technology, the performance of the NOT IN clause is low and cannot be directly converted to the NOT EXISTS clause, resulting in the inability to perform semi-connection conversion, which in turn affects the execution efficiency.

Method used

By converting the NOT IN clause to the NOT EXISTS clause and using the LNNVL function to process the NULL value, the semi-connection conversion of the NOT IN clause is realized, and the database can perform the execution efficiency of the operation statements containing the NOT IN clause.

Benefits of technology

It effectively improves the execution efficiency of the NOT IN clause, avoids the low performance problems caused by NULL value processing, realizes the semi-connection conversion of the NOT IN clause, and improves the performance of database operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311722A_ABST
    Figure CN119311722A_ABST
Patent Text Reader

Abstract

The invention provides a database operation statement processing method and a related product. The method comprises the following steps: acquiring a database operation statement; judging whether the database operation statement has NOT IN clauses or not; if yes, NOT IN clauses in the database operation statement are converted into sub-connections of the target type, and the sub-connections of the target type can be subjected to semi-connection conversion. Through the method, the NOT IN clause in the database operation statement can be converted into the target type of sub-connection, so that the semi-connection conversion of the NOT IN clause is realized subsequently by means of the conversion principle of the target type of sub-connection, and the execution efficiency of the database on the database operation statement containing the NOT IN clause is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a method for processing database operation statements and related products. Background Art

[0002] In the current database technology field, there are issues regarding the improvement of IN, EXISTS, NOT IN, and NOT EXISTS sub-joins. Major manufacturers tend to convert IN and EXISTS to SEMI JOIN, and NOT EXISTS to ANTI JOIN, eliminating sub-joins and converting them to semi-joins to reduce the huge performance cost of repeated scanning of sub-joins. Only NOT IN is an exception. Since the logic of NOT IN for handling NULL is slightly different from that of NOT EXISTS, it is impossible to directly rewrite NOT IN to NOT EXISTS, and it cannot be easily converted to Anti-join, resulting in low performance. Summary of the invention

[0003] In view of the above problems, the present invention proposes a method for processing database operation statements and related products that overcome the above problems or at least partially solve the above problems.

[0004] An object of the present invention is to improve the execution efficiency of a database for a database operation statement containing a NOT IN clause;

[0005] A further object of the present invention is to convert a NOT IN clause into a NOT EXISTS clause.

[0006] A further object of the present invention is to implement the semi-join conversion of the NOT IN clause by means of the conversion principle of NOT EXISTS.

[0007] In particular, the present invention provides a method for processing a database operation statement, comprising:

[0008] Get database operation statements;

[0009] Determine whether the database operation statement contains a NOT IN clause;

[0010] If so, the NOT IN clause in the database operation statement is converted to a sub-join of the target type, and the sub-join of the target type can be converted to a semi-join.

[0011] Optionally, the target type includes a NOT EXISTS type;

[0012] The steps to convert the NOT IN clause in the database operation statement to a sub-join of the target type include:

[0013] Convert the NOT IN clause in the database operation statement to a NOT EXISTS sub-join.

[0014] Optionally, the steps for changing the NOT IN clause in the database operation statement to a NOT EXISTS type sub-join include:

[0015] Determine the target condition associated with the NOT IN clause;

[0016] Wrap the target condition with the LNNVL function and add it to the sub-connection condition;

[0017] Convert the NOT IN clause to a NOT EXISTS type sub-connection as the conditional clause of the database operation statement.

[0018] Optionally, after the step of converting the NOT IN clause in the database operation statement into a sub-connection of the target type, the following step is further included:

[0019] Verify the converted database operation statement to determine whether the converted database operation statement is correct;

[0020] If yes, perform semi-join conversion based on the converted database operation statement.

[0021] Optionally, the step of performing semi-join conversion according to the converted database operation statement includes:

[0022] The converted database operation statement semi-join is converted into an ANTI JOIN connected database operation statement.

[0023] Optionally, after the step of performing semi-join conversion according to the converted database operation statement, the step further includes:

[0024] Perform performance analysis on database operation statements after semi-join conversion;

[0025] If the result of the performance analysis shows that the query performance of the database operation statement after the semi-join conversion is lower than that of the original database operation statement, the original database operation statement is retained.

[0026] Optionally, the step of determining whether a database operation statement contains a NOT IN clause includes:

[0027] Parse the database operation statement and obtain the parsing result;

[0028] Identify keywords in database operation statements based on parsing results;

[0029] Determine whether there is a NOT IN keyword in the keyword;

[0030] If so, it is determined that the database operation statement has a NOT IN clause.

[0031] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for processing database operation statements are implemented.

[0032] According to another aspect of the present invention, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned methods for processing database operation statements are implemented.

[0033] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements the steps of any of the above-mentioned database operation statement processing methods when executing the machine executable program.

[0034] The method for processing database operation statements of the present invention first obtains the database operation statement; determines at any time whether the database operation statement has a NOT IN clause; if so, converts the NOT IN clause in the database operation statement into a sub-connection of a target type, and the sub-connection of the target type can be semi-connected. Through this method, the NOT IN clause in the database operation statement can be converted into a sub-connection of the target type, so that the semi-connection conversion of the NOT IN clause can be realized by the conversion principle of the sub-connection of the target type, thereby improving the execution efficiency of the database for the database operation statement containing the NOT IN clause.

[0035] Furthermore, the method for processing a database operation statement of the present invention first determines the target condition associated with the NOT IN clause; then wraps the target condition using the LNNVL function and adds it to the sub-connection condition; then converts the NOT IN clause into a sub-connection of the NOT EXISTS type as a conditional clause of the database operation statement. By this method, the NOT IN clause in the database operation statement can be converted into a NOT EXISTS clause, so that the semi-connection conversion of the NOT IN clause can be realized by the conversion principle of the NOT EXISTS sub-connection, thereby improving the execution efficiency of the database for the database operation statement containing the NOT IN clause.

[0036] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:

[0038] Figure 1 is a flowchart of a method for processing database operation statements according to an embodiment of the present invention;

[0039] Figure 2 is a flowchart of a method for processing database operation statements according to another embodiment of the present invention;

[0040] Figure 3 is a schematic diagram of a computer program product according to an embodiment of the present invention;

[0041] Figure 4 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and

[0042] Figure 5 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and these embodiments are intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present invention.

[0044] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.

[0045] Regarding the issue of NOT IN converting to semi-join, some manufacturers choose to set up a special semi-join processing method for NOT IN in the executor, such as KES's NA-Anti-Join; some manufacturers adopt adding additional or conditions to handle the problem of NOT IN processing NULL values, such as DM and SQL Server:

[0046] Select*from t1 where a not in(select a from t2);

[0047] Convert to

[0048] Select*from t1 semi join on(t1.a=t2.a or t1.a is NULL or t2.a ISNULL);

[0049] Although the above solutions can convert NOT IN into a semi-join, it is too complicated to set up an execution node alone, and using the or condition will cause the index to be unusable, etc.

[0050] In order to solve the above problems, the present invention provides a method for processing database operation statements. Figure 1 FIG. 1 is a flow chart of a method for processing a database operation statement according to an embodiment of the present invention. Figure 1 As shown, the method for processing the database operation statement at least includes the following steps S101 to S103.

[0051] Step S101, obtaining database operation statements. An optional example is SQL (Structured Query Language). SQL statements have multiple functions such as data manipulation and data definition. This language has interactive characteristics and can provide great convenience for users. In this step, the way to receive database operation statements can generally be active input by the user, or automatically generated by the database program during operation due to business needs. Those skilled in the art can decide the way to receive database operation statements according to actual conditions.

[0052] Step S102, determining whether the database operation statement contains a NOT IN clause.

[0053] In some optional embodiments, the step of determining whether a database operation statement contains a NOT IN clause may generally include: parsing the database operation statement to obtain a parsing result; identifying keywords in the database operation statement according to the parsing result; determining whether the keywords contain a NOT IN keyword; and if so, determining that the database operation statement contains a NOT IN clause. The NOT IN keyword is used to test whether a value does not exist in a column returned by a subquery.

[0054] Step S103: convert the NOT IN clause in the database operation statement into a sub-connection of the target type.

[0055] In some optional embodiments, the target type includes a NOT EXISTS type. The step of converting a NOT IN clause in a database operation statement into a sub-join of the target type may generally include: converting a NOT IN clause in a database operation statement into a sub-join of a NOT EXISTS type.

[0056] Alternatively, the general NOT IN statement handles NULL values ​​in different situations as follows:

[0057] 1. When there is a NULL value in the outer table and a value in the inner table is not empty, any comparison with NULL in the NOT IN clause will return NULL, resulting in the result of the entire NOT IN expression being UNKNOWN. Since UNKNOWN is not logically considered TRUE, the NOT IN result is UNKNOWN and NULL is not returned;

[0058] 2. In the case of NULL values ​​in the inner table, when the subquery returns a result set containing NULL, any comparison with NULL in the NOT IN clause will return NULL. Since NOT IN requires all comparisons to return FALSE to reach a TRUE conclusion (that is, the data in the outer table must not be in all the data in the inner table), as long as one comparison returns NULL, the result of the entire NOT IN expression is UNKNOWN. Therefore, even if the data in the outer table is not actually in the non-NULL data in the inner table, because the inner table contains NULL, using NOT IN will not return any rows (or the returned behavior is unpredictable).

[0059] Alternatively, the general NOT EXISTS statement handles NULL values ​​in different situations as follows:

[0060] 1. When there is a NULL value in the outer table and there is a non-null value in the inner table, the subquery returns 0 results, the NOT EXISTS result is TRUE, and the row where the NULL value is located will be returned. That is, if the data in the outer table is NULL, the result of the subquery will never be true (because NULL is not equal to any value, including itself), but this does not directly mean that NOT EXISTS is TRUE. In fact, the subquery will not return any rows in this case (because it will not match any rows), so NOT EXISTS is indeed TRUE, resulting in the row where the NULL value in the outer table is located being selected.

[0061] If the data in the outer table is non-NULL and does not exist in the inner table, then NOTEXISTS is also TRUE and the row will be selected.

[0062] 2. If there is a NULL value in the inner table, when comparing it with the NULL value in the inner table, the NULL value returns false, and the next data in the inner table is read. Therefore, the NULL value in the inner table does not affect the output of the outer table data. In other words, if the inner table contains NULL values, but these NULL values ​​are not related to any id in the outer table, then these NULL values ​​will not affect the result of NOT EXISTS. NOT EXISTS only cares whether there is at least one non-NULL and matching row.

[0063] According to the above processing logic, it can be seen that when NOT IN processes NULL values, UNKNOWN will be returned. And because of the logic of returning UNKNOWN, it is not equivalent to NOT EXISTS, so the NOTIN clause cannot be easily converted from a semi-join to an anti-join like the NOT EXISTS clause, which makes the execution efficiency of the NOT IN clause in the database low. Therefore, the method of the present invention chooses to convert the NOT IN clause in the database operation statement into a sub-join of the target type.

[0064] Optionally, the step of changing the NOT IN clause in the database operation statement to a NOT EXISTS type sub-connection may generally include: determining the target condition associated with the NOT IN clause; wrapping the target condition with the LNNVL function and adding it to the sub-connection condition; converting the NOT IN clause to a NOT EXISTS type sub-connection as the conditional clause of the database operation statement. Among them, the LNNVL function is a special function, and the LNNVL function is used to test whether a given condition is false (or the operand in the condition is NULL). If the given condition is false (including the "false" result caused by the operand in the condition being NULL), the LNNVL function returns True; if the condition is true, it returns False.

[0065] It is used to process logical expressions related to NULL values. The function of the LNNVL function is to treat any part of the result in the logical expression as FALSE when it is NULL, instead of causing the entire expression result to be NULL as in standard SQL logic. This function can convert the NULL value that was difficult to handle in the original NOTIN clause into a specific result, that is, it can make the entire logical expression give a clear TRUE or FALSE result even when there is a NULL value.

[0066] Through this method, the NOT IN clause in the database operation statement can be converted into a sub-join of the target type, so that the semi-join conversion of the NOT IN clause can be realized by using the conversion principle of the sub-join of the target type, thereby improving the execution efficiency of the database for the database operation statement containing the NOT IN clause.

[0067] In some optional embodiments, after the step of converting the NOT IN clause in the database operation statement into a sub-join of the target type, the following may generally be included: verifying the converted database operation statement to determine whether the converted database operation statement is correct; if so, performing a semi-join conversion according to the converted database operation statement.

[0068] Optionally, the step of performing semi-join conversion according to the converted database operation statement can generally include: converting the converted database operation statement semi-join into a database operation statement connected by ANTI JOIN. In general, regarding the efficiency improvement problem of NOT EXISTS sub-join, it is usually selected to convert NOT EXISTS into ANTI JOIN, thereby eliminating the sub-join, converting it into a semi-join, and reducing the huge performance cost caused by repeated scanning of the sub-join. Therefore, in this embodiment, it can also be selected that after converting the NOT IN clause into the NOT EXISTS sub-join, it is further converted into a database operation statement connected by ANTI JOIN according to the conversion logic of the NOT EXISTS sub-join. Through this method, the special processing of the NOTIN clause for NULL values ​​can be avoided, and the NOT IN clause is converted into a database operation statement connected by ANTI JOIN, thereby improving the execution efficiency of the NOT IN clause. Those skilled in the art can decide on their own the specific semi-join conversion method after the NOT IN clause is converted into the NOT EXISTS sub-join according to the actual situation.

[0069] Optionally, after the step of performing semi-join conversion according to the converted database operation statement, the method may generally further include: performing a performance analysis on the database operation statement after the semi-join conversion; if the result of the performance analysis shows that the query performance of the database operation statement after the semi-join conversion is lower than that of the original database operation statement, retaining the original database operation statement.

[0070] Figure 2 FIG. 1 is a flow chart of a method for processing a database operation statement according to another embodiment of the present invention. Figure 2 As shown, the method for processing the database operation statement at least includes the following steps S201 to S208.

[0071] Step S201, obtaining a database operation statement. In order to more clearly illustrate the method of the present invention, a specific SQL statement is provided, such as:

[0072] Select*from t1 where a not in(select a from t2)Equation 1

[0073] The purpose of the SQL statement shown in Formula 1 is to select from table t1 all records whose values ​​of column a are not in column a of table t2. In other words, it finds records that are unique in table t1 (with no corresponding column a value in table t2).

[0074] Specifically, the components of Formula 1 are explained as follows:

[0075] SELECT * FROM t1: This means select all the records of all the columns from the t1 table.

[0076] WHERE a NOT IN (SELECT a FROM t2): This is a conditional clause that filters records in the t1 table. Specifically, it checks whether the value of column a for each record in the t1 table is not in the result set returned by the subquery SELECT a FROM t2. The subquery SELECT a FROM t2 returns all the values ​​of column a in the table t2.

[0077] Step S202, determining whether the database operation statement contains a NOT IN clause.

[0078] Step S203: determine the target condition associated with the NOT IN clause.

[0079] Step S204, the target condition is wrapped with the LNNVL function and added to the sub-join condition. Wherein, if the a column of table t2 contains a null value (NULL), the SQL statement shown in Formula 1 may not work as expected, because if the NOT IN clause encounters a NULL value during comparison, UNKNOWN will be returned, which usually causes the entire NOT IN condition to fail (i.e., no row is returned). Due to the existence of this special case, the NOT IN clause cannot be easily converted to a semi-join. Generally, it is necessary to set up an execution node separately or use the or condition to convert it, but setting up an execution node separately is too complicated, and using the or condition will cause the index to be unusable, etc. Since the LNNVL function will convert it to True when facing a result of NULL, the method of the present invention selects to use the LNNVL function to convert the special case of the NULL value.

[0080] Specifically, the SQL statement shown in Formula 1 is used to compare column a of table t1 with column a of table t2, and the LNNVL function is a special function. The LNNVL function is used to test whether a given condition is false (or the operand in the condition is NULL). If the given condition is false (including the "false" result caused by the operand in the condition being NULL), the LNNVL function returns True; if the condition is true, it returns False. Therefore, in the process of wrapping with the LNNVL function in step S204, the target condition is converted to t1.a=t2.a, and due to the characteristics of the LNNVL function, NOT needs to be added to ensure the correctness of the result. Through the operation of step S204, LNNVL (NOT (t1.a=t2.a)) will be obtained.

[0081] Step S205: convert the NOT IN clause into a NOT EXISTS type sub-connection as a conditional clause of the database operation statement.

[0082] Specifically, the converted SQL statement is shown in Formula 2:

[0083] Select*from t1 where not exists(select 1from t2 where LNNVL(NOT(t1.a=t2.a))) Formula 2

[0084] It can be seen from the SQL statement shown in Formula 2 that the sub-join corresponding to not exists is select 1from t2where LNNVL(NOT(t1.a=t2.a)), where select 1from t2 means searching for constant 1 in table t2, so the result in this statement mainly depends on LNNVL(NOT(t1.a=t2.a)).

[0085] The conversion results of LNNVL(NOT(t1.a=t2.a)) for different situations are as follows:

[0086] NOT (true) = false; NOT (false) = true; NOT (NULL) = NULL;

[0087] LNNVL(true)=false; LNNVL(false)=true; LNNVL(NULL)=true;

[0088] The result of the SQL statement converted in this way will not be UNKNOWN due to the presence of NULL values. Specifically, (1) when there is a NULL value in the outer table and the inner table has a non-null value, NOT(NULL) = NULL, LNNVL(NULL) = true, the subquery returns 1 result, NOT EXIST returns false, and the outer table NULL value is not returned.

[0089] (2) If the inner table contains NULL values, NOT(NULL) = NULL, LNNVL(NULL) = true, subquery returns 1 record, NOT EXIST returns false, and no data in the outer table is returned.

[0090] (3) Both the inner and outer tables are NULL values, NOT(NULL=NULL)=NULL, LNNVL(NULL)=true, subquery returns 1 result, NOT EXIST returns false, and NULL values ​​are not output.

[0091] The above logic is consistent with the logic of formula 1, so it can be proved that the equation is valid in the processing of NULL values.

[0092] This method can be used to convert the NOT IN clause in the database operation statement into a NOT EXISTS clause, so that the semi-join conversion of the NOT IN clause can be realized by using the conversion principle of the NOT EXISTS sub-join, thereby improving the execution efficiency of the database for database operation statements containing the NOT IN clause.

[0093] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.

[0094] It should be understood that in some embodiments, each part can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0095] This embodiment also provides a computer program product 10 , a computer readable storage medium 20 , and a computer device 30 . Figure 3 is a schematic diagram of a computer program product 10 according to an embodiment of the present invention, Figure 4 is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention, Figure 5is a schematic diagram of a computer device 30 according to an embodiment of the present invention. The computer program product 10 includes a computer program 11, which implements the steps of any of the above-mentioned methods for processing database operation statements when executed by a processor 32. The computer-readable storage medium 20 stores the above-mentioned computer program 11, which implements the steps of any of the above-mentioned methods for processing database operation statements when executed by a processor 32. The computer device 30 may include a memory 31, a processor 32, and the computer program 11 stored in the memory 31 and running on the processor 32.

[0096] The computer program 11 for performing the operation of the present invention may be an assembly instruction, an instruction set architecture (ISA) instruction, a machine instruction, a machine-related instruction, a microcode, a firmware instruction, a state setting data, a configuration data of an integrated circuit, or a source code or an object code written in any combination of one or more programming languages ​​and process programming languages. The computer program 11 may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider via the Internet). In some embodiments, in order to perform various aspects of the present invention, an electronic circuit including, for example, a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA) may execute computer-readable program instructions by utilizing the state information of the computer-readable program instructions to personalize the electronic circuit.

[0097] For the purposes of the description of the present embodiment, the computer program product 10 is a related product that includes the computer program 11. For the purposes of the description of the present embodiment, the computer readable storage medium 20 is a tangible device capable of retaining and storing the computer program 11, which may be any device that can contain, store, communicate, propagate or transmit the program 11 for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of the computer readable storage medium 20 include the following: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, and any suitable combination of the foregoing.

[0098] The computer device 30 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 30 may be a cloud computing node. The computer device 30 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 30 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.

[0099] The computer device 30 may include a processor 32 adapted to execute stored instructions, and a memory 31 providing temporary storage space for the operation of the instructions during operation. The processor 32 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 31 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.

[0100] The computer device 30 may also include a network adapter / interface and an input / output (I / O) interface. The I / O interface allows data to be input and output with external devices that may be connected to the computer device. The network adapter / interface may provide communication between the computer device and a network, which is typically shown as a communication network.

[0101] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.

Claims

1. A method for processing a database operation statement, comprising: Obtaining the database operation statement; Determine whether the database operation statement contains a NOT IN clause; If so, the NOT IN clause in the database operation statement is converted into a sub-join of the target type, and the sub-join of the target type can be converted into a semi-join.

2. The method for processing database operation statements according to claim 1, wherein: The target type includes a NOT EXISTS type; The step of converting the NOT IN clause in the database operation statement into a sub-connection of a target type comprises: The NOT IN clause in the database operation statement is converted into a sub-connection of the NOT EXISTS type.

3. The method for processing database operation statements according to claim 2, wherein: The step of changing the NOT IN clause in the database operation statement to a sub-connection of the NOT EXISTS type comprises: Determine a target condition associated with the NOT IN clause; Wrap the target condition using the LNNVL function and add it to the sub-connection condition; The NOT IN clause is converted into a NOT EXISTS type sub-connection as a conditional clause of the database operation statement.

4. The method for processing database operation statements according to claim 1, wherein: After the step of converting the NOT IN clause in the database operation statement into a sub-connection of a target type, the following steps are further included: Verifying the converted database operation statement to determine whether the converted database operation statement is correct; If so, the semi-join conversion is performed according to the converted database operation statement.

5. The method for processing database operation statements according to claim 4, wherein: The step of performing the semi-join conversion according to the converted database operation statement comprises: The converted database operation statement is semi-joined and converted into an ANTI JOIN-joined database operation statement.

6. The method for processing database operation statements according to claim 4, wherein: After the step of performing the semi-join conversion according to the converted database operation statement, the following step further comprises: Performing performance analysis on the database operation statements after the semi-join conversion; If the result of the performance analysis shows that the query performance of the database operation statement after the semi-join conversion is lower than that of the original database operation statement, the original database operation statement is retained.

7. The method for processing database operation statements according to claim 1, wherein: The step of determining whether the database operation statement contains a NOT IN clause comprises: Parsing the database operation statement to obtain a parsing result; Identify keywords in the database operation statement according to the analysis result; Determine whether there is a NOT IN keyword in the keywords; If so, it is determined that the database operation statement has a NOT IN clause.

8. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method for processing a database operation statement according to any one of claims 1 to 7 are implemented.

9. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method for processing a database operation statement according to any one of claims 1 to 7.

10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the steps of the method for processing database operation statements according to any one of claims 1 to 7 when executing the machine executable program.