Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 15 Jan 2002 @ 21:21:13 GMT


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


Subj:   Re: SQL Tuning - Spool Space Problem
 
From:   Dieter N�th

Hi Jay,

i think you're problem was the JOIN, you join on NON-Unique columns on both sides of your join-condition. This will result in a kind of product-Join joining _all_ the records from Table1 with the value X with _all_ the records from Table2 with the value X, e.g. 5 records with BAN 1 in Table_1 and 4 records with BAN 1 in Table_2 results in 4*5 records in Spool. The working final version is creating DISTINCT list of BANs _before_ doing the join.

A hint using DISTINCT or GROUP BY:

DISTINCT is usually better if there's just a small number of rows/value, GROUP BY performs better, if there's a large number of rows/value. The reason: DISTINCT redistributes the spool _before_ eliminating duplicates,

GROUP BY eliminates duplicates in the first step locally on the AMPs before redistributing the spool for the final aggregation. There is even a formula somewhere in the manuals to calculate the number of values which fit in the local aggregate cache.

Dieter



     
  <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