Statistics

Statistics on a view help SQL Server understand the data and execute queries efficiently.

In Database Explorer, you can perform operations on statistics by using the shortcut menu. Right-click statistics to access options, such as creating or updating statistics.

Create new statistics

1. In Database Explorer, right-click the Statistics node and select New Statistics.

2. On the Statistics tab of View Editor, configure the statistics properties.

3. Click Apply Changes.

Update statistics

To update all statistics, in Database Explorer, right-click the Statistics node and select Update Statistics.

To update specific statistics, in Database Explorer, right-click the statistics you want to update and select Update.

View statistics details

1. In Database Explorer, right-click the statistics you want to view and select View Statistics.

Alternatively, double-click the required statistics.

2. On the Statistics tab of View Editor, view statistics details.

Filter statistics

1. In Database Explorer, right-click the Statistics node and select Filter.

2. In the Filter Settings dialog, configure the filter parameters.

3. Click OK to apply the filter.

Note

When you open the Statistics node, the number of objects it contains appears in parentheses next to the node name. This number changes based on your filter settings.

Refresh statistics

To update statistics to reflect the latest changes, in Database Explorer, right-click the required statistics or Statistics node and select Refresh, or press F5.

Open the Properties window

To open the Properties window, in Database Explorer, right-click the required statistics and select Properties, or press F4.

Shortcut menu options for statistics

The following table describes the shortcut menu options available for statistics in Database Explorer.

Name Description
Update Updates statistics.
View Statistics Opens the Statistics tab of View Editor that displays the selected statistics.
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected, ready to retrieve using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Show Details Opens Object Viewer that displays object details.
Refresh Updates the object to reflect the latest changes.
Shortcut: F5
Properties Opens the Properties pane that displays object properties.
Shortcut: F4

Shortcut menu options for the Statistics node

The following table describes the shortcut menu options available for the Statistics node in Database Explorer.

Name Description
New Statistics Opens the Statistics tab of View Editor to create new statistics.
Update Statistics Updates statistics.
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected, ready to retrieve using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Filter Opens the Filter Settings dialog to control which statistics should appear in the view in Database Explorer.
Show Details Opens Object Viewer that displays object details.
Refresh Updates the object to reflect the latest changes.
Shortcut: F5

Bulk operations

In Database Explorer, hold down Ctrl and select multiple statistics. Then right-click the selection and select the required option.

The following table describes the shortcut menu options available for multiple statistics.

Name Description
Update Updates the selected statistics.
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected and ready to retrieve using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Source Control > Link/Unlink Static Data Opens the Source Control Link Static Data dialog that displays the tables whose data you want to link.

Bulk operations for statistics