A database-management means may comprise an optimizer engine that identifies an efficient way, known as an “execution plan,” to respond to a database-access request. Such an optimizer engine may be necessary when a database-management means can derive an execution plan from a large number of possible data-access strategies, data join methods, and other implementation-specific details when in order to serve a query, generate a report, or respond to a request to update stored data. In all but the most modest configurations, selecting the most efficient execution plan may require an optimizer engine to consider a huge number of possibilities.
Most optimizers address such tasks by analyzing a set of statistics that characterize the contents of a database. These statistics may include information about stored database objects like tables, fields, records, indices or keys, and partitions. Collecting or gathering such statistics may be a resource-intensive task that requires a distinct statistics-collection function, and this function may need to be performed frequently in order to ensure that the statistics it collects are as current as possible or, as described herein, to ensure that the statistics have not become “stale.”
Each such statistics-collection or statistics-generation job may consume so many resources that it reduces database performance to unacceptable levels. When possible, these functions may be scheduled as batch jobs that run after hours in order to minimize their effect on users.
These conflicting requirements may create a paradox for database system designers. If a mission-critical database must be available at all times, it may be difficult to identify idle periods in which a statistics-collection task may be run with minimal effect on database availability or performance. But if statistics-collection tasks are not performed frequently enough, the statistics available to an optimizer engine may become too stale to allow the optimizer to identify execution plans that consistently ensure a efficient response to a database-access request.