Index creation and Table level of AMP size in Teradata


How to create a table using unique primary index:

CREATE MULTISET TABLE [databasename].[tablename]
(                                   
  col_1   INTEGER,
  col_2   VARCHAR(50)
)
UNIQUE PRIMARY INDEX ( col_1 );

How to create a table using primary index:

CREATE MULTISET TABLE [databasename].[tablename]
(                                  
  col_1   INTEGER,
  col_2   VARCHAR(50)
)
PRIMARY INDEX ( col_1 );

Example 3: Checking data distribution of given columns on the AMP
SELECT HASHAMP(HASHBUCKET(HASHROW([columnlist]))),COUNT(*) FROM [databasename].[tablename]
GROUP BY 1 ORDER BY 2 DESC;

Storage of a table for each AMP

SELECT vproc, CurrentPerm
FROM DBC.TableSize
WHERE DatabaseName = '[databasename]'
AND TableName = '[tablename]'
ORDER BY 1;

Skewness of a table

SELECT TableName,SUM(CurrentPerm) AS CurrentPerm,SUM(PeakPerm) AS PeakPerm,
       CAST((100 - (AVG(CurrentPerm)/MAX(CurrentPerm)*100)) AS INTEGER) AS SkewFactor
FROM DBC.TableSize
WHERE DatabaseName='[databasename]'
AND TableName= '[tablename]'
GROUP BY 1;

Comments

Popular posts from this blog

General information about Netezza : Default Error details

Minus in Teradata?...