17.10 - 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
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1145-171K
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);