Patent ID: 7409387

Claim:
A method for materialized query table matching, the method comprising: receiving a database query; retrieving a materialized query table from data storage accessible to a database management system; selecting a join in the materialized query table between a table that is not invoked by the query and a table that is invoked in the query; determining whether the selected join is lossless including: losslessly joining the table that is not invoked by the query to the query including: identifying a primary key in the table not invoked by the query; identifying a foreign key in the table that is invoked by the query; identifying the same foreign key in the query; losslessly joining the primary key of the table not invoked by the query to the same foreign key in the query including: creating a copy of the query; losslessly joining the primary key to the same foreign key of the copy of the query; determining whether the lossless join to the query matches the selected join of the materialized query table; and if the selected join is lossless, expanding the query to include the lossless join.