Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Number vs. float vs. char vs. varchar2
Oracle stores numbers as variable length. I can't remember the details but
"shorter" numbers take up less space. The value 22 reported by Oracle is the
max length. Best to store numbers as numbers so you can perform math without
conversion. BTW, CHAR is fixed length, VARCHAR2 is really variable length.
Also consider generating small numeric primary keys for the table if they are
not already.
Tony
In article <6kg3gs$h2u$1_at_news1.rmi.net>,
"Roger Loeb" <rloeb_at_martech.com> wrote:
>
> Space is an issue in a very large (400 million row) table I am working with.
> I need to better understand the actual storage requirements of data stored
> as number, float, char, and varchar2, since many of the columns in this
> table could be expressed in any of these forms.
>
> Number seems to take 22 bytes. Does it really take all of that when scale
> and precision are something like 3?
>
> Float seems to take the same 22 bytes, on a machine where a float takes only
> 8 bytes. Does it take 22, 8, or something else?
>
> Many of these data elements have extensive leading zeros, i.e., there is an
> implied decimal to the left of the number. They also often have signs,
> either plus or minus. I could easily store them in a char or varchar2,
> which would "apparently" take less space than number or float. (None of
> these values need to be manipulated. They simply need to be returned on a
> query and placed in a fixed length string. If I trim the leading zeros, the
> application can easily put them back on.)
>
> So, how do I use the least amount of disk space with this kind of data?
>
> Rog
>
> --
> roger@_delete_this_to_reply_.martech.com
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Wed May 27 1998 - 14:21:47 CDT
![]() |
![]() |