Example: Statistics Are Not Copied When Set Or Aggregation Operators Are Specified In The Query - Analytics Database - Teradata Vantage

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

Vantage does not copy statistics if set operators or aggregation operations are specified in the query as these examples demonstrate.

Example1

In this example, Vantage does not copy statistics because of the aggregating GROUP BY clause in the subquery.

    CREATE TABLE t3 (c1, c2) AS (SELECT MAX(x), y
                                 FROM test   
                                 GROUP BY 2) 
    WITH DATA AND STATISTICS;

Example2

In this example, Vantage does not copy statistics because of the aggregating GROUP BY clause in the subquery:

    CREATE TABLE t3 (c1, c2) AS (SELECT COUNT(x), y 
                                 FROM test 
                                 GROUP BY 2) 
    WITH DATA AND STATISTICS;

Example3

In this example, Vantage does not copy statistics because of the aggregating GROUP BY and HAVING clauses in the subquery.

    CREATE TABLE t3(a, b, c) AS (SELECT x1, MIN(y1), AVG(a1)
                                 FROM test1 
                                 GROUP BY x1 
                                 HAVING AVG(y1) > 40) 
    WITH DATA AND STATISTICS;