Partilhar via


Maintenance Plan Wizard (Define Update Statistics Task Page)

Use the Define Update Statistics Task page to update SQL Server information about the data in the tables and indexes. This task resamples the distribution statistics of each index on the selected object. The distribution statistics are used by SQL Server to optimize navigation through tables during the processing of Transact-SQL statements. To build the distribution statistics automatically, SQL Server periodically samples a percentage of the data in the corresponding table for each index. This percentage is based on the number of rows in the table and the frequency of data modification. Use this option to perform an additional sampling using the specified percentage of data in the tables. SQL Server uses this information to create better query plans.

This task uses the UPDATE STATISTICS statement.

Options

  • Databases
    Specify the databases affected by this task.

    • All databases
      Generate a maintenance plan that runs this task against all SQL Server databases, except tempdb.
    • All system databases
      Generate a maintenance plan that runs this task against each of the SQL Server system databases except tempdb. No maintenance tasks are run against user-created databases.
    • All user databases
      Generate a maintenance plan that runs this task against all user-created databases. No maintenance tasks are run against the SQL Server system databases.
    • These specific databases
      Generate a maintenance plan that runs this task against only those databases that are selected. At least one database in the list must be selected if this option is chosen.
  • Object
    Limit the Selection grid to display tables, views, or both.
  • Selection
    Specify the tables or indexes affected by this task. Not available when Tables and Views is selected in the Object list box.
  • All existing statistics
    Update statistics for both columns and indexes.
  • Column statistics only
    Only update column statistics. Uses the WITH COLUMNS option.
  • Index statistics only
    Only update index statistics. Uses the WITH INDEX option.
  • Scan type
    Type of scan used to gather updated statistics.
  • Full scan
    Read all rows in the table or view to gather the statistics.
  • Sample by
    Specify the percentage of the table or indexed view, or the number of rows to sample when collecting statistics for larger tables or views.

See Also

Other Resources

UPDATE STATISTICS (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

12 December 2006

New content:
  • Added descriptions of Scan type, Full scan, and Sample by.