1. A computer-implemented method for optimizing a database query in a computer system, comprising: monitoring, in the computer system, resource usage of one or more resources of the computer system; storing, in the computer system, a condition code representative of the monitored resource usage; modifying, in the computer system, a cost model using the stored condition code; generating, in the computer system, a query execution plan for the database query using the modified cost model; and executing, in the computer system, the query execution plan in order to retrieve data from a database stored on the computer system, wherein the retrieved data is presented to a user for subsequent use and analysis.