Patent ID: 8898142

Claim:
A database management system comprising: one or more computer systems; a database-management system encoded as instructions in one or more computer readable media within the one or more computer systems and executed by the one or more computer systems, the database-management system including a query-execution-plan-compilation component that: selects an operation, based on a cost estimate for using the operation from among two or more equivalent operations for use in a query-execution plan by applying a risk premium to the cost estimate, for using the operation; selects one of two or more alternative query-execution plans for execution of a query based on a cost estimate for executing each alternative query-execution plan that includes one or more risk premiums associated with one or more operations included in the query-execution plan; determines a cost estimate for executing a query-execution plan, the cost comprising one or more of: an elapsed time for execution of the query-execution plan by the database management system; a time for which one or more components of the database management system is used to execute the query-execution plan; and an amount of one or more computational resources used to execute the query-execution plan, including memory, communications bandwidth, processor bandwidth; and wherein the risk premium is computed to reflect a potential underestimation of the cost for executing the database operation when underlying estimates of characteristics of tables to which the database operation is applied are incorrect.