Redefining Primary Index, Primary AMP Index, or Partitioning without ALTER TABLE - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

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
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

To redefine the primary index or partitioning for a table without using an ALTER TABLE request, see Procedure to Change Column Data Types. Refer to one of the following methods.

First method

  1. Copy the table into a newly defined table defined with a different primary index or primary AMP index (or without a primary index) and populate it using the CREATE TABLE AS syntax. See CREATE TABLE (AS Clause).
  2. Catalog the privileges on the old table. See Procedure to Change Column Data Types.
  3. Drop the original table. See DROP TABLE and Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
  4. Rename the new table. See Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
  5. Grant privileges on the new table. See Teradata Vantage™ - SQL Data Control Language, B035-1149.

Second method

  1. Create a new table with a different name that specifies the new index.
  2. Populate the new table using an INSERT ... SELECT request. See Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.
  3. Catalog the privileges on the old table. See Procedure to Change Column Data Types.
  4. Drop the original table. See DROP TABLE and Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
  5. Rename the new table with that of the old table. See Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
  6. Grant privileges on the new table. See Teradata Vantage™ - SQL Data Control Language, B035-1149.