Patent ID: 6850925

Claim:
An iterative process for optimizing a query to produce an optimized query execution plan for a database comprising the steps of: a) initializing a sub-plan memo data structure for storing data concerning multiple sub-plans that form parts of potential query execution plans; b) optimizing an input query to produce a first set of sub-plans, which when executed produce result record sets from the database; c) forming a sub-plan query statement for each of the sub-plans that make up the first set of query execution sub-plans; d) executing each of the sub-plan query statements on the database and storing a result of said execution in the sub-plan memo data structure for use in producing a final query execution plan for answering the input query; and e) creating a different set of query sub-plans using a result stored in the sub-plan memo data structure and using said query sub-plans to create one or more additional sub-plan query statements which are then executed over the database.