473,670 Members | 2,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How much space does a certain Data-Type need?

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
Nov 12 '05 #1
3 20826
"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
Nov 12 '05 #2
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


Nov 12 '05 #3
> > 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" <jb******@ngi.d e> wrote in message
news:t4******** ****@banzhaf.dn salias.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.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3048
by: SP | last post by:
I've production sql server 7 sp3 on windows NT. I had a 8GB data file of which 5GB were used and 3GB were unused. I wanted to take back the unused 3GB. So I did the following with EM GUI: 1. I tried to "truncate fre space from end of the file". Didn't truncate the file. I believe there was no empty space at the end of the file. 2. Next I chose the option to "shrink file to 5GB". And to my horror the data file instead of taking just...
5
2324
by: MX1 | last post by:
Here's an interesting one. I have a database that has user level security invoked. The design is normalized and I have one field in particular called Rep ID. Any thoughts on how I can allow all the reps to have read-only access to the DB BUT somehow restrict each REP to only see data or records that have his or her REP ID associated with them. Basically, there is a table of clients and a bunch of other tables, income, sales, etc. that I...
3
1710
by: adgnews | last post by:
I have a problem converting a program from Vb.net VS2003 to VS2005. I process a xml-file with an inline schema. In 2003 no problem. In 2005 I have 2 problems: 1) BIG space="preserve" problem. Suddenly the spaces are a problem during processing (The following text is not allowed in this context: ' '). Without the space="preserve" (or default) it works okay, but what to do now since I can't influence the dataformat.
0
1249
by: bay_dar | last post by:
I have an ASP.NET application with vb that I would like to use a confirmation box with, but only if certain conditions are met. In my case I would only want this msgbox to show up if a user entered a start and end range in a form, where the difference between the ranges is greater then 10. Only the start point is required, so no confirmation box is required if the ending point is not entered either. I downloaded a nice confirmation...
1
1886
by: xixi11 | last post by:
Hi I wanted to sum data in one field and output the data in another new field. For example, my data item is like this: clientId form location value 1111 1 2 22.5 1111 2 3 22 1111 3 4 55 1111 4 1 22 1112 ...
2
1932
by: enambo | last post by:
In MS Access, i would to give the locking system to certain user, by which they can enable or disable to work on certain data entry or reports. How can i work on that? Kartik
11
1783
by: cindyfaith | last post by:
I have one question regarding a code I wrote to parse a data file My code looks like this open($FILE, "C:\\data\\NCI sample.txt") or die "oh oh can't open"; open(OUT, ">C:\\data\\parsedNCI.txt"); while ($line = <$FILE>) {
3
6629
by: Mateo | last post by:
(As.Net 1.1 framework!) Hi! So, I have problem as described in subject. Here is source code:
4
1362
by: Prodian | last post by:
Im trying to parse a recv from a telnet session then only grab certain data. Heres an example of the recv that Im storing into a string: Internet 204.189.124.205 0 001a.a01f.4e5a ARPA Vlan122 The only part I want is the mac address which is in bold. Im trying to parse it while running it into a for loop so when it gets to the 4th section it will store that in another string. But its not working, anybody have any ideas?
9
1826
by: Jonathan Austin | last post by:
My question is basically how would I be able to assign certain data automatically in a pattern (i.e. If employee1 is Alpha, employee2 is Bravo, employee3 is Charlie so on and so forth). How would I go about this?
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5684
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2042
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.