First phase of Automation of Update Statistics
To relieve users of the need to determine which columns statistics should be generated for, we will use optimizer requests for stats in conjunction with special syntax for the Update Statistics statement. When the optimizer requests a histogram for a given column, and that column does not exist, it may (depending on the cqds in effect) register a request for the histogram to be created at a later time, or utilize a small sample to generate a rudimentary histogram on the fly. In either case, when a subsequent Update Statistics statements specifies the ON NECESSARY COLUMNS clause, any column of the target table that has been the subject of one of these actions will have a bona fide histogram created. Possible future extensions to automation that are NOT part of the current design include 1) Periodically checking for and supplying needed histograms without being activated by an explicit command and 2) Regenerating histograms upon determining them to be obsolete based on the number of rows of the table that have been inserted, updated, or deleted since the existing histograms were generated.