USTLOW_SAMPLE environment option

Use the USTLOW_SAMPLE session environment option to enable or disable sampling during the collection of index statistics for UPDATE STATISTICS LOW operations in the current session.

By default, when the UPDATE STATISTICS statement gathers distribution statistics for a table on which one or more indexes are defined, the database server reads all index leaf pages in sequence to calculate index statistics, such as the number of leaf pages, the number of unique lead index-key values, and cluster information.

For an index with more than 100 KiB leaf pages, estimating these index statistics from sampling can increase the speed of the UPDATE STATISTIC LOW operation.

To set the USTLOW_SAMPLE session environment variable, specify:

  • '0' or OFF to disable sampling
  • '1' or ON to enable sampling

The value that you specify overrides the setting of the USTLOW_SAMPLE configuration parameter for the session.

For example, to enable sampling for index statistics in the current session, use either of the following statements:
SET ENVIRONMENT USTLOW_SAMPLE '1';

SET ENVIRONMENT USTLOW_SAMPLE ON;
You cannot control how much data is in the sample.