System and method for efficient evaluation of a query that invokes a table valued function
First Claim
Patent Images
1. A method for processing a query that invokes a table valued function to provide results, the method comprising:
- encoding by a computer processor at least one implicit argument in the table valued function, each of the at least one implicit argument passing instructions to execute at least one relational operation normally executed separately from the table valued function in the table valued function, wherein each relational operation is a filtering operation, a grouping operation or a projection operation, and a separate runtime implementation is generated for each relational operation;
receiving a user defined class definition to instantiate a managed execution environment object;
compiling the user defined class definition into binary code;
storing the binary code at a database server;
upon a request, querying the binary code to determine metadata regarding the user defined class, wherein the binary code may be interpreted by the database server based upon the managed execution environment object;
receiving the query that invokes the table valued function;
responsive to receiving the query, generating by a computer processor an information class that describes capabilities of the table valued function;
querying by a computer processor the information class with a set of at least one binding questions regarding information about the table valued function comprising a number of columns that will be returned during query execution, types of columns, and/or names of the columns;
querying by a computer processor the information class with a set of at least one optimization questions regarding information about the table valued function comprising whether rows are grouped on any set of columns, whether any columns make up a unique key, whether the table value function is deterministic or accesses external data sources and/or statistical information;
executing by a computer processor the query in accordance with information provided in response to the set of binding questions and the set of optimization questions, wherein executing the query comprises;
generating an execution class corresponding to the table valued function;
requesting a set of data table rows as output from the execution class; and
receiving the requested rows from the execution class.
2 Assignments
0 Petitions
Accused Products
Abstract
The present invention describes an efficient and fast framework for implementing table-valued functions (TVF'"'"'s) in a relational database server. The framework provides desirable extensibility properties and has the ability to minimize performance degradations by integrating tightly with the optimization infrastructure in a query processor. The present invention also enables a managed execution environment (MEE) such as the Common-Language-Runtime (CLR), to efficiently and dynamically extend the logic of the database engine with user-supplied code.
-
Citations
27 Claims
-
1. A method for processing a query that invokes a table valued function to provide results, the method comprising:
-
encoding by a computer processor at least one implicit argument in the table valued function, each of the at least one implicit argument passing instructions to execute at least one relational operation normally executed separately from the table valued function in the table valued function, wherein each relational operation is a filtering operation, a grouping operation or a projection operation, and a separate runtime implementation is generated for each relational operation; receiving a user defined class definition to instantiate a managed execution environment object; compiling the user defined class definition into binary code; storing the binary code at a database server; upon a request, querying the binary code to determine metadata regarding the user defined class, wherein the binary code may be interpreted by the database server based upon the managed execution environment object; receiving the query that invokes the table valued function; responsive to receiving the query, generating by a computer processor an information class that describes capabilities of the table valued function; querying by a computer processor the information class with a set of at least one binding questions regarding information about the table valued function comprising a number of columns that will be returned during query execution, types of columns, and/or names of the columns; querying by a computer processor the information class with a set of at least one optimization questions regarding information about the table valued function comprising whether rows are grouped on any set of columns, whether any columns make up a unique key, whether the table value function is deterministic or accesses external data sources and/or statistical information; executing by a computer processor the query in accordance with information provided in response to the set of binding questions and the set of optimization questions, wherein executing the query comprises; generating an execution class corresponding to the table valued function; requesting a set of data table rows as output from the execution class; and receiving the requested rows from the execution class. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A computer readable storage medium for processing a query that invokes a table valued function to provide results, the computer readable storage medium having stored thereon instructions executed by a computer that cause the computer to perform a process comprising:
-
encoding at least one implicit argument in the table valued function, each of the at least one implicit argument passing instructions to execute at least one relational operation normally executed separately from the table valued function in the table valued function, wherein each relational operation is a filtering operation, a grouping operation or a projection operation, and a separate runtime implementation is generated for each relational operation; receiving a user defined class definition to instantiate a managed execution environment object; compiling the user defined class definition into binary code; storing the binary code at a database server; upon a request, querying the binary code to determine metadata regarding the user defined class, wherein the binary code may be interpreted by the database server based upon the managed execution environment object; receiving the query that invokes the table valued function; responsive to receiving the query, generating an information class that describes capabilities of the table valued function; querying the information class with a set of at least one binding questions regarding information about the table valued function comprising a number of columns that will be returned during query execution, types of columns, and/or names of the columns; querying the information class with a set of at least one optimization questions regarding information about the table valued function comprising whether rows are grouped on any set of columns, whether any columns make up a unique key, whether the table valued function is deterministic or accesses external data sources and/or statistical information; executing the query in accordance with information provided in response to the set of binding questions and the set of optimization questions, wherein executing the query comprises; generating an execution class corresponding to the table valued function; requesting a set of data table rows as output from the execution class; and receiving the requested rows from the execution class. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17, 18)
-
-
19. A system for processing a query that invokes a table valued function to provide results comprising:
-
a processor; a memory having stored thereon instructions executed by the processor that cause the processor to perform a process comprising; encoding at least one implicit argument in the table valued function, each of the at least one implicit argument passing instructions to execute at least one relational operation normally executed separately from the table valued function in the table valued function, wherein each relational operation is a filtering operation, a grouping operation or a projection operation, and a separate runtime implementation is generated for each relational operation; receiving a user defined class definition to instantiate a managed execution environment object; compiling the user defined class definition into binary code; storing the binary code at a database server; upon a request, querying the binary code to determine metadata regarding the user defined class, wherein the binary code may be interpreted by the database server based upon the managed execution environment object; receiving the query that invokes the table valued function; responsive to receiving the query, generating an information class that describes capabilities of the table valued function; querying the information class with a set of at least one binding questions regarding information about the table valued function comprising a number of columns that will be returned during query execution, types of columns, and/or names of the columns; querying the information class with a set of at least one optimization questions regarding information about the table valued function comprising whether rows are grouped on any set of columns, whether any columns make up a unique key, whether the table valued function is deterministic or accesses external data sources and/or statistical information; executing the query in accordance with information provided in response to the set of binding questions and the set of optimization questions, wherein executing the query comprises; generating an execution class corresponding to the table valued function; requesting a set of data table rows as output from the execution class; and receiving the requested rows from the execution class. - View Dependent Claims (20, 21, 22, 23, 24, 25, 26, 27)
-
Specification