Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 14 Oct 2009 @ 09:12:31 GMT


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


Subj:   Integer data types vs. Decimal(n,0) - which is better?
 
From:   Boris Mogilevsky

To all,

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

Here is the information for comparison:

     DECIMAL(n)

                 Number
     n           of Bytes     Range
     1 to 2          1            99 thru 99
     3 to 4          2            9,999 thru 9,999
     5 to 9          4            999,999,999 thru 999,999,999
     10 to 18        8            999,999,999,999,999,999 thru 999,999,999,999,999,999
     19 to 38       16            99,999,999,999,999,999,999,999,999,999,999,999,999
                                        thru 99,999,999,999,999,999,999,999,999,999,999,999,999

Number of Bytes Range

     BYTEINT     1     -128 thru 127
     SMALLINT    2     32768 thru 32767
     INTEGER     4     2,147,483,648 to 2,147,483,647
     BIGINT      8     9,223,372,036,854,775,808 thru 9,223,372,036,854,775,807

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

Another interesting case - Identity column. Teradata 12.0 Manual lists multiple data types:

     BIGINT
     BYTEINT
     DECIMAL(n,0)
     INTEGER
     NUMERIC(n,0)
     SMALLINT

and recommends either DECIMAL or NUMERIC without detailed justification.


Thank you,

Boris Mogilevsky,
Teradata Consultant.



     
  <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