Sub-link processing method and device for query statement, equipment and storage medium

By converting the equivalent connections in the database query statement into non-correlated sublinks, the problem of complex operation and low execution efficiency of non-correlated sublink query statements is solved, and more efficient query processing is achieved.

CN118939686APending Publication Date: 2024-11-12CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411312019.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the prior art, the query statements for non-related sublinks are complex in operation and low execution efficiency.

Method used

When obtaining the query statement of the database, if the sublink containing the equivalent connection is modified to a non-correlated sublink, the query statement is optimized to reduce the calculation amount and improve execution efficiency.

Benefits of technology

By converting equivalence connections into non-correlated sublinks, the computational amount of query statements is reduced and the execution efficiency of query statements is improved, which is suitable for more optimization methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939686A_ABST
    Figure CN118939686A_ABST
Patent Text Reader

Abstract

The invention provides a sublink processing method and device for a query statement, equipment and a storage medium. After a first query statement of a database is obtained, when the first query statement comprises a first sublink and the query condition of the first sublink comprises an equivalent connection, the first sublink is sublinked; the sub-link in the first query statement is modified to obtain a second query statement comprising a second sub-link, the second query statement does not comprise an equivalent link and is a non-correlation sub-link, and when the second query statement is executed to query data finally, data comparison calculation does not need to be carried out between different tables, so that the data query efficiency is improved. And other optimization processing is easier to perform on the non-correlation sub-links, so that the calculation amount of the query statements is reduced, and the execution efficiency of the query statements can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a method, device, equipment and storage medium for processing sub-links of a query statement. Background Art

[0002] The query statement of the database includes various query conditions. When the query device executes the query statement, it can judge whether the data in the query table meets the query conditions, and finally query to obtain the data that meets the conditions.

[0003] In existing query statements, one query condition includes a comparison calculation between the data in the table to be queried and the data in other tables. The query statement with this query condition is called a related sub-link; another query condition includes querying the data in the table to be queried from the query results of other tables. The query statement with this query condition is called a non-related sub-link. It can be seen that the query statement with a non-related sub-link involves a comparison calculation between two tables during the query, which makes the execution of this query statement more complicated and the execution efficiency is low. Summary of the invention

[0004] The present application provides a method, device, equipment and storage medium for processing sub-links of a query statement, so as to solve the technical problems in the prior art that the operation of query statements including non-related sub-links is relatively complex and the execution efficiency is low.

[0005] In a first aspect, the present application provides a method for processing sub-links of a query statement, comprising: obtaining a first query statement from a database, the first query statement being used to query data in a first table; when the first query statement includes a first sub-link, and the query condition of the first sub-link is an equi-connection of any column of the first table and any column of the second table, modifying the first query statement to obtain a second query statement, the second query statement including a second sub-link, and the query condition of the second sub-link is the first column and the second column of the second table; executing the second query statement to query the data in the first table.

[0006] In an embodiment of the first aspect of the present application, after modifying the first query statement to obtain the second query statement, it also includes: optimizing the second query statement to obtain a third query statement; and executing the third query statement to query the data in the first table.

[0007] In an embodiment of the first aspect of the present application, modifying the first query statement to obtain a second query statement includes: when the first query statement is connected to an operator of the first sub-link through a preset operator, modifying the first query statement to obtain the second query statement.

[0008] In an embodiment of the first aspect of the present application, the preset operator includes an in operator, an any operator or a some operator.

[0009] In an embodiment of the first aspect of the present application, the modification of the first query statement to obtain the second query statement includes: determining the operators of the first column and the second column of the second table in the query condition of the second sub-link and the operator for querying the first table according to the equivalent connection in the first query statement; modifying the operator of the first sub-link to the operator of the second sub-link to obtain the second query statement.

[0010] In an embodiment of the first aspect of the present application, after optimizing the second query statement to obtain the third query statement, it also includes: calculating the time cost value of the first query statement and the time cost value of the third query statement; when the time cost value of the first query statement is less than the time cost value of the third query statement, executing the first query statement; when the time cost value of the first query statement is greater than the time cost value of the third query statement, executing the third query statement.

