I. Introduction
Query one of the key reasons for the success of RDBMS technology is the use of declarative languages and query optimization. The user can just indicate what data needs to be retrieved and the database takes over the task of finding the most efficient method of retrieving that data. It is the job of the query optimizer to evaluate other alternative methods of executing a query, and selecting the best execution method. Database queries are optimized based on cost models that calculate costs for query plans. The cost of a query plan depends on parameters such as base and intermediate relation cardinalities, predicate selectivity, available memory, disk bandwidth, processor speeds and existence of access paths. The values of some of these parameters may change over time because of change in the database state, access paths and the execution environment. During query optimization, the plan produced by the query optimizer is calculated with the various estimates and statistics used by the optimizer. Actual statistics are collected at query execution time.