The subject disclosure pertains to efficient computation of the difference
between queries by exploiting commonality between them. A minimal
difference query (MDQ) is generated that roughly corresponds to removal
of as many joins as possible while still accurately representing the
query difference. The minimal difference can be employed to further
substantially the scope of view matching where a query is not wholly
subsumed by a view. Additionally, the minimal difference query can be
employed as an analytical tool in various contexts.