Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 14 Oct 2009 @ 10:11:47 GMT


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


Subj:   Re: Integer data types vs. Decimal(n,0) - which is better?
 
From:   Dieter Noeth

Boris Mogilevsky wrote:

  what would be the considerations for choosing either Integer or Decimal(n,0) data type for a column.  


- You can store a larger range of values within the same number of bytes in an integer

- You might specify an exact number of digits for a decimal

- Calculations on integers are truncated, whereas decimals are rounded


  The cases which would be of interest are - column has been chosen to become a PI, SI or it is not an indexed one.  


see above.

For PI there's no difference because integer and (dec(n,0)) hash to the same value.


  Another interesting case - Identity column. Teradata 12.0 Manual lists multiple data types ... and recommends either DECIMAL or NUMERIC without detailed justification.  


Maybe this is from V2R1 when there was no BIGINT yet.

An integer might easily run out of number when the default batch value of 100.000 is used:

     2000 AMPs * 100.000 = 200.000.000

After 10 restarts it hits the limit.

So the actual decision is just BIGINT vs. DEC(18,0).

Which one to choose, see above.


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