Optimized SQL code generation
First Claim
1. A method for generating machine executable code for implementing a query of a database, the database having tables and records of data, comprising the steps of:
- receiving a subject query;
forming an execution plan corresponding to the subject query, the execution plan having a sequence of pieces and corresponding processes for implementing the pieces; and
for each piece of the plan, (a) generating source code using different code generation techniques as a function of any combination of data characteristics, current conditions and workload, and (b) compiling the generated source code to form machine executable code for implementing the subject query, said compiling being in a manner that optimizes total query processing time, including, compilation time and execution time.
8 Assignments
0 Petitions
Accused Products
Abstract
This invention relates generally to a system for processing database queries, and more particularly to a method for generating high level language or machine code to implement query execution plans. The present invention provides a method for generating executable machine code for query execution plans, that is adaptive to dynamic runtime conditions, that is compiled just in time for execution and most importantly, that avoids the bounds checking, pointer indirection, materialization and other similar kinds of overhead that are typical in interpretive runtime execution engines.
89 Citations
24 Claims
-
1. A method for generating machine executable code for implementing a query of a database, the database having tables and records of data, comprising the steps of:
-
receiving a subject query;
forming an execution plan corresponding to the subject query, the execution plan having a sequence of pieces and corresponding processes for implementing the pieces; and
for each piece of the plan, (a) generating source code using different code generation techniques as a function of any combination of data characteristics, current conditions and workload, and (b) compiling the generated source code to form machine executable code for implementing the subject query, said compiling being in a manner that optimizes total query processing time, including, compilation time and execution time. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
-
-
16. A method for generating machine executable code for implementing a query of a database, the database having tables and records of data, comprising the steps of:
-
receiving a subject query;
forming an execution plan corresponding to the subject query, the execution plan having a sequence of pieces and corresponding processing nodes for implementing the pieces;
generating high level language source code for each piece of the plan including (a) minimally defining relevant structures and classes, and (b) forming therefrom optimized Include statements in the source code; and
compiling the generated source code to form machine executable code for implementing the subject query, the formed optimized Include statements in the source code enabling relatively reduced compilation time. - View Dependent Claims (17, 18, 19)
-
-
20. A method for generating machine executable code for implementing a query of a database, the database having tables and records of data, comprising the steps of:
-
receiving a subject query;
forming an execution plan corresponding to the subject query, the execution plan having a sequence of pieces and corresponding processing nodes for implementing the pieces;
for each piece of the plan, generating high level language source code including adjusting variables in the source code to have widths equivalent to widths of respective actual data values existing in the database, such that optimized compilation is enabled; and
compiling the generated source code to form machine executable code for implementing the subject query, said compiling being done in optimal compile time. - View Dependent Claims (21, 22, 24)
-
-
23. A method for generating machine executable code for implementing a query of a database, the database having tables and records of data, comprising the steps of:
-
receiving a subject query;
forming an execution plan corresponding to the subject query, the execution plan having a sequence of pieces and corresponding processing nodes for implementing the pieces;
for each piece of the plan, generating high level language source code;
optimizing the source code for compilation, said optimizing being a function of expected query execution time; and
compiling the source code to form machine executable code for implementing the subject query.
-
Specification