A database optimizer collects statistics regarding which types of
applications are accessing the database, and makes one or more changes to
the database schema to optimize performance according to the collected
statistics. In a first embodiment, the optimizer detects when a certain
type of application accesses the database a percentage of time that
exceeds a predefined threshold level, and if the data in the database is
stored in a less-than-optimal format for the application, the data type
of one or more columns in the database is changed to a more optimal
format for the application. This means that the database optimizer must
recognize when a different type of application requests data from any
changed column, and must potentially perform a conversion from the new
data type to the old data type before returning the requested data. In a
second embodiment, the optimizer detects when one type of application
accesses a column a percentage of time that exceeds a first predefined
threshold level and that accesses the column a percentage of time that is
less than a second predefined threshold level. In this case, a new column
is created in the database so the data is present in both formats,
thereby optimizing the performance of both old and new applications that
access the data. The database optimizer looks at what type of application
requested data, and returns the data in the format optimized for that
type of application.