statistics on a table

  • Can anyone please let me know if update statistics is run on a table is it created only for columns which are part of index or on all columns. what happens if there is a query which has search criteria on columns that re not indexed. Will statistics be used on that too?

    any help will be greatly appreciated.

    Thx 

  • This was removed by the editor as SPAM

  • Statistics are always created for the first column on an index, and if your database has the auto-create statistics option on, on all other columns (except text & image types) that are used as search arguments in your queries.

    E.g. SELECT ... FROM Items WHERE ItemAttributute = 'X'

    If ItemAttribute is not the first column in any indexes for the Items table, then SQL Server will create statistics for the ItemAttribute column.

    To view all system generated statistics, run sp_helpstats '<table name>'.

    SQL BAK Explorer - read SQL Server backup file details without SQL Server.
    Supports backup files created with SQL Server 2005 up to SQL Server 2017.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply