vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| "Oliver Stratmann" <stratmo@gmx.de> wrote in message news:bob9l3$1d3sa6$1@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 |
| |||
| 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?openup=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 12345678901234567890123456 HTH Joachim Banzhaf Mark A wrote: > "Oliver Stratmann" <stratmo@gmx.de> wrote in message > news:bob9l3$1d3sa6$1@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 |
| ||||
| > > 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 > "Joachim Banzhaf" <jbanzhaf@ngi.de> wrote in message news:t4gq71-ust.ln1@banzhaf.dnsalias.net... > 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). I got TIME wrong (sorry, I must have lost my head), but the others I listed are correct. Maybe you did not understand my explanation of numeric (which is also called decimal), but it was correct. I didn't "miss" float or double. Only weirdo's use that stuff so I excluded them on purpose. BTW you misspelled formula. |
| Thread Tools | |
| Display Modes | |
|
|