Allows the system administrator, or any user with permission to execute the procedure and update statistics on the target table, to modify the density values of columns in sysstatistics.
sp_modifystats [database].[owner].table_name, {"column_group" | "all"}, modify_density, {range | total}, {absolute | factor}, "value" modify_default_selectivity, {inequality | inbetween}, {absolute | factor}, "value" modify_unique {range | total }, {absolute | factor}, "value"
Or:
sp_modifystats [database].[owner].table_name, column_name | null, REMOVE_SKEW_FROM_DENSITY REMOVE_STICKINESS
“a1” modifies column a1.
“a1,a2,a3” modifies the column group a1,a2,a3,
You can also use a wildcard character , %, with the column_group parameter to represent a range of characters. For example, “a1,%,a3” modifies the groups a1,a2,a3 and a1, a4, a3, and so on; “a1,%” modifies the groups a1,a2 and a1,a2,a3, and so on, but not a1; “a1%” modifies the groups a1,a2 and a1,a2,a3, and so on, as well as a1.
unique_range_values / (range_cell_rows * total rows_in_table)
using step values
sampling
histogram_tuning_factor
hashing
no_hashing
partial_hashing
Once a phrase is “sticky,” the SAP ASE server retains its behavior for that column on subsequent update statistics commands, even if you do not explicitly specify the parameters.
REMOVE_SKEW_FROM_DENSITY also updates the total density of any composite column statistics for which this column is the leading attribute. Most commonly, a composite index for which this column is the leading attribute would produce these composite column statistics, but they can also be produced when you issue a composite update statistics command.
sp_modifystats "tab_1", "c00, c01", MODIFY_DENSITY, range, absolute, "0.5"
sp_modifystats "tab_1", "c00,c01", MODIFY_DENSITY, total, factor, "0.5"
sp_modifystats "tab_1", "all", MODIFY_DENSITY, total, factor, "0.5"
sp_modifystats "tab_1", "c12" REMOVE_SKEW_FROM_DENSITY
sp_modifystats t10, a1, MODIFY_DEFAULT_SELECTIVITY, inequality, absolute, "0.09"
sp_modifystats t10, a2, MODIFY_DEFAULT_SELECTIVITY, inbetween, absolute, "0.11"
sp_modifystats t10, "all", MODIFY_UNIQUE, range, factor, "0.13"
sp_modifystats t10, "all", MODIFY_UNIQUE, total, absolute, "0.14"
Allows the system administrator to modify the density values of a column—or columns—in sysstatistics.
Use optdiag to view a table’s statistics. See the Performance and Tuning Guide for more information about table density and using optdiag.
Any modification you make to the statistics with sp_modifystats is overwritten when you run update statistics. To make sure you are using the most recent statistical modifications, you should run sp_modifystats after you run update statistics.
Because sp_modifystats modifies information stored in the sysstatistics table, you should make a backup of statistics before execute running sp_modifystats in a production system.
See also update statistics in Reference Manual: Commands.
The permission checks for sp_modifystats differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with update statistics on the object or with manage any statistics privilege. You must have execute permission on the procedure. |
Disabled | With granular permissions disabled, you must be a user with with update statistics on the object or sa_role. You must have execute permission on the procedure. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|
sysstatistics