Example: Statistics Are Not Copied If a Join Operation Is Specified in the Subquery - 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 a join operation is specified in the subquery. as the examples in this set demonstrate.

Consider the following view definitions for the examples in this set.

    CREATE VIEW v2 (i, j) AS (
      SELECT SUM(x), y 
      FROM test 
      GROUP BY 2);
    CREATE VIEW v3 (i, j) AS (
      SELECT CASE 
             WHEN z1='abc' 
             THEN 1 
             ELSE 0, a1+1 
      FROM test1);

Example1

In this example, Vantage does not copy statistics because of the join specification in the subquery.

    CREATE TABLE t4 AS (SELECT *
                        FROM test, test1) 
    WITH DATA AND STATISTICS 
    PRIMARY INDEX (z, z1) 
    INDEX (b, b1);

Example2

In this example, Vantage does not copy statistics because of the join specification in the subquery.

    CREATE TABLE t6 (c1, c2, c3, c4) AS (SELECT x1, y1, x-1, y*2
                                         FROM test1, test) 
    WITH DATA AND STATISTICS;

Example3

In this example, Vantage does not copy statistics because of the join specification in the subquery.

    CREATE TABLE t5 AS (SELECT *
                        FROM v2, v3) 
    WITH DATA AND STATISTICS;

Example4

In this example, Vantage does not copy statistics because of the join specification in the subquery.

    CREATE TABLE t5 AS (SELECT *
                        FROM v3, test) 
    WITH DATA AND STATISTICS;