This function is used to visualize the statistics generated on the data base when the data base is SQL Server™.
It is also used to update the statistics.
Warning, this type of function facilitates, via a user interface homogenous with the software, the launch of live procedures dedicated to a database admin. It is made to be launched by such an admin (usually called DBA).
To be used optimally, the user should be familiar with the functioning of databases and their optimization.
Conversely, an inappropriate use of the function can be problematic for the performances of the system and might compromise the utilization of the software.
This function is used to visualize the statistics generated on the data base when the data base is SQL Server™.
These elements are displayed on two tabs: the first tab shows the list of indexes and the status of statistics for each index, the second tab shows the list of database parameters relating to the generation of statistics.
Presentation
Used to identify the characteristics of the database used.
Close
Fields
The following fields are present on this tab :
|
Name of the database. |
|
Version number of the database. |
|
Description of the database version. |
Close
Presentation
This tab displays the list of indexes and the statistic report for each of them.
Close
Fields
The following fields are present on this tab :
|
Used to define if the line must be processed in generation of the statistics, using the corresponding button at the bottom of the screen. |
|
Name of the table in the database. |
|
Name of the index in the database |
|
Number of lines in the table corresponding to the index (count) |
|
Indicate if the statistics are automatically generated for the index. Corresponds to the database parameter automatic UPDATE STATISTICS for the index. |
|
Indicate if the valid statistics are generated in the database. |
|
Date of the last analysis of the statistics |
|
Time of the last analysis of the statistics |
Close
It is possible to generate statistics:
Action icon
When faced with an entry grid with multiple choices and a Yes/No answer on each line, this function makes it possible to answer Yes to all the lines starting from the current line.
When faced with an entry grid with multiple choices and a Yes/No answer on each line, this function makes it possible to answer No to all the lines starting from the current line.
Used to refresh the display of the grid's current line
Used to generate statistics for the grid's current line.
Close
Presentation
This tab displays the list of database parameters relating to the automatic generation of statistics.
Close
Fields
The following fields are present on this tab :
Grid Statistics parameters
|
Display the options set on the database for the automatic generation of the statistics. The options are as follows :
|
|
  |
Close
It is not possible to act on these values.
This button, also accessible using the short cut, used to refresh the display of the tabs. |
Can be used to generate statistics for all the requested lines in the table of the Index tab. |
SQL Server saves the statistics of key value distribution in each index and uses these statistics to determine the indexes to be used in the processing of queries.
Therefore, it can be useful to update the statistics if
With Microsoft® SQL Server™, it is possible to create statistic information relating to the distribution of key values in a column that must be created. These statistics can be exploited by the query processor in order to define the best strategy for the evaluation of a query. When an index is created, SQL Server automatically stores the statistic information relating to the distribution of values in the indexed column(s). The SQL Server query optimizer uses these statistics to estimate the use cost of the index for a query. Moreover, if the AUTO_CREATE_STATISTICS database option is activated (ON), which is the case by default, SQL Server automatically creates statistics for columns without index used in a predicate.
If data of a column change, the statistics of the index and the column may become obsolete and thus, they may lead the query optimizer to take wrong decisions when it comes to processing a query. For instance, if a table is created with an indexed column and 1.000 lines of data, all of them containing unique values in the indexed column, the query optimizer considers that the indexed column is a "good" solution to receive the data for a query. If the data of a column are updated by creating several duplicated values, the column is no longer a perfect candidate to be used in a query. However, the query optimizer still considers that it is a good candidate based on the obsolete distribution statistics of the index that were based on the data before update.
From then on, the SQL Server automatically and regularly updates the statistic information, as data contained in the tables are modified. The sampling is carried out randomly through the pages of data and it comes from the table or the smallest index not ordered in clusters on the columns required for the statistics. After the reading of a page of data from the disk, all the lines of the page are used to update the statistic information. The update frequency of these statistics depends on the volume of data contained in the column of the index and it also depends on the quantity of variable data.
SQL Server always guarantees the sampling of a minimum number of lines. Tables whose size is lower than 8 Mo are always subject to a complete analysis in order to elaborate statistics.
The cost of this automatic update of statistics is minimized thanks to the sampling of date; not all of these are analysed.
All information on tables, indexes and statistics are read directly in the database via SQL Server tables and views:
The dates of statistics are obtained using the STATS_DATE function.
The information about the automatic generation of statistics on the indexes is obtained using the sp_autostats process.
The information about the automatic management of statistics on the database is obtained using the sp_dboption process.
The statistics are updated using the UPDATE STATISTICS instruction.