Example: Statistics Are Not Copied If a Join Operation Is Specified in the Subquery - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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;