A heuristic approach is used to order materialized view (MW) candidates in
a list based on descending order of their reduction power. A query (e.g.,
SQL query) is then matched with the MVs in the list order, wherein
searching is stopped when matching has been found. The query is matched
with materialized views in the ordered list by identifying a materialized
view candidate as follows: identifying an MV that is not locked by a
REFRESH process; identifying a matching MV that does not require a
regroup; identifying a matching MV that does not require a rejoin;
identifying a matching MV that does not require a residual join; or
identifying an MV with largest reduction power from the list of
candidates.