Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 28 Dec 2006 @ 18:54:59 GMT


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


Subj:   Re: How to prevent high skewness between large_tableA join large_tableB
 
From:   Stover, Terry

Don't do a select * unless you really need all the columns, extra columns just take up more space in the spool files. Make sure you have collected stats on both tables PI's, then collect joint stats on large_tableB columns (b1, b2). If the join is highly skewed a NUSI won't help.

You're probably getting a merge join, and the large table B needs to be redistributed based on the join columns. If (b1, b2) are have a highly skewed distribution then the join will be highly skewed. There's not a whole lot you can do about it unless you can break the join down into 2 separate subqueries using different join criteria. If (b1, b2) are default values you can use a query like:

     Select .....  Where b1 <> 'default_value' and b2 <> 'default_value'
     UNION ALL
     Select .....   Where b1 = 'default_value' and b2 = 'default_value'

(you may be able to hard code the A table parameters and avoid a join, or use a different join path that's not so skewed)



     
  <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