[0011] The second aspect of the present application provides a sub-link processing device for a query statement, including: an acquisition module, used to acquire a first query statement from a database, the first query statement is used to query data in a first table; a processing module, used to modify the first query statement to obtain a second query statement when the first query statement includes a first sub-link and the query condition of the first sub-link is an equi-connection of any column of the first table and any column of the second table, the second query statement includes a second sub-link, and the query condition of the second sub-link is the first column and the second column of the second table; an execution module, used to execute the second query statement to query the data in the first table.

[0012] The third aspect of the present application provides a sub-link processing device for a query statement, comprising: a memory and a processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the processor executes the sub-link processing method for the query statement as described in any one of the first aspect of the present application.

[0013] A fourth aspect of the present application provides a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the sub-link processing method of the query statement as described in any one of the first aspects of the present application.

[0014] A fifth aspect of the present application provides a computer program product, including a computer program, which, when executed, implements the sub-link processing method of the query statement as described in any one of the first aspects of the present application.

[0015] In summary, the sub-link processing method, device, equipment and storage medium of the query statement provided by the present application, after obtaining the first query statement of the database, when the first query statement includes the first sub-link and the query condition of the first sub-link includes an equi-join, the sub-link in the first query statement is modified to obtain a second query statement including the second sub-link, wherein the second query statement does not include an equi-join and is a non-related sub-link. When the second query statement is finally executed to query the data, since there is no need to compare and calculate data between different tables and it is easier to perform other optimization processing on non-related sub-links, it not only reduces the calculation amount of the query statement, but also improves the execution efficiency of the query statement. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0017] Figure 1 A schematic diagram of the application scenario of this application;

[0018] Figure 2 A schematic diagram of optimizing query statements in the prior art;

[0019] Figure 3 A flowchart of an embodiment of a method for processing sub-links of a query statement provided by the present application;

[0020] Figure 4 A flowchart of another embodiment of the method for processing sub-links of a query statement provided by the present application;

[0021] Figure 5 A flowchart of another embodiment of the method for processing sub-links of a query statement provided by the present application;

[0022] Figure 6 A schematic diagram of the structure of a sub-link processing device for a query statement provided by the present application;

[0023] Figure 7 A structural diagram of a sub-link processing device for a query statement provided in this application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] Figure 1 This is a schematic diagram of the application scenario of this application, such as Figure 1 As shown, the present application is applied in the technical field of databases. Among them, the database 20 can be a device that can be used to store data, such as an SQL database, an Oracle database, a Kingbase database, etc., and the embodiment of the present application does not limit the type of the database 20. The electronic device 10 can be a computer, a server, a workstation, etc., and the electronic device 10 can communicate with the database 20. In an application scenario, a user can send a data query statement to the electronic device 10, and the data query statement is used to query the database 20 for data that meets the conditions. Then the electronic device 10 obtains data from the database 20 according to the data query statement and returns it to the user who needs to query the data.

[0027] In recent years, with the development of new database application scenarios such as mobile Internet, big data, artificial intelligence, and new database hardware technologies, the scale and complexity of databases have increased significantly, and the amount of data that needs to be processed is increasing. When processing query statements, the devices in the database management system try to optimize the query statements as much as possible to improve the processing efficiency of the query statements. For example, Figure 2 The diagram is a schematic diagram of optimizing query statements in the prior art.

[0028] In the first existing optimization scheme, the optimization method of the query statement provided is to convert the sub-link of the in operator into the semi join logic. For example, for the query statement select*from t1 where ain(select a from t2) including the non-correlated sub-link, the optimizer performs optimization processing to obtain the modified query statement select*from t1semi join t2 on t1.a=t2.a; for the query statement select*from t1 where ain(select a from t2 where t1.b=t2.b) including the correlated sub-link, the optimizer performs optimization processing to obtain the modified query statement select*from t1 semi join t2 on t1.a=t2.a and t1.b=t2.b.

