A method for using pre-computed information stored in auxiliary structures
to speed up processing of expensive queries on hierarchical documents
such as XML documents being queried using XPath. The invention defines a
taxonomy of such structures such as indexes and materialized views for
storing pre-computed XPath results (PXRs), determines what portion of the
query can be evaluated by the structures, and computes the compensation
for the results generated by the structures. The invention detects all
structures applicable to the query and rewrites the query to use such
structures, speeding up the performance of the queries. The invention
identifies the matching structures by detecting containment mappings
between XPath expressions in the query and the structure. The invention
also includes a new representation for XPath expressions that is rich
enough to express all features of XPath.