sys.stats (Transact-SQL)
Contains a row for each statistics object that exists for the tables, indexes, and indexed views in the database.
Note
Every index will have a corresponding statistics row with the same name and ID (index_id = stats_id), but not every statistics row has a corresponding index.
The catalog view, sys.stats_columns, provides statistics information for each column in the database. For more information, see sys.stats_columns (Transact-SQL)
For more information about statistics, see Statistics.
Column name |
Data type |
Description |
---|---|---|
object_id |
int |
ID of the object to which these statistics belong. |
name |
sysname |
Name of the statistics. Is unique within the object. |
stats_id |
int |
ID of the statistics. Is unique within the object. |
auto_created |
bit |
Indicates whether the statistics were automatically created by SQL Server. 0 = Statistics were not automatically created by SQL Server. 1 = Statistics were automatically created by SQL Server. |
user_created |
bit |
Indicates whether the statistics were created by a user. 0 = Statistics were not created by a user. 1 = Statistics were created by a user. |
no_recompute |
bit |
Indicates whether the statistics were created with the NORECOMPUTE option. 0 = Statistics were not created with the NORECOMPUTE option. 1 = Statistics were created with the NORECOMPUTE option. |
has_filter |
bit |
0 = Statistics do not have a filter and are computed on all rows. 1 = Statistics have a filter and are computed only on rows that satisfy the filter definition. |
filter_definition |
nvarchar(max) |
Expression for the subset of rows included in filtered statistics. NULL = Non-filtered statistics. |
is_temporary |
bit |
Indicate whether the statistics is temporary. Temporary statistics support AlwaysOn Availability Groups secondary databases that are enabled for read-only access. 0 = The statistics is not temporary. 1 = The statistics is temporary. Does not apply to SQL Azure. |
Permissions
The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.
See Also
Reference
Object Catalog Views (Transact-SQL)