[0029] In the second existing optimization scheme, the optimization method of the query statement provided is only for the query statement select*from t1 where a in(select a from t2) including non-related sub-links, and its execution strategy is to execute the sub-link content first and then use it as a filtering condition to generate result set information.

[0030] Of the two query optimization methods mentioned above, the first method of converting to semi join is applicable to almost all scenarios and can avoid repeated scanning of related sub-links. Compared with non-related sub-links that are not optimized, it only incurs the cost of join operations and has better performance. However, when the amount of data in the inner table is extremely small, the second method of executing the logic without conversion will have better performance than the first method, and the inner table logic will be executed first as the outer table filtering condition. This execution method can be used for remote table query operations, which the first solution cannot do.

[0031] Reference Figure 2 For query statements including non-related sub-links, the first or second method mentioned above can be used for optimization, thereby improving the execution efficiency of the query statements; for query statements including related sub-links, some optimization methods do not support their optimization and cannot improve efficiency.

[0032] In response to the above problems, the present application provides a method for processing sub-links of a query statement. When processing a query statement, in order to make the query statement applicable to as many optimization methods as possible, the relevant sub-links in the query statement are converted into non-relevant sub-links. Since it is easier to perform other optimization processing on non-relevant sub-links, this not only reduces the amount of calculation of the relevant sub-links of the query statement itself, but also enables the query statement to be optimized through more methods, thereby improving the execution efficiency of the query statement.

[0033] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0034] Figure 3 A flowchart of an embodiment of a method for processing sub-links of a query statement provided by the present application is shown as follows: Figure 3 The sub-link processing method of the query statement shown can be applied to Figure 1 In the scenario shown, it is executed by the electronic device 10. In one embodiment, Figure 3 The sub-link processing method of the query statement shown includes:

[0035] S101: Obtain a first query statement from a database. The electronic device may receive a query statement indicated by a user, or the electronic device may receive a query statement sent by another device. In this embodiment, the query statement received by the electronic device is recorded as the first query statement. In one embodiment, the query statement may be a Structured Query Language (SQL) statement.

[0036] S102: When the first query statement includes a first sub-link, and the query condition of the first sub-link is an equi-connection of any column of the first table and any column of the second table, the first query statement is modified to obtain a second query statement, and the second query statement is used to query the data of the first table. The second query statement obtained after modification includes a second sub-link, and the query condition of the second sub-link is the first column and the second column of the second table.

[0037] In one embodiment, after obtaining the first query statement, the processing of the first query statement may include at least the following stages: first, the first query statement is parsed, then the first query statement is logically and physically optimized by the optimizer to obtain the second query statement, and finally the optimized second query statement is executed by the executor. Then the above step S102 of the present application corresponds to the stage in which the optimizer optimizes the first query statement to obtain the second query statement after obtaining the first query statement and before the executor executes the second query statement.

[0038] For example, take the first query statement select*from t1 where a in(select a from t2 where t1.b=t2.b) as an example. The query statement includes the first sub-link (select a from t2 where t1.b=t2.b), and the query condition after the where operator in the first sub-link has and only has the equi-join relationship between column b t1.b of the first table t1 and column b t2.b of the second table t2. Then the optimizer can modify the above first query statement to obtain the second query statement select*from t1 where(t1.a,t1.b)in(select a,b from t2). The second query statement includes the second sub-link (select a,b from t2), the query conditions of the second sub-link are the first column a and the second column b of the second table t2, and the second query statement is used to query the data in the first table t1.

[0039] In a specific implementation, when modifying the first query statement, the optimizer determines the operator select a,b from t2 for the first column a and the second column b of the second table in the query condition of the second sub-link of the second query statement, and the operator t1 where(t1.a,t1.b) for querying the first table t1, based on the equi-connection t1.b=t2.b in the first query statement. Then, based on the obtained operator, the operator of the first sub-link in the first query statement is modified to the operator of the second sub-link, thereby transforming the simple expression, splitting the equi-connection in the first sub-link, and obtaining the second query statement select*from t1 where(t1.a,t1.b)in(select a,b fromt2) that does not include the relevant sub-link.

