例: COLLECT STATISTICSのSQLテキストのみの場合のSHOW STATISTICS - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQLデータ定義言語 構文規則および例

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
2021年1月
Language
日本語
Last Update
2021-03-30
dita:mapPath
ja-JP/ncd1596241368722.ditamap
dita:ditavalPath
ja-JP/ncd1596241368722.ditaval
dita:id
B035-1144
Product Category
Software
Teradata Vantage

ordersテーブルに関する以下の統計を収集したとします。

     COLLECT STATISTICS 
       COLUMN o_orderdatetime ON orders;
     COLLECT STATISTICS 
       USING SAMPLE 
       COLUMN CAST(o_orderdatetime AS DATE) AS orderdate ON orders;
     COLLECT STATISTICS 
       USING SAMPLE 
       COLUMN o_orderpriority ON orders;
     COLLECT STATISTICS 
       USING SAMPLE 10 PERCENT 
       COLUMN o_custkey ON orders;
     COLLECT STATISTICS 
       USING SAMPLE 10 PERCENT 
       COLUMN o_orderkey ON orders;
     COLLECT STATISTICS 
       USING MAXINTERVALS 250 AND MAXVALUELENGTH 15
       COLUMN (o_orderdatetime, o_orderkey) ON orders;
     COLLECT STATISTICS 
       COLUMN o_totalprice ON orders;

次のSHOW STATISTICSリクエストは、VALUESオプションが指定されていないため、上にリストされたCOLLECT STATISTICSリクエストのSQLテキストのみを報告し、それらを統計の収集で使用したUSINGオプションによってグループ化します。

     SHOW STATISTICS ON orders;
     COLLECT STATISTICS 
USING NO SYSTEM SAMPLE
AND SYSTEM MAXINTERVALS 
AND SYSTEM MAXVALUELENGTH
 COLUMN o_orderdatetime,
  COLUMN o_totalprice
ON orders;
     COLLECT STATISTICS 
USING SYSTEM SAMPLE 
AND SYSTEM MAXINTERVALS 
AND SYSTEM MAXVALUELENGTH
 COLUMN CAST(o_orderdatetime AS DATE) AS OrderDate, 
  COLUMN o_orderpriority
ON orders;
     COLLECT STATISTICS 
USING SAMPLE 10 PERCENT 
AND SYSTEM MAXINTERVALS 
AND SYSTEM MAXVALUELENGTH
 COLUMN o_custkey, 
  COLUMN o_orderkey
ON orders;
     COLLECT STATISTICS 
USING NO SYSTEM SAMPLE 
AND MAXINTERVALS 250
AND MAXVALUELENGTH 15
 COLUMN (o_orderdatetime, o_orderkey) 
ON orders;