The present invention relates to collecting statistics automatically for
data in a database. There is provided a method for automated statistics
collection comprising determining a likelihood that statistics for data
have changed; and collecting statistics for data in response to the
likelihood. Indicators of the likelihood that statistics have changed may
be useful to trigger automated statistics collection. Tables having
statistics that change significantly may be collected more often than
statistics of tables that are stable. A preferred model is provided to
facilitate the collection of statistics that are more relevant: a table
is scheduled for collection in accordance with observed patterns of table
activity; a table is considered for collection if it meets a threshold
level of activity; and a table is sampled to predict whether the
statistics to be collected have changed. When collecting statistics,
throttling and lock contention can minimize impact on a database user's
response experience.