[0040] In another example, the first query statement is select*from t1 where a in(select a fromt2where t1.b=t2.b+1), and the query statement includes the first sub-link, and the query condition of the first sub-link has and only has the equi-join relationship between the b column t1.b of the first table t1 and the b+1 column t2.b+1 of the second table t2. The optimizer can modify the first query statement to obtain the second query statement select*from t1 where(t1.a,t1.b)in(selecta,b+1from t2).

[0041] S103: Execute the second query statement. Specifically, after the optimizer completes processing the first query statement to obtain the second query statement in S102, the executor may execute the second query statement optimized by the optimizer.

[0042] In summary, in an embodiment of the present application, after obtaining a first query statement of a database, when the first query statement includes a first sub-link and there is and only an equi-connection in the query condition of the first sub-link, the sub-link in the first query statement is modified to obtain a second query statement including a second sub-link, wherein the second query statement does not include an equi-connection, that is, the sub-link type in the modified second query statement is a non-related sub-link. When the second query statement is finally executed to query data, since there is no need to perform data comparison calculations between different tables and it is easier to perform other optimization processing on non-related sub-links, the calculation amount of the query statement is reduced and the execution efficiency of the query statement can be improved.

[0043] For example, Figure 4 A flowchart of another embodiment of the method for processing sub-links of a query statement provided by the present application is shown as follows: Figure 4 The method shown in Figure 3 On the basis shown, after S102, it also includes:

[0044] S104: Optimize the second query statement to obtain a third query statement.

[0045] Combination Figure 2 In the scenario shown, when the second query statement is a query statement including non-correlated sub-links, select*from t1 where a in(select a from t2), the optimizer performs optimization processing to obtain the modified third query statement as select*from t1 semi join t2 on t1.a=t2.a. When the second query statement is a query statement including non-correlated sub-links, select*from t1 where a in(select a from t2), the corresponding optimization processing can also be performed. Therefore, after the present application, Figure 2 The second query statement obtained after the processing by the method shown can be applied to more optimization methods compared to the first query statement before processing, thereby expanding the optimization scenarios of the query statement and facilitating the subsequent addition of more optimization solutions.

[0046] In other examples, when the second query statement is select * from t1 where a in (select a from t2 where b<10), the third query statement may be selected * from t1semi joint2 on t1.a=t2.a and t2.b<10 after optimization processing.

[0047] S105: Execute the third query statement. Specifically, after the optimizer completes processing the second query statement to obtain the third query statement in S104, the executor may execute the third query statement optimized by the optimizer.

[0048] In one embodiment of the present application, after the optimizer optimizes the third query statement, it also calculates the time cost value of the first query statement that was not modified, and calculates the time cost value of the third query statement obtained after processing. If the time cost value of the third query statement is less than the time cost value of the first query statement, it means that the execution efficiency of the query statement after modification and optimization is higher, and the executor executes the third query statement. If the time cost value of the third query statement is greater than the time cost value of the first query statement, it means that the execution efficiency of the query statement after modification and optimization is lower, and the executor also executes the unprocessed first query statement. This embodiment can select the query statement with a smaller time cost value after processing to execute, thereby achieving a more intelligent selection in a manner that is more adaptable to various situations, and more effectively improving the execution efficiency of the query statement.

[0049] In addition, in some scenarios, the second query statement may not be optimized, so that the second query statement can continue to be executed. For example, when the second query statement is select*from t1 where a in(select a from t2 where b<10), it is not necessary to convert it into the third query statement select*from t1semi join t2 on t1.a=t2.aand t2.b<10. Instead, the subquery of the non-related IN sub-join is executed only once. Therefore, the cost of repeated execution of the sub-join is too high. The driving order of the IN clause is followed. When the sub-join query result set is small, the outer table is directly processed as a filtering condition compared with the semi join operation in the converted third query statement, which reduces the join operation and improves the query statement processing efficiency to a certain extent.

[0050] In one embodiment of the present application, in S102, when the first query statement contains an operator corresponding to a first sub-link connected by a preset operator, the optimizer modifies the first query statement to obtain a second query statement.

