Creating a table

Teradata Debugger

Creating a table

Hi I am new to Teradata and coding all togther so I apologse for any silly questions inadvance :-) 


I have tried to create a table using this code below


create table tmg.t1 as (
SELECT Item_Name, Product_View_Time_Dttm, Web_Session_Id ,Page_View_Sequence_Num
FROM cis.t2
WHERE Product_View_Time_Dttm BETWEEN DATE -7 AND DATE -1)
with data;


if I select the data its works fine but when i try to create a subset table(the select data)  it takes forever, the records am trying to insert into the new table are 26,539,945 records


please could any advice how I can create a subset table with these records


Thanks Rory


Re: Creating a table


If you create a table in Teradata and do not define a primary index the first column in this case will be used by default.

Tables are distributed to the Amps based on the Primary index value.

This means all of your data will be distributed by hashing the value of Item_Name.

The behavior you describe indicates the values fo this column are skewed.

You should define a primary index '.......with data  primary index(col1,col2...);'

that will make the combination of columns fairly unique to allow for fairly even data distribution to your amps.

Consider access when choosing your primary index if you can since retreiveing your data by providing the Primary index values will be the most efficient.







Re: Creating a table

Thanks Rglass


Yes the problem was the primary index, I needed to specifiy an appropiate primary index

Tags (1)