15. The computer program product of claim 4 , further comprising program code for: when one or more of the group-by columns of the definition query of the MQT are expanded using functional dependency relationships, creating the first set of columns that includes the group-by columns of the MQT definition query expanded; when one or more of the group-by columns of the incoming query are identified, defining the second set of columns by utilizing the one or more of the group-by columns of the incoming query; when one or more matching columns between the first set and the second set are identified, creating a matched group using the one or more matching columns; when one or more of the group-by columns of the first set that do not belong to the matched group are identified, creating a first unmatched group that comprises the one or more of the group-by columns of the first set that do not belong to the matched group; and when one or more of the group-by columns of the second set that do not belong to the matched group are identified, creating a second unmatched group that comprises the one or more of the group-by columns of the second set that do not belong to the matched group.
4. A computer program product comprising: a computer readable medium; and program code on said computer readable medium that when executed by a processor provides the functions of: creating a number of materialized query tables (MQTs) within the database system; defining one or more database table specifications; receiving an incoming query at the database system; in response to the incoming query referencing a first subset of a set of tables, identifying an MQT with a definition query that references the set of tables, wherein said first subset includes one of: (a) a number of fact tables and a group of dimension tables; (b) a number of source tables and a group of dependent tables; and (c) a number of referencing tables and a group of referenced tables; determining when the MQT is a candidate match for the incoming query; identifying one or more candidate MQTs; selecting an optimal MQT from among the one or more candidate MQTs; when the MQT is identified as a candidate match for the incoming query, determining whether the MQT is a best match from among a number of candidate matches for the incoming query; and when the MQT is identified as the best match for the incoming query, rewriting the incoming query utilizing the MQT.