Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: NUMERIC data type always takes up 22 bytes. Alternatives?

Re: NUMERIC data type always takes up 22 bytes. Alternatives?

From: <MTPConsulting_at_aol.com>
Date: Fri, 20 Oct 2000 19:57:19 EDT
Message-Id: <10655.119898@fatcity.com>


Actually, that is a maximum. Only as many bytes (2 digits per byte) as you need will be actually stored plus, I believe, 1/2 byte for the sign and power.

Marc Perkowitz
MTP Systems Consulting

In a message dated 10/20/2000 4:00:14 PM Central Daylight Time, Val_Gamerman/Victoria_Financial.VICTORIA_FINANCIAL_at_lnn.com writes:

<< Gurus,  

 In all the years that I have dealt with Oracle (both as a developer and a  DBA -- altogether 3 years) I never stopped to pay much attention to the  fact that when you define a field in a table as NUMERIC, no matter what  precision and scale you define for it, you are always going to get 22 bytes  allocated for this field in the table. While I see the benefit of being  able to store really large numbers in the database, most of the time it's  a waste.  

 Let's say I wanted to store a record for each person living on the planet

 The record would only have one field -- a unique ID of this person,  starting with 1,2,3, ...  

 Thus the max number I would want to store would be 7,000,000,000, plus  planning for potential population growth - ~35 bln in 10 years.  

 If I allocate 22 bytes for each of these numbers I would end up needing  approx. 140Gb right away.  

 If there was a way for me to only allocate 6 bytes (plenty of space for  billions), I would only need 40Gb.  

 My question is: is there a way to do it in Oracle?  

 I just went through documentation for 7.3.4 and this is the only data type  available (there others but they are just synonyms of NUMERIC).  

 If somebody can shed the light on this I would be very appreciative. Received on Fri Oct 20 2000 - 18:57:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US