Method and apparatus for efficiently executing built-in functions
First Claim
1. A method of efficiently executing a query in a database system, the query having been parsed to obtain a related set of functions, the method comprising the steps of:
- defining a set of function modules, wherein each function module is defined to process a single class of data types, thereby limiting a number of functions to be recognized by each function module; and
assigning each function in the set of functions a key, the key representing the class of data types to which each function belongs.
1 Assignment
0 Petitions
Accused Products
Abstract
A method, apparatus and article of manufacture for computer implemented method of efficiently executing built-in functions is defined. Function modules are defined to process a single data type class and to process as many functions as possible before returning to the caller. Functions related to a query are each assigned a key, a type of code, to indicate the data type class to which the function belongs. The functions are then ordered so that a particular module scope can be held as long as possible. Further, data fields, another type of code containing optimization information, can be added to the functions to further enable the holding of module scope. Finally, the functions are executed at runtime. During execution, the database system looks ahead at upcoming functions in an attempt anticipate the next course of action by examining the keys and data fields. Various additional optimization techniques can then be used to enhance runtime performance.
112 Citations
30 Claims
-
1. A method of efficiently executing a query in a database system, the query having been parsed to obtain a related set of functions, the method comprising the steps of:
-
defining a set of function modules, wherein each function module is defined to process a single class of data types, thereby limiting a number of functions to be recognized by each function module; and
assigning each function in the set of functions a key, the key representing the class of data types to which each function belongs. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
rearranging an order in which each function in the set of functions is executed to increase locality, thereby optimizing runtime performance.
-
-
3. The method according to claim 1, further comprising the step of:
executing each function in a presently called module, while examining the key of a subsequent function from the set of functions to determine a next course of action.
-
4. The method according to claim 1, wherein in said defining step, each of the function modules is further defined to process simple operations associated with the class of functions, thereby merging the simple operations with the associated class of functions into a single unit.
-
5. The method according to claim 3, wherein in the executing step, when the key indicates that the subsequent function is to be executed in the presently called module, the subsequent function is executed prior to issuing a return, thereby further optimizing runtime performance.
-
6. The method according to claim 5, further comprising the step of:
prior to the executing step, assigning a code to each function, the code indicating whether execution of the subsequent function requires a call forward to a subsequent module or a fall back to a previous module.
-
7. The method according to claim 6, wherein the executing step further comprises examining the code and, wherein when the key indicates that the subsequent function is not to be executed in the presently called module, and the code indicates that execution of the subsequent function requires a call forward to the subsequent module, the subsequent module is called and the subsequent function is executed prior to issuing a return.
-
8. The method according to claim 7, wherein in the executing step, when the key indicates that the subsequent function is not to be executed in the presently called module, and the code indicates that execution of the subsequent function requires a fall back to the previous module, the previous module is returned to and the subsequent function is executed prior to issuing a return.
-
9. The method according to claim 3, further comprising the step of:
-
prior to the executing step, sorting each function and assigning each function a code indicating whether execution of each function requires a call forward to a subsequent module, fall back to a previous module or loop to the presently called module;
wherein the executing step further comprises examining the code of the subsequent function and executing one of the call forward, fall back and loop based on the code, to execute the subsequent function.
-
-
10. The method according to claim 2, wherein in the rearranging step, the locality is increased by ordering together each function having the same key, while honoring dependencies between the functions.
-
11. An apparatus for efficiently executing a query in a database system, the query having been parsed to obtain a related set of functions, the apparatus comprising:
-
a computer having a data storage device connected thereto, wherein the data storage device stored the database system; and
one or more computer programs performed by the computer for;
defining a set of function modules, wherein each function module is defined to process a single class of data types, thereby limiting a number of functions to be recognized by each function module; and
assigning each function in the set of functions a key, the key representing the class of data types to which each function belongs. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
further wherein during executing, the one or more computer programs performed by the computer examines the code of the subsequent function and executes one of the call forward, fall back and loop based on the code, to execute the subsequent function.
-
-
20. The apparatus according to claim 12, wherein the one or more computer programs performed by the computer further increases the locality, during rearranging, by ordering together each function having the same key, while honoring dependencies between the functions.
-
21. An article of manufacture comprising a program storage device readable by a computer and tangibly embodying one or more programs of instructions executable by the computer to perform method steps for efficiently executing a query in a database system, the query having been parsed to obtain a related set of functions, the computer having a data storage device coupled thereto for storing the database system, the method comprising the steps of:
-
defining a set of function modules, wherein each function module is defined to process a single class of data types, thereby limiting a number of functions to be recognized by each function module; and
assigning each function in the set of functions a key, the key representing the class of data types to which each function belongs. - View Dependent Claims (22, 23, 24, 25, 26, 27, 28, 29, 30)
rearranging an order in which each function in the set of functions is executed to increase locality, thereby optimizing runtime performance.
-
-
23. The article of manufacture according to claim 21, further comprising the step of:
executing each function in a presently called module, while examining the key of a subsequent function from the set of functions to determine a next course of action.
-
24. The article of manufacture according to claim 21, wherein in said defining step, each of the function modules is further defined to process simple operations associated with the class of functions, thereby merging the simple operations with the associated class of functions into a single unit.
-
25. The article of manufacture according to claim 23, wherein in the executing step, when the key indicates that the subsequent function is to be executed in the presently called module, the subsequent function is executed prior to issuing a return, thereby further optimizing runtime performance.
-
26. The article of manufacture according to claim 25, further comprising the step of:
prior to the executing step, assigning a code to each function, the code indicating whether execution of the subsequent function requires a call forward to a subsequent module or a fall back to a previous module.
-
27. The article of manufacture according to claim 26, wherein the executing step further comprises examining the code and, wherein when the key indicates that the subsequent function is not to be executed in the presently called module, and the code indicates that execution of the subsequent function requires a call forward to the subsequent module, the subsequent module is called and the subsequent function is executed prior to issuing a return.
-
28. The article of manufacture according to claim 27, wherein in the executing step, when the key indicates that the subsequent function is not to be executed in the presently called module, and the code indicates that execution of the subsequent function requires a fall back to the previous module, the previous module is returned to and the subsequent function is executed prior to issuing a return.
-
29. The article of manufacture according to claim 23, further comprising the step of:
-
prior to the executing step, sorting each function and assigning each function a code indicating whether execution of each function requires a call forward to a subsequent module, fall back to a previous module or loop to the presently called module;
wherein the executing step further comprises examining the code of the subsequent function and executing one of the call forward, fall back and loop based on the code, to execute the subsequent function.
-
-
30. The article of manufacture according to claim 22, wherein in the rearranging step, the locality is increased by ordering together each function having the same key, while honoring dependencies between the functions.
Specification