17.10 - Example: Statistics Are Not Copied If a Join Operation Is Specified in the Subquery - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

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;