Presented is a method to perform a query to retrieve data from a database
that is part of a computer system comprising a Data-Base Management
System (DBMS) with an optimizer. A Query Execution Plan (QEP) is
generated for the query. The QEP is assessed by considering statistical
values about previous executions of the query according to the QEP to
decide whether to choose the QEP or to generate a new QEP. Furthermore,
the statistical values on previous executions of the query are exploited
during query optimization. The query is executed according to the chosen
QEP. For optimizing the execution of future queries, statistical values
about the execution of the query are collected during execution.