Patent ID: 8380699

Claim:
A computer-implemented method of optimizing a query, comprising: determining, using a computing system, a maximum cardinality for an operator, wherein the query comprises the operator; determining, using the computing system, a plurality of potential implementations for the operator; and generating, using the computing system, a query plan for the query based on the maximum cardinality and the potential implementations, wherein generating the query plan comprises determining a processing cost for each of the potential implementations, the processing cost being based on the maximum cardinality and an expected cardinality of the potential implementations, and selecting an actual implementation from the plurality of potential implementations for inclusion in the query plan based on the processing cost, wherein the processing cost comprises a value equal to A*E+B*M, wherein E represents a cost based on the expected cardinality, M represents a cost based on the maximum cardinality, A is a first specified weight, B is a second specified weight, A+B=1, A≧0, and B≧0.