Patent ID: 7865502

Claim:
A method for optimization of Extensible Markup Language Path Language (XPath) expressions in a database management system configured to accept Extensible Markup Language (XML) queries, the method comprising: receiving an XML Query (XQuery) representation; partitioning XPath expressions within the XQuery representation into a plurality of XPath expression clusters, the XPath expression clusters comprising one or more XPath expressions, the one or more XPath expressions in each cluster hierarchically related to each other such that branch nodes of the cluster are executable independent of nodes in other XPath expression clusters, the one or more XPath expressions referencing a common document; merging the one or more XPath expressions of each XPath expression cluster into one or more expression trees for each XPath expression cluster, a single expression tree corresponding to an XPath expression block, the one or more XPath expression blocks configured to be incorporated into one or more query execution plans; generating one or more query execution plans comprising one or more XPath expression blocks, the one or more query execution plans by determining a cardinality according to database statistics and an execution cost for each XPath expression block within each query execution plan, and splitting each of the XPath expression blocks into one or more ordered fragments based on the cardinality and the execution cost; and determining an aggregate cardinality for each query execution plan and an aggregate execution cost for each query execution plan comprising the one or more XPath expression blocks.