Example: Collecting Sampled Statistics - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

This request samples statistics on column orders.o_orderkey using a user-specified sample percentage of 10%. The database collects the statistics by reading only 10% of the rows in orders.

     COLLECT STATISTICS
       USING SAMPLE 10 PERCENT
       COLUMN o_orderkey
     ON orders;

This request recollects the statistics on the o_orderkey column with the sample size of 10% and on the o_orderdatetime column with a system-selected sample size.

     COLLECT STATISTICS 
       COLUMN o_orderkey,
       COLUMN o_orderdatetime
     ON orders;

This request recollects the statistics on o_orderkey column with the sample size of 10% (set by the first request) and on o_orderdatetime with a system-selected sample size (set by the second request).

     COLLECT STATISTICS 
     ON orders;