Described herein are instance mapping techniques that facilitate the
rewrite of queries to access materialized views that have multiple
instances of the same table. Instance mapping techniques are processes
for determining a mapping between equivalent instances in a query and
materialized view definition. An instance in a query that is equivalent
to an instance in a materialized view definition (or another query) is
treated as if they are identical labels for the same table for the
purposes of rewriting a query. To determine the mapping between instances
of a table in a query and a materialized view definition, join predicates
in the query and materialized view definition that involve instances of
the table are compared.