Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 29 Oct 2005 @ 09:11:37 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Skewed tables and VARCHAR column
 
From:   Michael Larkins

Although Brian's book uses the select, it does not necessarily indicate that skew does not exist. It only provides a ratio of the total number of rows to the number of unique row hash values in the table. It does not tell you how the data is distributed. Actual distribution determines the existence or absence of skew. Even with a unique primary index a degree of skew can still exist.

So, instead of this request:

     > select (count(*) (FLOAT)) /
     >        count(DISTINCT HASHROW (col1, col2...coln)) from TableA;

I have written one that looks like this:

     SELECT HASHAMP(HASHBUCKET(HASHROW(col1,col2...coln)))
            ,count(*)
     from table_name
     GROUP BY 1
     ORDER BY 1;

This will count the number of rows on each AMP and provides a more accurate perspective on the actual distribution of the data. It can also be used with one or more colunms from the table to test the distribution based on the actual data versus creation a new table, checking the current space utilization on each AMP, copying the data and then checking the space used after the copy.


Hope this helps,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor
Teradata SQL - Unleash the Power



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023