Search code examples
sqldatabaseindexingteradataalter

Modifying Primary Index of a table in Teradata


I am new to Teradata. I have a table with around 45k records with a particular Primary index. I want to change the primary index of this table. Can somebody help pls?

Below is my current primary index.

PRIMARY INDEX IDX_NON_RTL_SALES_WIDE_01 ( col1 ,Col2 ,Col3 );

I want to remove col3 and add few other columns to it.

Thanks in Advance


Solution

  • You cannot alter a PI in teradata unless the table is empty.

    You will need to copy the data out to another table, volatile or permanent.

    Then you can alter your index:

    alter table <TableName> modify primary index Index_Name(col1, col2, ...);