Image Number 11 for United States Patent #6546381.
A query optimization system and method are particularly suitable for generating a least cost query plan expressible on a plurality of heterogeneous database schemas that are restructuring views of each other. The query optimization system receives a query against one of the tables and converts it to a plurality of alternate queries, each formatted for the particular schema of a different one of the plurality of heterogeneous tables. In generating the alternate queries, the system may utilize SchemaSQL view definitions and may employ restructuring operators expressing and capable of conducting a restructuring of a table into a restructuring view of the table. A middleware system involving a canonical schema and a virtual canonical table may also be employed to express a mapping between restructuring views for purposes of query conversion. The alternate queries may be costed and optimized and a query plan returned that has a least cost or service time involved.