A system (100, 500), comprising: at least one data processor; and at least one memory storing instructions which, when executed by the at least one data processor, result in operations comprising: generating, based at least on a representation of a first hierarchy (200, 250, 260, 300, 340a, 370a) stored in a database, a visiting sequence data structure, the first hierarchy (200, 250, 260, 300, 340a, 370a) being stored in a table (150, 310, 330) in the database, each of a plurality of rows of the table (150, 310, 330) corresponding to one of a plurality of nodes (270a-g) of the first hierarchy (200, 250, 260, 300, 340a, 370a), and the visiting sequence data structure include a first row vector specifying an order for traversing the plurality of nodes (270a-g) in the first hierarchy (200, 250, 260, 300, 340a, 370a); and executing a hierarchical window function by at least iterating through the plurality of rows of the table (150, 310, 330) in accordance with the order specified by the first row vector and determining, for a first node in the first hierarchy (200, 250, 260, 300, 340a, 370a), a summary value corresponding to a first value of the first node and a second value of a second node descendent from the first node. at least one data processor; and at least one memory storing instructions which, when executed by the at least one data processor, result in operations comprising: generating, based at least on a representation of a first hierarchy (200, 250, 260, 300, 340a, 370a) stored in a database, a visiting sequence data structure, the first hierarchy (200, 250, 260, 300, 340a, 370a) being stored in a table (150, 310, 330) in the database, each of a plurality of rows of the table (150, 310, 330) corresponding to one of a plurality of nodes (270a-g) of the first hierarchy (200, 250, 260, 300, 340a, 370a), and the visiting sequence data structure include a first row vector specifying an order for traversing the plurality of nodes (270a-g) in the first hierarchy (200, 250, 260, 300, 340a, 370a); and executing a hierarchical window function by at least iterating through the plurality of rows of the table (150, 310, 330) in accordance with the order specified by the first row vector and determining, for a first node in the first hierarchy (200, 250, 260, 300, 340a, 370a), a summary value corresponding to a first value of the first node and a second value of a second node descendent from the first node. generating, based at least on a representation of a first hierarchy (200, 250, 260, 300, 340a, 370a) stored in a database, a visiting sequence data structure, the first hierarchy (200, 250, 260, 300, 340a, 370a) being stored in a table (150, 310, 330) in the database, each of a plurality of rows of the table (150, 310, 330) corresponding to one of a plurality of nodes (270a-g) of the first hierarchy (200, 250, 260, 300, 340a, 370a), and the visiting sequence data structure include a first row vector specifying an order for traversing the plurality of nodes (270a-g) in the first hierarchy (200, 250, 260, 300, 340a, 370a); and executing a hierarchical window function by at least iterating through the plurality of rows of the table (150, 310, 330) in accordance with the order specified by the first row vector and determining, for a first node in the first hierarchy (200, 250, 260, 300, 340a, 370a), a summary value corresponding to a first value of the first node and a second value of a second node descendent from the first node.