| From: | Steve Adams |
| Date: | 25-Sep-2000 10:47 |
| Subject: | Should NUMBER datatype be given scale and precision? |
|
|
You should always specify the scale and precision if you can. It does not always
matter, but sometimes it does, so it is a good habit to develop. It matters when
storing values that have been computed using floating point arithmetic. If so,
the result may have a lot more precision than you require, and that precision
wastes storage space, which in turn causes extra I/O. Consider the following
example. N1 is a NUMBER column; and N2 is a
SQL> create table numbers (n1 number, n2 number(2));
Table created.
SQL> insert into numbers values (log(2, 4), log(2, 4));
1 row created.
SQL> select * from numbers;
N1 N2
---------- ----------
2 2
SQL> select vsize(n1), vsize(n2) from numbers;
VSIZE(N1) VSIZE(N2)
---------- ----------
21 2
Convinced?
|
![]() |
In schema definition for number columns, defining "Number" or "Number(x,x)" is more efficient. How does space management handle this? Will there be any performance degradation if "Number" datatype is used. Please support your theory.
|