Example: Using RANDOM to Redistribute Data Blocks of Rows and Individual Rows Before Copying Them Locally - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-12-13
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢

Assume that you created the following NoPI tables for this example.

     CREATE TABLE tnopi1 (
       a INT,
       b INT,
       c INT)
     NO PRIMARY INDEX;

     CREATE TABLE tnopi2 (
       a INT,
       b INT,
       c INT)
     NO PRIMARY INDEX;

The following INSERT ... SELECT request uses the RANDOM option to redistribute data blocks of rows randomly from tnopi1 before locally copying them into tnopi2.

     INSERT INTO tnopi2
       SELECT *
       FROM tnopi1
       HASH BY RANDOM;

The following INSERT ... SELECT request uses the RANDOM function to redistribute individual rows randomly from tnopi1 before locally copying them into tnopi2:

     INSERT INTO tnopi2
       SELECT *
       FROM tnopi1
       HASH BY RANDOM(1, 2000000000);