Patent ID: 8078652

Claim:
A computer-implemented method comprising: receiving one or more database commands that request to define a virtual column that contains results of a virtual column expression, said one or more database commands specifying: a name for said virtual column; and said virtual column expression; in response to receiving said one or more database commands, generating database metadata that: defines said virtual column as a named virtual column having said name; and defines said virtual column as containing the results of said virtual column expression; generating statistical data on a distribution of data values contained in said virtual column; receiving a query that includes at least one predicate, wherein the at least one predicate references said virtual column by said name; in response to receiving the query: retrieving, from a statistics database, the statistical data on a distribution of data values contained in said virtual column; estimating, based on the statistical data, a cost of executing the query; and computing results for the query, wherein computing results for the query includes computing one or more values for said virtual column according to said virtual column expression; and wherein the steps are performed by one or more computing devices.