25. A non-transitory computer-readable storage medium storing one or more sequences of instructions which, when executed by one or more processors, cause the one or more processors to perform steps comprising: receiving, at a database server, a query that evaluates to a relation, wherein said query comprises: a first one or more clauses; and a model clause, wherein said model clause comprises: a rule that comprises a left-side expression and a right-side expression, wherein said right-side expression includes a window function; and one or more dimension columns that correspond to columns of said relation, wherein said left-side expression references a set of said one or more dimension columns; wherein said window function specifies a set of columns over which said window function is to be evaluated, wherein said set of columns corresponds to columns of said relation; executing said query at said database server to generate said relation, wherein executing said query comprises: producing a first set of rows, wherein each row in said first set of rows includes only: said set of columns that is specified by said window function, and said set of said one or more dimension columns that is referenced by said left-side expression; evaluating said window function based on said first set of rows.
25. A non-transitory computer-readable storage medium storing one or more sequences of instructions which, when executed by one or more processors, cause the one or more processors to perform steps comprising: receiving, at a database server, a query that evaluates to a relation, wherein said query comprises: a first one or more clauses; and a model clause, wherein said model clause comprises: a rule that comprises a left-side expression and a right-side expression, wherein said right-side expression includes a window function; and one or more dimension columns that correspond to columns of said relation, wherein said left-side expression references a set of said one or more dimension columns; wherein said window function specifies a set of columns over which said window function is to be evaluated, wherein said set of columns corresponds to columns of said relation; executing said query at said database server to generate said relation, wherein executing said query comprises: producing a first set of rows, wherein each row in said first set of rows includes only: said set of columns that is specified by said window function, and said set of said one or more dimension columns that is referenced by said left-side expression; evaluating said window function based on said first set of rows. 26. The non-transitory computer-readable storage medium of claim 25 , wherein: said query is a Structured Query Language (SQL) query; and said right-side expression includes a plurality of window functions, wherein said window function is one of said plurality of window functions.