23. The database system of claim 19 , where further query optimization includes: determining a transitive closure of the database query.
19. A database system including: a massively parallel processing system including: one or more nodes; a plurality of CPUs, each of the one or more nodes providing access to one or more CPUs; a plurality of data storage facilities each of the one or more CPUs providing access to one or more data storage facilities; a computer program for execution on the massively parallel processing system for processing a database query, the query including an expression, the computer program including executable instructions that cause one or more of the CPUs to: perform expression optimization on the expression; perform further query optimization to produce a result; save the result in a memory; where the expression optimization is performed before the further query optimization; and where the expression includes a sub-expression (“SE”), and where expression optimization includes: representing the query as a tree structure; 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; 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, removing the parent node and its children from the tree structure and inserting the first child node in its place.