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

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

NUMERIC data type always takes up 22 bytes. Alternatives?

From: <Val_Gamerman/Victoria_Financial.VICTORIA_FINANCIAL_at_lnn.com>
Date: Fri, 20 Oct 2000 15:29:00 -0400
Message-Id: <10655.119880@fatcity.com>


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 -- ~ 7bln records.

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 - 14:29:00 CDT

Original text of this message

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