Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 12 Jan 2007 @ 14:05:26 GMT


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


Subj:   Re: Table skew and Primary Index
 
From:   Castelli Emanuel Alejandro

How do you obtain the skew of the table?

I did this:

     CREATE SET TABLE table_a
          (
           TableCode CHAR(5),
           TableData VARCHAR(995),
           loaddate DATE)
     PRIMARY INDEX ( TableCode );

Then, I filled it with 2000 rows.

Then, I try this query:

     select
        cast((cast((maxrows - avgrows) as decimal(18,5))
            / (nullif(maxrows,0)))*100 as decimal(9,3)) AS Rowskew,
        cast(MAX(sub.nbr_rows) as decimal(12,0))  AS maxrows,
        cast( AVE(sub.nbr_rows)as decimal(18,5))  AS avgrows

     from
     (
        select
           hashamp(hashbucket(hashrow(tablecode))) as primaryamp,
           count(*) nbr_rows
        from
           table_a
        group by 1
     ) sub;

And this is the results:

     Rowskew   maxrows        avgrows
     38,657       27         16,56250

If this is right, there is a 38 (aprox) of skew in the table.


I'm do it well?


Thanks all.

Castelli, Emanuel Alejandro
Desarrollo DataWarehouse - IBM Argentina



     
  <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