15.10 - UpdateStatSampleSetting - Teradata Database

Teradata Database Application Programming Reference

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1090-151K

Records the user specified SAMPLE setting to include when preparing and executing the SQL COLLECT STATISTICS statements on the selected statistics or objects.

REPLACE PROCEDURE TDSTATS.UpdateStatSampleSetting
 (IN  SCOID        BIGINT,
  IN  DatabaseName VARCHAR(128) CHARACTER SET UNICODE,
  IN  TableName    VARCHAR(128) CHARACTER SET UNICODE,
  IN  SampleType   CHAR(1) CHARACTER SET LATIN,
  IN  Percentage   INTEGER,
  OUT NumUpdated   SINTEGER)
           .
           .
           .
;
 

Parameter

Description

SCOID

TDSTATS ID of an individual statistic whose SAMPLE settings are to be changed. For more information, see the SampleType input parameter.

DatabaseName

Name of the database. DatabaseName limits the new settings that will be applied to all statistics collected within the database you specify.

TableName

Name of the table within the specified DatabaseName. TableName limits the new settings to statistics collected on the table you specify within DatabaseName.

SampleType

Type of sample option change:

  • S means SYSTEM SAMPLE
  • U means SAMPLE <Percentage> PERCENT
  • N means no sampling
  • For more information about the COLLECT STATISTICS SAMPLE option, see SQL Data Definition Language.

    Percentage

    User supplied percentage.

    This value is valid when SampleType is U. For details, see the SampleType input parameter.

    The new collection settings will take effect during the next RunCollect involving the selected statistics. For more information about this external stored procedure, see “RunCollect” on page 550.

     

    Parameter

    Description

    NumUpdated

    Number of statistics whose SAMPLE setting have been updated.

    For more information about the COLLECT STATISTICS SAMPLE option, see SQL Data Definition Language.

    The following example shows how to specify a SampleType option (for example, SAMPLE 25 PERCENT) when collecting statistics on the individual statistic whose TDSTATS database ID is 102 on the Personnel.Employee table.

    CALL TDSTATS.UpdateStatSamplingSetting(102, 'Personnel', 'Employee', 'U', 25, NumUpdated);
     
    *** Procedure has been executed. 
    *** Total elapsed time was 1 second.
     
     NumUpdated
    -----------
              1

    For more information about the COLLECT STATISTICS SAMPLE option, see SQL Data Definition Language.