[0051] In one embodiment, the preset operator includes: an in operator, an any operator or a some operator.

[0052] For example, for the first query statement select*from t1 where a in(select a from t2 where t1.b=t2.b+1), the in operator is connected to the operator corresponding to the first child link (select a from t2where t1.b=t2.b+1). At this time, the optimizer determines to modify the first query statement, thereby obtaining the second query statement Select*from t1 where(t1.a,t1.b)in(select a,b+1from t2).

[0053] For another example, for the first query statement select * from t1 where a = any (select a from t2 where t1.b = t2.b + 1), where the any operator is connected to the operator corresponding to the first sub-link (select a from t2 where t1.b = t2.b + 1), the optimizer determines to modify the first query statement, thereby obtaining the second query statement select * from t1 where (t1.a, t1.b) = any (select a, b + 1 from t2).

[0054] For another example, for the first query statement select * from t1 where a = some (select a from t2 where t1.b = t2.b + 1), where the some operator is connected to the operator corresponding to the first child link (select a from t2 where t1.b = t2.b + 1), the optimizer determines to modify the first query statement to obtain the second query statement select * from t1 where (t1.a, t1.b) = some (select a, b + 1 from t2).

[0055] Figure 5 A flowchart of another embodiment of the method for processing sub-links of a query statement provided by the present application is shown as follows: Figure 5 The method shown can be Figure 2 A specific implementation of S102 based on the example shown in FIG. Figure 5The sub-link processing method of the query statement shown includes: after determining the first query statement to be processed in S1021, judging whether there is a preset budget operator (in operator, any operator, some operator, etc.) in the first query statement through S1022; if so, further judging whether the sub-link in the first query statement is a related sub-link through S1023; if so, further judging whether the query condition of the sub-link has and only has an equivalue connection between tables through S1024; if so, modifying the first query statement to obtain a second query statement through S1025. When the judgment results in S1022, S1023, and S1024 are no, it is determined not to modify the first query statement according to the method provided by the present application, and other processing of the first query statement is continued.

[0056] In the aforementioned embodiments of the present application, the sub-link processing method of the query statement provided by the embodiments of the present application is introduced, and in order to realize the functions in the method provided by the above embodiments of the present application, the electronic device as the execution subject may include a hardware structure and / or a software module, and the above functions are realized in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether one of the above functions is executed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.

[0057] For example, Figure 6 A schematic diagram of the structure of a sub-link processing device for a query statement provided by the present application, such as Figure 6 The device shown can be used to perform Figure 2-5 Any of the above methods for processing sub-links of a query statement. In one embodiment, Figure 6 The sub-link processing device 1000 of the query statement shown includes: an acquisition module 1001, a processing module 1002 and an execution module 1003. The acquisition module 1001 is used to acquire a first query statement of a database, and the first query statement is used to query data in a first table; the processing module 1002 is used to modify the first query statement to obtain a second query statement when the first query statement includes a first sub-link and the query condition of the first sub-link is an equi-connection of any column of the first table and any column of the second table, and the second query statement includes a second sub-link, and the query condition of the second sub-link is the first column and the second column of the second table; the execution module 1003 is used to execute the second query statement to query data in the first table.

[0058] In one embodiment, the processing module 1002 is further used to optimize the second query statement to obtain a third query statement, and the execution module 1003 is further used to execute the third query statement to query the data in the first table.

[0059] In one embodiment, the processing module 1002 determines the operators of the first column and the second column of the second table in the query condition of the second sub-link and the operator for querying the first table based on the equivalent connection in the first query statement; modifies the operator of the first sub-link to the operator of the second sub-link to obtain the second query statement.

[0060] In one embodiment, the processing module 1002 is also used to calculate the time cost value of the first query statement and the time cost value of the third query statement; when the time cost value of the first query statement is less than the time cost value of the third query statement, the execution module 1003 executes the first query statement; when the time cost value of the first query statement is greater than the time cost value of the third query statement, the execution module 1003 executes the third query statement.

