16.20 - Using RANDOM as a Condition on an Index - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1145-162K
Language
English (United States)

Because the RANDOM function is evaluated for each selected row, a condition on an index column that includes the RANDOM function results in an all-AMP operation.

For example, consider the following table definition:

   CREATE TABLE t1
      (c1 INTEGER
      ,c2 VARCHAR(9))
   PRIMARY INDEX ( c1 );

The following SELECT statement results in an all-AMP operation:

   SELECT * 
   FROM t1 
   WHERE c1 = RANDOM(1,12);