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

Home -> Community -> Usenet -> c.d.o.server -> Re: space usuage of number datatype

Re: space usuage of number datatype

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 29 Jun 1999 16:52:31 GMT
Message-ID: <3778f9b1.17540612@newshost.us.oracle.com>


A copy of this was sent to gongji_at_my-deja.com (if that email address didn't require changing) On Tue, 29 Jun 1999 16:00:41 GMT, you wrote:

>Hello:
> I have one question about space usuage of number datatype
>column. I was told that the database assigns a number datatype as
>fixed space, for example, 21 bytes, nomatter how small digital in
>number column.
> I have lots of table which contains lots of numeric column,
>but each column has very small digits. If Oracle database really
>assigns the numeric column like that, my tables eat huge space.
> I know database can smartly assign space to the varchar
>column, that is if the varchar length is small, it gives a small
>space, if varchar length is big, it gives more. I am just wondering
>whether database also treats number datatype column like that?
> Does someone know this?
> Thank you very much.
>
>Jin
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

Server concepts manual, chapter 6, section on "Number Datatype" includes this (and much more) about the number datatype:

<quote>
Oracle stores numeric data in variable–length format. Each value is stored in scientific notation, with one byte used to store the exponent and up to 20 bytes to store the mantissa. (However, there are only 38 digits of precision.) Oracle does not store leading and trailing zeros. For example, the number 412 is stored in a format similar to 4.12 x 10^2, with one byte used to store the exponent (2) and two bytes used to store the three significant digits of the mantissa (4, 1, 2). <quote>

so, the number 9999999 takes more storage on disk then the number 1000000000000 will. It is not fixed length

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Jun 29 1999 - 11:52:31 CDT

Original text of this message

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