1. A method of processing a database query on a computer, the query including an expression, the method including: the computer performing expression optimization on the expression; the computer performing further query optimization to produce a result; the computer saving the result in a machine memory; the computer performing expression optimization before further query optimization; and where the expression includes a sub-expression (“SE”), and where the expression optimization includes: the computer representing the query as a tree structure; the computer representing the expression in the tree structure as a parent node having a first child node and a second child node; where the first child node represents the sub-expression; where the second child node represents the portion of the expression that is not the sub-expression; and where the parent node represents an operation between the first child node and the second child node; the computer determining that the second child node represents the constant 0 and that the parent node represents an arithmetic operation selected from the group consisting of addition and subtraction; and in response, the computer removing the parent node and its children from the tree structure and inserting the first child node in its place.