Method and apparatus for parallel execution of SQL from stored procedures
First Claim
1. A method of parallel execution of SQL in a stored procedure comprising:
- executing a stored procedure on a first data server;
determining when a nested SQL command is encountered in the stored procedure;
transmitting at least a portion of the nested SQL command from the first data server to a query coordinator;
the query coordinator generating an execution plan that provides for parallel execution of the portion of the nested SQL command;
transmitting at least a portion of the execution plan from the query coordinator to a plurality of dispatcher instances on a plurality of data servers;
the plurality of dispatchers executing the transmitted portions of the execution plan on the plurality of data servers;
the plurality of dispatchers transmitting results from the executed portions of the execution plan to an input stream at an endpoint on the first data server; and
the stored procedure obtaining the results at the endpoint from the input stream.
2 Assignments
0 Petitions
Accused Products
Abstract
A method, apparatus, and an article of manufacture for parallel execution of SQL operations from stored procedures. One or more embodiments of the invention provide the stored procedure (stored procedure) with a C++ class (hereinafter referred to as “dispatcher”) that can take an SQL query and start parallel execution of the query. The query is optimized and parallelized. The dispatcher executes the query, sets up the communication links between the various operators in the query, and ensures that all the results are sent back to the data-server that originated the query request. Further, the dispatcher merges the results of the parallel execution and produces a single stream of tuples that is fed to the calling stored procedure. To provide the single stream to the calling stored procedure, one or more embodiments of the invention utilize a class that provides the stored procedure with a simple and easy-to-use interface to access the results of the nested SQL execution.
-
Citations
15 Claims
-
1. A method of parallel execution of SQL in a stored procedure comprising:
-
executing a stored procedure on a first data server;
determining when a nested SQL command is encountered in the stored procedure;
transmitting at least a portion of the nested SQL command from the first data server to a query coordinator;
the query coordinator generating an execution plan that provides for parallel execution of the portion of the nested SQL command;
transmitting at least a portion of the execution plan from the query coordinator to a plurality of dispatcher instances on a plurality of data servers;
the plurality of dispatchers executing the transmitted portions of the execution plan on the plurality of data servers;
the plurality of dispatchers transmitting results from the executed portions of the execution plan to an input stream at an endpoint on the first data server; and
the stored procedure obtaining the results at the endpoint from the input stream. - View Dependent Claims (2, 3, 4, 5)
one or more of said plurality of dispatchers merging results of the execution;
specifying the endpoint to retrieve the merged results; and
providing the stored procedure with a mechanism for retrieving the results in the input stream from the endpoint.
-
-
4. The method of claim 3 wherein the input stream comprises one or more tuples.
-
5. The method of claim 1 wherein said generating further comprises:
-
a query optimizer generating an ASCII plan; and
a parallelizer generating a parallel execution plan.
-
-
6. A system for parallel execution of SQL in a stored procedure comprising:
-
(a) a stored procedure comprised of one or more nested SQL commands;
(b) a first data server configured to;
(i) execute the stored procedure;
(ii) determine when a nested SQL command is encountered in the stored procedure;
(iii) transmit at least a portion of the nested SQL command from the first data server to a query coordinator;
(c) a plurality of dispatchers on a plurality of data servers configured to;
(i) receive portions of an execution plan;
(ii) execute the received portions of the execution plan on the plurality of the data servers;
(iii) transmit results from the executed portions of the execution plan to an input stream at an endpoint on the first data server, wherein the stored procedure is further configured to obtain the results at the endpoint from the input stream;
(d) the query coordinator configured to;
(i) receive the at least a portion of the nested SQL command;
(ii) generate the execution plan that provides for parallel execution of the portion of the nested SQL command; and
(iii) transmitting at least a portion of the execution plan to a plurally of the dispatchers on a plurality of the data servers. - View Dependent Claims (7, 8, 9, 10)
a query optimizer in the query coordinator, the query optimizer configured to generate an ASCII plan from the portion of nested SQL command; and
parallelizer in the query coordinator, the parallelizer configured to generate a parallel execution plan from said ASCII plan.
-
-
11. An article of manufacture for parallel execution of SQL in a stored procedure comprising:
-
means for executing a stored procedure on a first data server;
means for determining when a nested SQL command is encountered in the stored procedure;
means for transmitting at least a portion of the nested SQL command from the first data server to a query coordinator;
means for the query coordinator to generate an execution plan that provides for parallel execution of the portion of the nested SQL command;
means for transmitting at least a portion of the execution plan from the query coordinator to a plurality of dispatcher instances on a plurality of data servers;
means for the plurality of dispatchers to execute the transmitted portions of the execution plan on the plurality of data servers;
means for the plurality of dispatchers transmitting results from the executed portions of the execution plan to an input stream at an endpoint on the first data server; and
means for the stored procedure to obtain the results at the endpoint from the input stream. - View Dependent Claims (12, 13, 14, 15)
means for one or mote of said plurality of dispatchers to merge results of the execution;
means for specifying the endpoint to retrieve the merged results; and
means for providing the stored procedure with a mechanism for retrieving the results in the input stream from the endpoint.
-
-
14. The article of manufacture of claim 13 wherein the input stream comprises one or more tuples.
-
15. The article of manufacture of claim 11 wherein said means for generating further comprises:
-
means for a query optimizer to generate an ASCII plan; and
means for a parallelizer to generate a parallel execution plan.
-
Specification