1. A method of optimizing a query in a computer, comprising: (a) generating a hypergraph representation of the query; (b) removing projection operations from the hypergraph; and (c) reordering any remaining projection operations and binary operations in the hypergraph in order to optimize execution of the query.