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. 27. The non-transitory computer-readable storage medium of claim 25 , wherein: said left-side expression of said rule identifies one or more cells in a second set of rows, wherein said second set of rows is included in said relation; said window function specifies one or more partition columns by which to partition said second set of rows into partitions; the instructions that cause said step of executing said query comprise instructions which, when executed by the one or more processors, cause the one or more processors to perform: based on said left-side expression, determining said second set of rows in said relation; and based on said one or more partition columns, partitioning said second set of rows into one or more subsets of rows; the instructions that cause said step of producing said first set of rows comprise instructions which, when executed by the one or more processors, cause the one or more processors to perform producing said first set of rows based on at least one of said one or more subsets of rows.