1. A computer-implemented method of optimizing a query, comprising: determining a maximum cardinality for an operator, wherein the query comprises the operator; determining a plurality of potential implementations for the operator; and generating a query plan for the query based on the maximum cardinality and the potential implementations.