db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Weber <karl.webe...@googlemail.com>
Subject Space requirements on disk
Date Sun, 09 Oct 2011 08:19:47 GMT
Hi,

I wonder, how much space derby will use on disk for each row of a table, and 
how much space will be used for each field (column value).

Is it possible to give rules of the following kind:

Every field of type INTEGER will take N bytes (N=4?), 
every field of type VARCHAR(X) will take I*X+J bytes (I, J =?), 
every field of type VARCHAR with NULL value will take K bytes, 
every row will take the sum of all field-widths plus L bytes,
...

In case VARCHAR is UTF-8 encoded it will already help to say that the length 
of a field of that type is the length in UTF-8 encoding plus J bytes.

I already found this [1] article but I am not sure that I quite understand it. 
I would conclude, that a field of type INTEGER would use 9 bytes, i.e. more 
than twice the number of bytes the value itself has... (1 byte for the status, 
4 bytes for the fieldDataLength and 4 bytes for the fieldData (of type 
INTEGER). What is the length of a CompressedInt, by the way?

From the article I don't really understand the relation row <-> record and 
column-value <-> field.

Thanks in advance,

Karl

[1] http://db.apache.org/derby/papers/pageformats.html

Mime
View raw message