11.7 Forcing the Issue When the Query Optimizer Chooses Wrong 215
time consuming when large amounts of data are involved, but are relatively quick
within a data-free environment.
We mentioned earlier that query execution plans depend on the size and distribu-
tion of data in the database. Thus, one might wonder how a valid simulation of the
database can be set up that is data free, but still provides a fair simulation of the query
execution plans. The answer lies in the fact that the query optimizer uses statistics that
are stored in the system catalogs and these cataloged statistics can be copied over to the
data-free database. As a result, even though the database has no data in it, the query
compiler (and optimizer) sees a database full of data ...