[0061] The specific implementation manner and principle of the above-mentioned sub-link processing device for query statements refer to the description of the above-mentioned sub-link processing method for query statements, which will not be repeated here.

[0062] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the processing module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above-mentioned module is determined. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0063] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0064] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0065] For example, Figure 7 A schematic diagram of the structure of a sub-link processing device for a query statement provided in this application, such as Figure 7 The device shown can be used to perform Figure 2-Figure 5 A method for processing a sublink of a query statement as shown in any one of the items. In one embodiment, Figure 7The sub-link processing device 2000 of the query statement shown includes one or more processors 2001 and a memory 2002; wherein the memory 2002 is used to store computer executable instructions, and the processor 2001 can execute the computer executable instructions stored in the memory 2002. When the computer executable instructions are executed by the processor 2001, the processor 2001 implements the sub-link processing method of any query statement in the aforementioned embodiments of the present application.

[0066] In one embodiment, if Figure 7 The query statement sub-link processing device 2000 shown also includes a communication interface 2003 , wherein the processor 2001 can communicate with other devices through the communication interface 2003 , for example, the processor 2001 obtains the first query statement through the communication interface 2003 .

[0067] The present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed, they can be used to implement a sub-link processing method for any query statement in the aforementioned embodiments of the present application.

[0068] An embodiment of the present application also provides a chip for executing instructions, wherein the chip is used to execute a sub-link processing method of any query statement as described above in the present application.

[0069] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed, implements a sub-link processing method for any query statement as described above in the present application.

[0070] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0071] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing sub-links of a query statement, characterized in that: include: Obtain a first query statement from a database, where the first query statement is used to query data in a first table; When the first query statement includes a first sub-link, and the query condition of the first sub-link is an equi-connection of any column of the first table and any column of the second table, modify the first query statement to obtain a second query statement, the second query statement includes a second sub-link, and the query condition of the second sub-link is the first column and the second column of the second table; The second query statement is executed to query the data in the first table.

2. The method according to claim 1, characterized in that After modifying the first query statement to obtain the second query statement, the method further includes: Optimizing the second query statement to obtain a third query statement; The third query statement is executed to query the data in the first table.

3. The method according to claim 1 or 2, characterized in that: The modifying the first query statement to obtain a second query statement includes: When the first query statement is connected to the operator of the first sub-link through a preset operator, the first query statement is modified to obtain a second query statement.

4. The method according to claim 3, characterized in that The preset operator includes an in operator, an any operator or a some operator.

5. The method according to claim 4, characterized in that The modifying the first query statement to obtain a second query statement includes: Determine, according to the equi-connection in the first query statement, the operators for the first column and the second column of the second table in the query condition of the second sub-link, and the operator for querying the first table; The operator of the first sub-link is modified to the operator of the second sub-link to obtain the second query statement.

6. The method according to claim 2, characterized in that After optimizing the second query statement to obtain a third query statement, the method further includes: Calculating a time cost value of the first query statement and a time cost value of the third query statement; When the time cost value of the first query statement is less than the time cost value of the third query statement, executing the first query statement; When the time cost value of the first query statement is greater than the time cost value of the third query statement, the third query statement is executed.

7. A sub-link processing device for a query statement, characterized in that: include: An acquisition module, used to acquire a first query statement from a database, where the first query statement is used to query data in a first table; a processing module, configured to modify the first query statement to obtain a second query statement when the first query statement includes a first sub-link and the query condition of the first sub-link is an equi-connection of any column of the first table and any column of the second table, wherein the second query statement includes a second sub-link and the query condition of the second sub-link is the first column and the second column of the second table; An execution module is used to execute the second query statement to query the data in the first table.

8. A sub-link processing device for a query statement, characterized in that: include: Memory and processor; The memory stores computer executable instructions; The processor executes the computer executable instructions stored in the memory, so that the processor executes the sub-link processing method of the query statement according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and when the computer executable instructions are executed, the sub-link processing method of the query statement according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that It comprises a computer program, which, when executed, implements the sub-link processing method of the query statement according to any one of claims 1 to 6.