Hi,
Almost right, but ...
numeric and date/time are internally represented by BCD digits (each a half
byte). For numeric add a half byte for the sign so the fomula is
integer((n+1)/2) regardless whether result is an integer or not.
Time takes only 3 bytes (hhmmss -> 6 digits each a half byte).
Missing float and double have 4 and 8 Bytes each.
For LOB's you have to add up to something between 100 and 200 bytes overhead
(depends on max LOB size).
This is physical storage for the pure data. To calculate storage
requirement, you have to add some page-, container-, tablespace- and
index-overhead.
See $HOME/sqllib/doc/de_DE/index.htm?openu p=admin/c0004800.htm for details.
Requirements of a program to store a row are different. E.g. you need 26
bytes to store a timestamp in a c program because you usually get the
character representation.
2003-11-06-19.19.19.000000
123456789012345 67890123456
HTH
Joachim Banzhaf
Mark A wrote:
"Oliver Stratmann" <st*****@gmx.de > wrote in message
news:bo******** *****@ID-180535.news.uni-berlin.de... Hello All!
I'm looking for a description of the needs of space for a certain
data-type. How much space does e.g. a NUMERIC(1,0)- field take? (??? Bytes?)
Is there a listing in the DB2-online-documentation?
I couldn't find any?
I'm sorry to bother you folks!
Bye!
oli
numeric - (n+1)/2 bytes rounded up to the next byte if result is not an
integer
smallint - 2 bytes
integer - 4 bytes
bigint - 8 bytes
date or time - 4 bytes
timestamp - 10 bytes
char - n bytes
varchar - n+2 bytes
all nullable columns - add 1 byte