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

SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-30
dita:mapPath
tpt1555966086716.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1145
lifecycle
previous
Product Category
Teradata Vantageā„¢

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);