Patent ID: 7302422

Claim:
A computer-implemented method of collecting statistics in a database management system comprising a plurality of collection objects having a plurality of tables, at least one particular collection object of the plurality of collection objects comprising a plurality of particular tables of the plurality of tables, comprising: receiving a workload comprising a plurality of database queries referencing the plurality of tables, at least two of the database queries that are different referencing a same table of the plurality of tables; for each database query of the plurality of database queries of the workload: identifying query statistics for said each database query of the plurality of database queries, the query statistics comprising a number of references to at least one table of said each database query and a number of occurrences of said each database query; and consolidating, for said each database query, the query statistics to provide consolidated statistics comprising at least one cumulative table score for said at least one table, respectively, wherein said at least one cumulative table score for said at least one table is based on a previous at least one cumulative table score, if any, for said at least one table and a product of the number of references to said at least one table of said each database query and the number of occurrences of said each database query; and generating a plurality of statistics collection tasks to collect database statistics to be used by an optimizer based on the consolidated statistics, the plurality of statistics collection tasks to collect the database statistics on the plurality of tables referenced by the plurality of database queries of the workload, the plurality of statistics collection tasks being based on a plurality of collection objects comprising the plurality of tables referenced by the plurality of database queries of the workload, a plurality of collection object scores are determined for the plurality of collection objects comprising the plurality of tables referenced by the plurality of database queries of the workload, each collection object score for each collection object is based on said at least one cumulative table score for said at least one table of said each collection object, wherein the plurality of statistics collection tasks are ordered based on the plurality of collection object scores.