Patent ID: 7774336

Claim:
A method for executing a query, said method comprising the steps of: executing a portion of a predetermined query plan that includes querying a plurality of tables within a database on a computer, said predetermined query plan including at least one sequence of pipelined joins within the database on the computer; as the portion of the predetermined query plan executes, providing a reordered query plan for said sequence of pipelined joins based upon information derived from said executing the portion of the predetermined query plan; comparing a ranking metric of said portion of said predetermined query plan with a ranking metric of said reordered query plan; and upon either a driving table or an inner table within the plurality of tables having reached a depleted state during said executing the portion of the predetermined query plan, executing a portion of said reordered query plan that includes querying the plurality of tables within the database on the computer if said ranking metric of said reordered query plan is less than said ranking metric of said portion of said predetermined query plan.