Patent ID: 8301620

Claim:
A method comprising: a server computing a query expression against a collection of XML documents stored in one or more tables of a database by, at least in part, executing a plurality of row sources of a query execution plan that is generated by the server to compute the query expression, said plurality of row sources including a path-based row source based on a path expression; said server determining whether to enable the path-based row source to compute an aggregate function; and in response to determining to enable the path-based row source to compute said aggregate function, said server enabling the path-based row source to compute said aggregate function; wherein the enabled path-based row source is configured to cause upon execution: generating an aggregate value by applying an aggregate function to XML data identified, at least in part, by said path expression, said XML data being generated based on rows from said one or more tables of said database; generating an output row of the path-based row source that contains said aggregate value; wherein the method is performed by one or more computing devices.