Patent ID: 7433863

Claim:
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 at least one piece of the plan, (a) generating source code using different code generation techniques as a function of an expected processing machine type; and (b) compiling the generated source code to form machine executable code for implementing the subject query dependent upon execution results of code generated for a prior piece, said generated source code thereby avoiding runtime interpretation of the pieces in the execution plan, wherein the code generated for at least one piece of the plan is cached so that the generated code remains available for use in processing a subsequent plan piece without rerunning the generating step including generating source code using the different code generation techniques as the function of the expected processing machine type, and wherein the target processing machines have different numbers of general purpose registers (GPRs), and the compiling step tracks register usage differently for the different target processing machines.