Information hierarchies are efficiently stored and accessed in a relational or object-
relational database system. A path signature, similar to a pathname, is stored in a
database system in association with data for the node identified by the pathname. For example, a path signature identifying an element is stored in a row that holds data for the element. To retrieve data for a hierarchical query that identifies the data requested using, for example, an
XPATH string, a string pattern is generated that is matched by path signatures identified by the
XPATH string.
Pattern matching is then used to select rows associated with matching path signatures, and data from the selected rows is used to compute the
XPATH query. Furthermore, hash values representing path signatures are generated in a way that preserves the ordering of data in an information hierarchy. The hash values can be indexed to provide quick access.