1. A method of optimizing execution of a query that accesses data stored in one or more base tables in a database of a computer system, comprising: performing a first query that accesses the data stored in the base tables, in order to create at least one materialized query table (MQT); using data stored in the MQT as statistics data for determining an optimal execution plan for a second query that accesses the data stored in the base tables; and performing the second query using the optimal execution plan to access the data stored in the base tables in the database for presentation to a user.