SQL instruction execution method, device, electronic device and computer readable medium
By performing structural transformation and data table grouping of the logical connection operator of SQL instructions, the problem of excessive search space for SQL instruction execution plan in distributed databases is solved, and efficient execution of SQL instructions is achieved.
Patent Information
- Application Number
- CN201910754039.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-15
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2039-08-15
AI Technical Summary
In the prior art, when processing the execution plan search space of SQL instructions in a distributed database, it is difficult to effectively reduce the search space, thereby affecting the execution efficiency of SQL instructions, especially when connecting multiple data tables.
By converting the original binary tree structure of the logical connection operator corresponding to the SQL instruction, the dense connection operator and its multi-fork tree structure are obtained, and the data tables are grouped, and finally converted into a standard binary tree structure to determine that it can be pushed down to the distribution logical connection operator executed by database nodes.
This method can push down the push-down logical connection operator to the distributed database node to significantly reduce the search space of the execution plan, thereby improving the execution efficiency of SQL instructions and saving data pull time.
Smart Images

Figure CN112395302B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of databases, and in particular to a method, device, electronic device, and computer-readable medium for executing SQL instructions. Background Art
[0002] For distributed databases, if the join operator in the relational algebra expression corresponding to the SQL instruction connects multiple data tables, the search space of the execution plan corresponding to the SQL instruction is particularly huge. It is very important to quickly select an execution plan with low execution cost in the huge search space, which directly affects the final execution time of the SQL instruction. For SQL instructions with join operators connecting multiple data tables, since the search space of the execution plan of the SQL instruction is too large, it is usually necessary to trim the search space of the execution plan to reduce the search space of the execution plan of the SQL instruction, thereby effectively improving the execution efficiency of the SQL instruction.
[0003] In the prior art, two schemes are usually used to trim the search space of the execution plan of the SQL instruction to reduce the search space of the execution plan of the SQL instruction. The first scheme is to determine the push-down of the connection operator connecting multiple data tables through the table inheritance relationship explicitly specified by the user. However, this scheme can only push down the connection operator of the data table with inheritance relationship, and cannot push down the connection operator of the data table of the brother node. In addition, from the currently disclosed information, there is no reordering of the connection operators connecting multiple data tables to search for more push-down possibilities. Therefore, the push-down capability of the scheme for the connection operators connecting multiple data tables is limited, and the search space of the execution plan corresponding to the SQL instruction cannot be effectively reduced, thereby failing to improve the execution efficiency of the SQL instruction. The second scheme is to determine the push-down of the connection operator connecting multiple data tables through the splitting rule and the split key equality condition. However, the push-down situation of this scheme is not fully considered, for example, a single table cannot be pushed down with a split table. In addition, there is no reordering of the connection operators connecting multiple data tables to search for more push-down possibilities. Therefore, the solution's push-down capability for the join operator connecting multiple data tables is not extreme enough, and the search space of the execution plan corresponding to the SQL instruction cannot be effectively reduced, thereby failing to improve the execution efficiency of the SQL instruction.
[0004] Therefore, how to improve the execution efficiency of SQL instructions by effectively reducing the search space of the execution plan corresponding to the SQL instructions has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The purpose of the present application is to propose a method, device, electronic device and computer-readable medium for executing SQL instructions, so as to solve the problem existing in the prior art of how to improve the execution efficiency of SQL instructions by effectively reducing the search space of the execution plan corresponding to the SQL instructions.
[0006] According to a first aspect of an embodiment of the present application, a method for executing an SQL instruction is provided. The method comprises: converting an original binary tree structure of a received logical connection operator corresponding to a first SQL instruction to obtain a dense connection operator corresponding to the first SQL instruction and a multi-tree structure of the dense connection operator; grouping data tables connected by the dense connection operator to obtain a grouping result of the data table; based on the grouping result, converting the multi-tree structure of the dense connection operator corresponding to the first SQL instruction to obtain a standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node execution of the distributed database.
[0007] According to a second aspect of an embodiment of the present application, a device for executing SQL instructions is provided. The device comprises: a first conversion module, configured to convert an original binary tree structure of a received logical connection operator corresponding to a first SQL instruction, so as to obtain a dense connection operator corresponding to the first SQL instruction and a multi-tree structure of the dense connection operator; a grouping module, configured to group data tables connected by the dense connection operator, so as to obtain a grouping result of the data table; and a second conversion module, configured to convert the multi-tree structure of the dense connection operator corresponding to the first SQL instruction based on the grouping result, so as to obtain a standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node execution of the distributed database.
[0008] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; and a computer-readable medium configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for executing SQL instructions as described in the first aspect of the above embodiment.
[0009] According to a fourth aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for executing the SQL instruction as described in the first aspect of the above embodiment is implemented.
[0010] According to the technical solution provided in the embodiment of the present application, the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction is converted to obtain the dense connection operator and the multi-tree structure of the dense connection operator corresponding to the first SQL instruction, and the data tables connected by the dense connection operator are grouped to obtain the grouping results of the data tables. Based on the grouping results, the multi-tree structure of the dense connection operator corresponding to the first SQL instruction is converted to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node of the distributed database for execution. Compared with the existing solution, by converting the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction into the standard binary tree structure for determining the logical connection operator that can be pushed down to the node of the distributed database for execution, the pushable logical connection operator corresponding to the received first SQL instruction can be pushed down to the node of the distributed database to the extreme, effectively reducing the search space of the execution plan corresponding to the first SQL instruction, thereby significantly improving the execution efficiency of the first SQL instruction.
[0011] In addition, by pushing down the push-down logical connection operator corresponding to the received first SQL instruction to the node of the distributed database for execution, the push-down logical connection operator can be executed as close as possible to the distributed storage node of the data table connected to the push-down logical connection operator, thereby saving the time of pulling the data table when executing the push-down logical connection operator, thereby effectively improving the execution performance of the push-down logical connection operator corresponding to the first SQL instruction. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0013] Figure 1A This is a flowchart of the steps of the method for executing SQL instructions in Example 1 of the present application;
[0014] Figure 1B A schematic diagram of a conversion process of an original binary tree structure of a logical connection operator corresponding to an SQL instruction provided in Embodiment 1 of the present application;
[0015] Figure 2A This is a flowchart of the steps of the method for executing the SQL command in the second embodiment of the present application;
[0016] Figure 2B A schematic diagram of the execution process of the SQL instruction provided according to the second embodiment of the present application;
[0017] Figure 3 This is a schematic diagram of the structure of the SQL instruction execution device in the third embodiment of the present application;
[0018] Figure 4 This is a schematic diagram of the structure of the SQL instruction execution device in the fourth embodiment of the present application;
[0019] Figure 5 This is a schematic diagram of the structure of the SQL instruction execution device in the fifth embodiment of the present application;
[0020] Figure 6 This is a schematic diagram of the structure of the distributed database system in Embodiment 6 of the present application;
[0021] Figure 7 This is a schematic diagram of the structure of an electronic device in Embodiment 7 of the present application;
[0022] Figure 8 This is the hardware structure of the electronic device in Example 8 of the present application. DETAILED DESCRIPTION
[0023] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only configured to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] Reference Figure 1A , showing a step flow chart of the method for executing SQL instructions of Example 1 of the present application.
[0026] Specifically, the SQL instruction execution method of this embodiment includes the following steps:
[0027] In step S101, the original binary tree structure of the logical join operator corresponding to the received first SQL instruction is converted to obtain a dense join operator corresponding to the first SQL instruction and a multi-branch tree structure of the dense join operator.
[0028] In an embodiment of the present application, the first SQL instruction may be an SQL instruction for instructing access to data in a distributed database, an SQL instruction for instructing querying a distributed relational database, an SQL instruction for instructing updating a distributed relational database, or an SQL instruction for instructing management of a distributed relational database, etc. The SQL (Structured Query Language) is a special-purpose programming language, a programming language for database queries, used for accessing data and querying, updating, and managing relational database systems. The logical connection operator may be understood as a connection operator for connecting two data tables. The binary tree structure may be understood as a tree structure in which each node has at most two subtrees. The dense connection operator may be understood as a connection operator for connecting multiple data tables. The multi-branch tree structure may be understood as a tree structure in which each node has at least two subtrees. It will be understood that the above description is merely exemplary, and the embodiments of the present application do not impose any limitation thereto.
[0029] In some optional embodiments, before converting the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction, the method further includes: parsing the first SQL instruction to obtain an abstract syntax tree corresponding to the first SQL instruction; converting the abstract syntax tree to obtain a relational algebraic tree corresponding to the first SQL instruction; and determining the original binary tree structure of the logical connection operator corresponding to the first SQL instruction based on the relational algebraic tree. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0030] In a specific example, the abstract syntax tree can be understood as an abstract representation of the syntax structure of the source code. It represents the syntax structure of the programming language in a tree form, and each node on the tree represents a structure in the source code. The relational algebra tree can be understood as a tree structure representing the relational algebra expression corresponding to the first SQL instruction. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0031] In some optional embodiments, when converting the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction, a bottom-up matching method is adopted to convert the logical connection operator in the original binary tree structure into the dense connection operator, so as to obtain the dense connection operator corresponding to the first SQL instruction and the multi-branch tree structure of the dense connection operator. Among them, the bottom-up matching method can be understood as gradually converting the logical connection operator into the dense connection operator from the bottom of the original binary tree structure of the logical connection operator corresponding to the first SQL instruction. It can be understood that the above description is only exemplary, and the embodiments of the present application do not impose any limitation on this.
[0032] In a specific example, Figure 1B As shown, the leftmost figure represents the original binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the circle marked with "J" represents the logical connection operator. The logical connection operator can be gradually converted into a dense connection operator from the bottom of the original binary tree structure upward, thereby obtaining a multi-branch tree structure of the dense connection operator corresponding to the first SQL instruction represented by the second figure on the left, wherein the circle marked with "J" in the second figure on the left represents the dense connection operator. It can be understood that the above description is only exemplary, and the embodiments of the present application do not impose any limitation on this.
[0033] In step S102, the data tables connected by the dense join operator are grouped to obtain a grouping result of the data tables.
[0034] In some optional embodiments, when grouping the data tables connected by the dense connection operator, conditional derivation is performed on the connection conditions of the dense connection operator to obtain derivation conditions for grouping the data tables connected by the dense connection operator; based on the derivation conditions, the data tables connected by the dense connection operator are grouped to obtain grouping results of the data tables. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0035] In a specific example, when conditional derivation is performed on the connection condition of the dense connection operator, equivalent derivation is performed on the equivalent conditions in the connection condition to obtain the derivation condition. For example, a=b and b=c, a=c can be deduced. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0036] In a specific example, when performing equivalent deduction on the equivalent conditions in the connection conditions, the operators of the equivalent conditions are used as edges, and the operands of the equivalent conditions are used as nodes to find the connected body corresponding to the equivalent conditions; the connection information of each node on each connected body is traversed to generate the connection conditions of each connected body; based on the connection conditions of all connected bodies, the derivation conditions are obtained. That is, the graph connectivity algorithm is applied to perform equivalent deduction on the equivalent conditions in the connection conditions to obtain the derivation conditions. It can be understood that the above description is only exemplary, and the embodiments of the present application do not impose any limitation on this.
[0037] In a specific example, when obtaining the derivation condition based on the connection conditions of all connected bodies, the connection conditions of all connected bodies are connected by the operator "and" to obtain the derivation condition. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0038] In some optional embodiments, when grouping the data tables connected by the dense join operator based on the derivation condition, the data tables are first grouped based on the logic library of the database to obtain a first grouping result of the data tables; the first grouping result is second grouped based on the splitting rule of the data tables to obtain a second grouping result of the data tables; the second grouping result is third grouped based on the split key equality condition in the derivation condition to obtain a third grouping result of the data tables. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0039] In a specific example, the logic library can be understood as a logic table of a database, such as a sub-table, a single table, or a broadcast table. The sub-table can be understood as a data table that is split by a splitting rule. The single table can be understood as a data table that is not split by a splitting rule and is stored in a main storage node of a distributed database. The broadcast table can be understood as a data table that is not split by a splitting rule and is distributed and stored in each storage node of a distributed database. The logical connection operator that connects data tables in different logic libraries cannot be pushed down to the nodes of a distributed database for execution. Therefore, it is necessary to first group the data tables connected by the dense connection operator according to the logic library. The splitting rule can be understood as the number and attributes of the splitting columns of the data table. The logical connection operator that connects data tables with the same splitting rule can be pushed down to the distributed database for execution. Therefore, it is necessary to further group the data tables grouped according to the logic library according to the splitting rule. Even if the splitting rules of the two data tables are consistent, it is also necessary to ensure that the splitting keys of the two data tables are in the equal value condition of the derivation condition. Therefore, it is finally necessary to further group the data tables grouped according to the splitting rule according to the splitting key equality condition to obtain the final grouping result of the data table. The split key can be understood as a split field of a data table. It can be understood that the above description is only exemplary and the present application embodiment does not impose any limitation on this.
[0040] In step S103, based on the grouping result, the multi-tree structure of the dense join operator corresponding to the first SQL instruction is converted to obtain a standard binary tree structure of the logical join operator corresponding to the first SQL instruction.
[0041] In the embodiment of the present application, the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node execution of the distributed database. The node can be understood as a server loaded with a MySQL database or any other database that can recognize or support the standard SQL language. Among them, the MySQL database is an open source relational database of Oracle Corporation and is currently one of the most popular databases. It can be understood that the above description is only exemplary and the embodiment of the present application does not make any limitation to this.
[0042] In some optional embodiments, when converting the multitree structure of the dense connection operator corresponding to the first SQL instruction based on the grouping result, based on the grouping result, the dense connection operator in the multitree structure is converted to obtain the logical connection operator in the standard binary tree structure; based on the logical connection operator in the standard binary tree structure, the derivation condition is allocated to obtain the connection condition of the logical connection operator in the standard binary tree structure; based on the logical connection operator in the standard binary tree structure and the connection condition of the logical connection operator in the standard binary tree structure, the standard binary tree structure is generated. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0043] In a specific example, when generating the standard binary tree structure based on the logical connection operator in the standard binary tree structure and the connection condition of the logical connection operator in the standard binary tree structure, the data tables in the group are connected with the structure of the left deep tree based on the connection condition of the logical connection operator in the standard binary tree structure, and the logical connection operators in the standard binary tree structure corresponding to all groups are connected with the structure of the left deep tree to generate the standard binary tree structure. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0044] In a specific example, Figure 1B As shown, the SQL instructions input by the user are parsed and converted into a binary tree structure composed of logical connection operators, which will be subsequently converted into a multi-branch tree structure of dense connection operators, and then converted back into a binary tree structure of logical connection operators after completing the conditional derivation and grouping of the data tables. Finally, data tables with the same logic library, the same splitting rules, and the same split key equality conditions will be grouped into the same group. Therefore, the logical connection operator connecting the data tables in the same group can be directly pushed down to the nodes of the distributed database for execution. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0045] Through the SQL instruction execution method provided by the embodiment of the present application, the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction is converted to obtain the dense connection operator and the multi-tree structure of the dense connection operator corresponding to the first SQL instruction, and the data tables connected by the dense connection operator are grouped to obtain the grouping results of the data tables. Based on the grouping results, the multi-tree structure of the dense connection operator corresponding to the first SQL instruction is converted to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node of the distributed database for execution. Compared with the existing scheme, by converting the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction into the standard binary tree structure for determining the logical connection operator that can be pushed down to the node of the distributed database for execution, the pushable logical connection operator corresponding to the received first SQL instruction can be pushed down to the node of the distributed database to the extreme, effectively reducing the search space of the execution plan corresponding to the first SQL instruction, thereby significantly improving the execution efficiency of the first SQL instruction.
[0046] In addition, by pushing down the push-down logical connection operator corresponding to the received first SQL instruction to the node of the distributed database for execution, the push-down logical connection operator can be executed as close as possible to the distributed storage node of the data table connected to the push-down logical connection operator, thereby saving the time of pulling the data table when executing the push-down logical connection operator, thereby effectively improving the execution performance of the push-down logical connection operator corresponding to the first SQL instruction.
[0047] The SQL instruction execution method of this embodiment can be executed by any appropriate device with data processing capabilities, including but not limited to: cameras, terminals, mobile terminals, PCs, servers, vehicle-mounted devices, entertainment equipment, advertising equipment, personal digital assistants (PDAs), tablet computers, laptop computers, handheld game consoles, smart glasses, smart watches, wearable devices, virtual display devices or display enhancement devices (such as Google Glass, Oculus Rift, Hololens, Gear VR), etc.
[0048] Reference Figure 2A , showing a step flow chart of the method for executing SQL instructions of Example 2 of the present application.
[0049] Specifically, the SQL instruction execution method of this embodiment includes the following steps:
[0050] In step S201, the original binary tree structure of the logical join operator corresponding to the received first SQL instruction is converted to obtain a dense join operator corresponding to the first SQL instruction and a multi-branch tree structure of the dense join operator.
[0051] Since step S201 is similar to the above step S101, it will not be described again here.
[0052] In step S202, the data tables connected by the dense join operator are grouped to obtain a grouping result of the data tables.
[0053] Since step S202 is similar to the above step S102, it will not be described again here.
[0054] In step S203, based on the grouping result, the multi-tree structure of the dense join operator corresponding to the first SQL instruction is converted to obtain a standard binary tree structure of the logical join operator corresponding to the first SQL instruction.
[0055] Since step S203 is similar to the above step S103, it will not be described again here.
[0056] In step S204, the logical connection operator that can be pushed down to the node execution of the distributed database is converted to obtain a second SQL instruction for instructing the node to execute an operation related to the first SQL instruction.
[0057] In an embodiment of the present application, the logical connection operator that can be pushed down to the node execution of the distributed database is converted through a DRDS (Distributed Relational Database Services) server in a distributed database system to obtain a second SQL instruction for instructing the node to execute the related operation of the first SQL instruction. Then, the DRDS server sends the second SQL instruction obtained by conversion to the node in the distributed database system, so that the node executes the related operation of the first SQL instruction. It can be understood that the above description is only exemplary and the embodiment of the present application does not impose any limitation on this.
[0058] In step S205, the execution result of the node for the second SQL instruction is received, and a logical connection operator that cannot be pushed down to the node of the distributed database is executed.
[0059] In an embodiment of the present application, the DRDS server receives the execution result returned by the node for the second SQL instruction. After receiving the execution result returned by the node for the second SQL instruction, the DRDS server executes the logical connection operator that cannot be pushed down to the node of the distributed database. Specifically, the DRDS server determines the search space of the execution plan corresponding to the logical connection operator that cannot be pushed down to the node of the distributed database, and determines the execution cost of each execution plan in the search space, and then determines the final execution plan corresponding to the logical connection operator that cannot be pushed down to the node of the distributed database based on the execution cost of each execution plan in the search space, and finally executes the logical connection operator that cannot be pushed down to the node of the distributed database based on the final execution plan. Among them, the execution plan can be understood as a plan of how to actually execute the logical connection operator that cannot be pushed down to the node of the distributed database, and the search space can be understood as a set of equivalent execution plans corresponding to the logical connection operator that cannot be pushed down to the node of the distributed database. It can be understood that the above description is only exemplary, and the embodiment of the present application does not impose any limitation on this.
[0060] In step S206, based on the execution result of the node for the second SQL instruction and the execution result of the logical connection operator executed by the node that cannot be pushed down to the distributed database, the execution result of the first SQL instruction is returned to the client.
[0061] In an embodiment of the present application, the DRDS server merges the execution result returned by the node for the second SQL instruction and the execution result of the logical connection operator executed by the node that cannot be pushed down to the distributed database to obtain the execution result for the first SQL instruction. After obtaining the execution result for the first SQL instruction, the DRDS server returns the execution result for the first SQL instruction to the client. It can be understood that the above description is only exemplary and the embodiment of the present application does not impose any limitation on this.
[0062] In a specific example, Figure 2BAs shown, the distributed database system includes a client, a DRDS server connected to the client, and various nodes connected to the DRDS server, for example, nodes MySQL1, MySQL2, etc. The execution process of the SQL instruction is as follows: the user sends a first SQL instruction to the DRDS server in the distributed database system through the client. After receiving the first SQL instruction sent by the client, the DRDS server parses and optimizes the first SQL instruction. Specifically, the original binary tree structure of the logical connection operator corresponding to the first SQL instruction is converted to obtain a dense connection operator and a multi-tree structure of the dense connection operator corresponding to the first SQL instruction, and the data tables connected by the dense connection operator are grouped to obtain the grouping result of the data table, and then based on the grouping result, the multi-tree structure of the dense connection operator corresponding to the first SQL instruction is converted to obtain a standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, and the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the Mysql node of the distributed database for execution. Then, the DRDS server converts the logical connection operator that can be pushed down to the Mysql node of the distributed database to obtain a second SQL instruction for instructing the Mysql node to execute the related operation of the first SQL instruction, and sends the converted second SQL instruction to the Mysql node in the distributed database system, so that the Mysql node executes the related operation of the first SQL instruction. Then, the DRDS server receives the execution result returned by the Mysql node for the second SQL instruction, and executes the logical connection operator that cannot be pushed down to the node of the distributed database. Finally, the DRDS server returns the execution result of the first SQL instruction to the client based on the execution result returned by the Mysql node for the second SQL instruction and the execution result of the logical connection operator that cannot be pushed down to the node of the distributed database. It can be understood that the above description is only exemplary and the embodiments of the present application do not impose any limitation on this.
[0063] On the basis of the first embodiment of the present application, the logical connection operator that can be pushed down to the node execution of the distributed database is converted to obtain a second SQL instruction for instructing the node to execute the related operation of the first SQL instruction, the node is received for the execution result of the second SQL instruction, and the logical connection operator that cannot be pushed down to the node execution of the distributed database is executed, and then based on the node's execution result for the second SQL instruction and the execution result of the logical connection operator that cannot be pushed down to the node execution of the distributed database, the execution result of the first SQL instruction is returned to the client. Compared with the existing solution, the node is received for the execution result of the second SQL instruction for instructing the node to execute the related operation of the first SQL instruction, and the logical connection operator that cannot be pushed down to the node execution of the distributed database is executed, and then based on the node's execution result for the second SQL instruction and the execution result of the logical connection operator that cannot be pushed down to the node execution of the distributed database, the execution result of the first SQL instruction is returned to the client. The execution result of the first SQL instruction can be returned to the client.
[0064] The SQL instruction execution method of this embodiment can be executed by any appropriate device with data processing capabilities, including but not limited to: cameras, terminals, mobile terminals, PCs, servers, vehicle-mounted devices, entertainment equipment, advertising equipment, personal digital assistants (PDAs), tablet computers, laptop computers, handheld game consoles, smart glasses, smart watches, wearable devices, virtual display devices or display enhancement devices (such as Google Glass, Oculus Rift, Hololens, Gear VR), etc.
[0065] Reference Figure 3 , showing a schematic diagram of the structure of the SQL instruction execution device in Example 3 of the present application.
[0066] The execution device of the SQL instruction of this embodiment includes: a first conversion module 301, which is used to convert the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction to obtain the dense connection operator corresponding to the first SQL instruction and the multi-branch tree structure of the dense connection operator; a grouping module 302, which is used to group the data tables connected by the dense connection operator to obtain the grouping result of the data table; a second conversion module 303, which is used to convert the multi-branch tree structure of the dense connection operator corresponding to the first SQL instruction based on the grouping result to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node of the distributed database for execution.
[0067] The SQL instruction execution device of this embodiment is used to implement the corresponding SQL instruction execution methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0068] Reference Figure 4 , showing a schematic diagram of the structure of the SQL instruction execution device in Example 4 of the present application.
[0069] The execution device of the SQL instruction of this embodiment includes: a first conversion module 404, which is used to convert the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction to obtain the dense connection operator corresponding to the first SQL instruction and the multi-tree structure of the dense connection operator; a grouping module 405, which is used to group the data tables connected by the dense connection operator to obtain the grouping result of the data table; a second conversion module 406, which is used to convert the multi-tree structure of the dense connection operator corresponding to the first SQL instruction based on the grouping result to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node of the distributed database for execution.
[0070] Optionally, the first conversion module 404 is specifically used to: adopt a bottom-up matching method to convert the logical connection operator in the original binary tree structure into the dense connection operator to obtain the dense connection operator corresponding to the first SQL instruction and the multi-branch tree structure of the dense connection operator.
[0071] Optionally, the device also includes: a parsing module 401, used to parse the first SQL instruction before the first conversion module converts the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction, so as to obtain an abstract syntax tree corresponding to the first SQL instruction; a third conversion module 402, used to convert the abstract syntax tree to obtain a relational algebraic tree corresponding to the first SQL instruction; and a determination module 403, used to determine the original binary tree structure of the logical connection operator corresponding to the first SQL instruction based on the relational algebraic tree.
[0072] Optionally, the device also includes: a fourth conversion module 407, used to convert the logical connection operator that can be pushed down to the node execution of the distributed database to obtain a second SQL instruction for instructing the node to execute related operations of the first SQL instruction; an execution module 408, used to receive the execution result of the node for the second SQL instruction, and execute the logical connection operator that cannot be pushed down to the node execution of the distributed database; a return module 409, used to return the execution result of the first SQL instruction to the client based on the execution result of the node for the second SQL instruction and the execution result of the logical connection operator that cannot be pushed down to the node execution of the distributed database.
[0073] The SQL instruction execution device of this embodiment is used to implement the corresponding SQL instruction execution methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0074] Reference Figure 5 , showing a schematic diagram of the structure of the execution device of the SQL instruction in the fifth embodiment of the present application.
[0075] The SQL instruction execution device of this embodiment includes: a first conversion module 501, which is used to convert the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction to obtain a dense connection operator corresponding to the first SQL instruction and a multi-branch tree structure of the dense connection operator; a grouping module 502, which is used to group the data tables connected by the dense connection operator to obtain the grouping result of the data table; a second conversion module 503, which is used to convert the multi-branch tree structure of the dense connection operator corresponding to the first SQL instruction based on the grouping result to obtain a standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node of the distributed database for execution.
[0076] Optionally, the grouping module 502 includes: a derivation module 5021, used to perform conditional derivation on the connection conditions of the dense connection operator to obtain derivation conditions for grouping the data tables connected by the dense connection operator; and a grouping submodule 5023, used to group the data tables connected by the dense connection operator based on the derivation conditions to obtain the grouping results of the data tables.
[0077] Optionally, the derivation module 5021 includes: a derivation submodule 5022, configured to perform equivalent derivation on equivalent conditions in the connection conditions to obtain the derivation conditions.
[0078] Optionally, the derivation submodule 5022 is specifically used to: use the operator of the equivalence condition as an edge and the operand of the equivalence condition as a node to find the connected body corresponding to the equivalence condition; traverse the connection information of each node on each connected body to generate the connection condition of each connected body; and obtain the derivation condition based on the connection conditions of all connected bodies.
[0079] Optionally, the grouping submodule 5023 is specifically used to: perform a first grouping on the data table based on the logic library of the database to obtain a first grouping result of the data table; perform a second grouping on the first grouping result based on the splitting rule of the data table to obtain a second grouping result of the data table; perform a third grouping on the second grouping result based on the split key equality condition in the derivation condition to obtain a third grouping result of the data table.
[0080] Optionally, the second conversion module 503 includes: a conversion submodule 5031, which is used to convert the dense connection operator in the multi-branch tree structure based on the grouping result to obtain the logical connection operator in the standard binary tree structure; an allocation module 5032, which is used to allocate the derivation conditions based on the logical connection operator in the standard binary tree structure to obtain the connection conditions of the logical connection operator in the standard binary tree structure; and a generation module 5033, which is used to generate the standard binary tree structure based on the logical connection operator in the standard binary tree structure and the connection conditions of the logical connection operator in the standard binary tree structure.
[0081] Optionally, the generation module 5033 is specifically used to: based on the connection conditions of the logical connection operators in the standard binary tree structure, connect the data tables in the group with the structure of a left-deep tree, and connect the logical connection operators in the standard binary tree structure corresponding to all groups with the structure of the left-deep tree to generate the standard binary tree structure.
[0082] The SQL instruction execution device of this embodiment is used to implement the corresponding SQL instruction execution methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0083] Reference Figure 6 , showing a schematic diagram of the structure of the distributed database system in Example 6 of the present application.
[0084] The distributed database system provided in this embodiment includes: a client, a server connected to the client, and a distributed database node connected to the server; the client is used to send a first SQL instruction to the server; the server is used to convert the original binary tree structure of the logical connection operator corresponding to the first SQL instruction received to obtain a dense connection operator corresponding to the first SQL instruction and a multi-tree structure of the dense connection operator; and group the data tables connected by the dense connection operator to obtain the grouping result of the data table; and then based on the grouping result, convert the multi-tree structure of the dense connection operator corresponding to the first SQL instruction to obtain a standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the distributed database node for execution.
[0085] In a specific example, the number of the distributed database nodes is multiple, and the server is connected to the multiple distributed database nodes. In addition, each distributed database node has a corresponding storage disk. The storage disk can store logical tables of the database, such as sub-tables, single tables, or broadcast tables, etc. Among them, the sub-tables can be understood as data tables split by splitting rules. The single table can be understood as a data table that is not split by the splitting rules and is stored in the storage disk of the distributed database master node. The broadcast table can be understood as a data table that is not split by the splitting rules and is distributed and stored on the storage disks of the distributed database nodes. It can be understood that the above description is only exemplary, and the embodiments of the present application do not impose any limitations on this.
[0086] The distributed database system of this embodiment is used to implement the execution methods of the corresponding SQL instructions in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0087] Figure 7 This is a schematic diagram of the structure of an electronic device in Embodiment 7 of the present application; the electronic device may include:
[0088] One or more processors 601;
[0089] The computer readable medium 602 may be configured to store one or more programs,
[0090] When the one or more programs are executed by the one or more processors, the one or more processors implement the SQL instruction execution method as described in the above-mentioned embodiment 1 or embodiment 2.
[0091] Figure 8 The hardware structure of the electronic device in the eighth embodiment of the present application; Figure 8As shown, the hardware structure of the electronic device may include: a processor 701, a communication interface 702, a computer readable medium 703 and a communication bus 704;
[0092] The processor 701, the communication interface 702, and the computer readable medium 703 communicate with each other via a communication bus 704;
[0093] Optionally, the communication interface 702 may be an interface of a communication module, such as an interface of a GSM module;
[0094] Among them, the processor 701 can be specifically configured to: convert the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction to obtain the dense connection operator corresponding to the first SQL instruction and the multi-tree structure of the dense connection operator; group the data table connected by the dense connection operator to obtain the grouping result of the data table; based on the grouping result, convert the multi-tree structure of the dense connection operator corresponding to the first SQL instruction to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node execution of the distributed database.
[0095] The processor 701 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0096] The computer readable medium 703 can be, but is not limited to, a random access memory medium (RAM), a read-only memory medium (ROM), a programmable read-only memory medium (PROM), an erasable programmable read-only memory medium (EPROM), an electrically erasable read-only memory medium (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0097] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code configured to execute the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the above functions defined in the method of the present application are executed. It should be noted that the computer-readable medium described in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access storage medium (RAM), a read-only storage medium (ROM), an erasable programmable read-only storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage medium (CD-ROM), an optical storage medium, a magnetic storage medium, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus or a device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program configured to be used by or in combination with an instruction execution system, an apparatus or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0098] Computer program code configured to perform the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through 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., via the Internet using an Internet service provider).
[0099] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of the code contains one or more executable instructions configured to implement the specified logical function. There are specific sequential relationships in the above-mentioned specific embodiments, but these sequential relationships are only exemplary. When the specific implementation is implemented, these steps may be less, more, or the execution order may be adjusted. That is, in some implementations as replacements, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0100] The modules involved in the embodiments of the present application may be implemented by software or hardware. The modules described may also be set in a processor, for example, they may be described as: a processor includes a first conversion module, a grouping module, and a second conversion module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the first conversion module may also be described as "a module for converting the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction to obtain a dense connection operator corresponding to the first SQL instruction and a multi-branch tree structure of the dense connection operator".
[0101] As another aspect, the present application further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method for executing the SQL instruction described in the first or second embodiment above is implemented.
[0102] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the device: converts the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction to obtain the dense connection operator corresponding to the first SQL instruction and the multi-tree structure of the dense connection operator; groups the data tables connected by the dense connection operator to obtain the grouping result of the data table; based on the grouping result, converts the multi-tree structure of the dense connection operator corresponding to the first SQL instruction to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node execution of the distributed database.
[0103] The expressions "first", "second", "the first" or "the second" used in various embodiments of the present disclosure may modify various components regardless of order and / or importance, but these expressions do not limit the corresponding components. The above expressions are only configured for the purpose of distinguishing an element from other elements. For example, a first user device and a second user device represent different user devices, although both are user devices. For example, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element without departing from the scope of the present disclosure.
[0104] When one element (e.g., a first element) is referred to as being "(operably or communicatively) coupled" or "(operably or communicatively) coupled to" or "connected to" another element (e.g., a second element), it is understood that the one element is directly connected to the other element or the one element is indirectly connected to the other element via yet another element (e.g., a third element). Conversely, it is understood that when an element (e.g., a first element) is referred to as being "directly connected" or "directly coupled" to another element (the second element), no element (e.g., a third element) is interposed between the two.
[0105] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.
Claims
1. A method for executing a SQL instruction, characterized in that: The method comprises: Converting an original binary tree structure of a logical join operator corresponding to a received first SQL instruction to obtain a dense join operator corresponding to the first SQL instruction and a multi-tree structure of the dense join operator; Grouping the data tables connected by the dense join operator to obtain a grouping result of the data table; Based on the grouping result, the multi-tree structure of the dense join operator corresponding to the first SQL instruction is converted to obtain a standard binary tree structure of the logical join operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical join operator that can be pushed down to the node execution of the distributed database.
2. The method according to claim 1, characterized in that The converting the original binary tree structure of the logical join operator corresponding to the received first SQL instruction to obtain the dense join operator corresponding to the first SQL instruction and the multi-tree structure of the dense join operator includes: The logical connection operator in the original binary tree structure is converted into the dense connection operator by using a bottom-up matching method, so as to obtain the dense connection operator corresponding to the first SQL instruction and the multi-branch tree structure of the dense connection operator.
3. The method according to claim 1, characterized in that: Before converting the original binary tree structure of the logical connection operator corresponding to the received first SQL instruction, the method further includes: Parsing the first SQL instruction to obtain an abstract syntax tree corresponding to the first SQL instruction; Converting the abstract syntax tree to obtain a relational algebraic tree corresponding to the first SQL instruction; Based on the relational algebraic tree, the original binary tree structure of the logical join operator corresponding to the first SQL instruction is determined.
4. The method according to claim 1, characterized in that: The grouping of the data tables connected by the dense join operator to obtain the grouping result of the data tables includes: Conditionally deriving the connection conditions of the dense connection operator to obtain a derivation condition for grouping the data tables connected by the dense connection operator; Based on the derivation condition, the data tables connected by the dense connection operator are grouped to obtain a grouping result of the data tables.
5. The method according to claim 4, characterized in that The conditional derivation of the connection condition of the dense connection operator to obtain the derivation condition for grouping the data tables connected by the dense connection operator includes: Equivalent deduction is performed on the equivalent conditions in the connection conditions to obtain the derivation conditions.
6. The method according to claim 5, characterized in that The equivalent derivation of the equivalent conditions in the connection conditions to obtain the derivation conditions includes: Taking the operators of the equivalence condition as edges and the operands of the equivalence condition as nodes, finding the connected body corresponding to the equivalence condition; Traversing the connection information of each node on each connected body to generate a connection condition of each connected body; Based on the connection conditions of all connected bodies, the derivation conditions are obtained.
7. The method according to claim 4, characterized in that The step of grouping the data tables connected by the dense connection operator based on the derivation condition to obtain the grouping result of the data tables includes: Based on the logic library of the database, performing a first grouping on the data table to obtain a first grouping result of the data table; Based on the splitting rule of the data table, performing a second grouping on the first grouping result to obtain a second grouping result of the data table; Based on the split key equality condition in the derivation condition, a third grouping is performed on the second grouping result to obtain a third grouping result of the data table.
8. The method according to claim 4, characterized in that The converting, based on the grouping result, the multitree structure of the dense join operator corresponding to the first SQL instruction to obtain a standard binary tree structure of the logical join operator corresponding to the first SQL instruction includes: Based on the grouping result, converting the dense connection operator in the multi-tree structure to obtain a logical connection operator in the standard binary tree structure; Based on the logical connection operator in the standard binary tree structure, the derivation condition is distributed to obtain the connection condition of the logical connection operator in the standard binary tree structure; The standard binary tree structure is generated based on the logical connection operators in the standard binary tree structure and the connection conditions of the logical connection operators in the standard binary tree structure.
9. The method according to claim 8, characterized in that The generating the standard binary tree structure based on the logical connection operator in the standard binary tree structure and the connection condition of the logical connection operator in the standard binary tree structure comprises: Based on the connection conditions of the logical connection operators in the standard binary tree structure, the data tables in the group are connected with the structure of the left-deep tree, and the logical connection operators in the standard binary tree structure corresponding to all groups are connected with the structure of the left-deep tree to generate the standard binary tree structure.
10. The method according to claim 1, characterized in that The method further comprises: Converting the logical connection operator that can be pushed down to the node execution of the distributed database to obtain a second SQL instruction for instructing the node to execute an operation related to the first SQL instruction; receiving the execution result of the node for the second SQL instruction, and executing a logical connection operator that cannot be pushed down to the node execution of the distributed database; Based on the execution result of the node for the second SQL instruction and the execution result of the logical connection operator executed by the node that cannot be pushed down to the distributed database, the execution result of the first SQL instruction is returned to the client.
11. A device for executing SQL instructions, characterized in that: The device comprises: A first conversion module, configured to convert an original binary tree structure of a logical join operator corresponding to a received first SQL instruction to obtain a dense join operator corresponding to the first SQL instruction and a multi-branch tree structure of the dense join operator; A grouping module, used for grouping the data tables connected by the dense connection operator to obtain a grouping result of the data table; A second conversion module is used to convert the multi-tree structure of the dense connection operator corresponding to the first SQL instruction based on the grouping result to obtain a standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the node execution of the distributed database.
12. The device according to claim 11, characterized in that The first conversion module is specifically used to: The logical connection operator in the original binary tree structure is converted into the dense connection operator by using a bottom-up matching method, so as to obtain the dense connection operator corresponding to the first SQL instruction and the multi-branch tree structure of the dense connection operator.
13. The device according to claim 12, characterized in that The device also includes: a parsing module, configured to parse the first SQL instruction to obtain an abstract syntax tree corresponding to the first SQL instruction before the first conversion module converts the original binary tree structure of the logical join operator corresponding to the received first SQL instruction; A third conversion module, used to convert the abstract syntax tree to obtain a relational algebraic tree corresponding to the first SQL instruction; A determination module is used to determine the original binary tree structure of the logical connection operator corresponding to the first SQL instruction based on the relational algebraic tree.
14. The device according to claim 11, characterized in that The grouping module comprises: A derivation module, used for conditionally derivation of connection conditions of the dense connection operator to obtain a derivation condition for grouping data tables connected by the dense connection operator; The grouping submodule is used to group the data tables connected by the dense connection operator based on the derivation condition to obtain the grouping result of the data table.
15. The device according to claim 14, characterized in that The derivation module comprises: The derivation submodule is used to perform equivalent derivation on the equivalent conditions in the connection conditions to obtain the derivation conditions.
16. The device according to claim 15, characterized in that The derivation submodule is specifically used for: Taking the operators of the equivalence condition as edges and the operands of the equivalence condition as nodes, finding the connected body corresponding to the equivalence condition; Traversing the connection information of each node on each connected body to generate a connection condition of each connected body; Based on the connection conditions of all connected bodies, the derivation conditions are obtained.
17. The device according to claim 14, characterized in that The grouping submodule is specifically used for: Based on the logic library of the database, performing a first grouping on the data table to obtain a first grouping result of the data table; Based on the splitting rule of the data table, performing a second grouping on the first grouping result to obtain a second grouping result of the data table; Based on the split key equality condition in the derivation condition, a third grouping is performed on the second grouping result to obtain a third grouping result of the data table.
18. The device according to claim 14, characterized in that The second conversion module includes: A conversion submodule, configured to convert the dense connection operator in the multi-branch tree structure based on the grouping result to obtain a logical connection operator in the standard binary tree structure; An allocation module, configured to allocate the derivation conditions based on the logical connection operators in the standard binary tree structure to obtain connection conditions of the logical connection operators in the standard binary tree structure; A generation module is used to generate the standard binary tree structure based on the logical connection operator in the standard binary tree structure and the connection condition of the logical connection operator in the standard binary tree structure.
19. The device according to claim 18, characterized in that The generation module is specifically used for: Based on the connection conditions of the logical connection operators in the standard binary tree structure, the data tables in the group are connected with the structure of the left-deep tree, and the logical connection operators in the standard binary tree structure corresponding to all groups are connected with the structure of the left-deep tree to generate the standard binary tree structure.
20. The device according to claim 11, characterized in that The device also includes: a fourth conversion module, configured to convert the logical connection operator that can be pushed down to the node execution of the distributed database to obtain a second SQL instruction for instructing the node to execute an operation related to the first SQL instruction; An execution module, used for receiving the execution result of the node for the second SQL instruction, and executing a logical connection operator that cannot be pushed down to the node execution of the distributed database; A return module is used to return the execution result of the first SQL instruction to the client based on the execution result of the node for the second SQL instruction and the execution result of the logical connection operator executed by the node that cannot be pushed down to the distributed database.
21. A distributed database system, characterized in that: The system comprises: A client, a server connected to the client, and a distributed database node connected to the server; The client is used to send a first SQL instruction to the server; The server is used to convert the original binary tree structure of the logical connection operator corresponding to the first SQL instruction received to obtain the dense connection operator corresponding to the first SQL instruction and the multi-tree structure of the dense connection operator; and group the data tables connected by the dense connection operator to obtain the grouping results of the data tables; and then based on the grouping results, convert the multi-tree structure of the dense connection operator corresponding to the first SQL instruction to obtain the standard binary tree structure of the logical connection operator corresponding to the first SQL instruction, wherein the standard binary tree structure is used to determine the logical connection operator that can be pushed down to the distributed database node for execution.
22. An electronic device, comprising: one or more processors; A computer readable medium configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method for executing the SQL instruction according to any one of claims 1 to 10.
23. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for executing the SQL instruction according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Methods and devices for binary tree construction, compression and lookup
CN102405622A
Analysis method and device of interpreted language and computer system
CN106775935A