Subject Re: [firebird-support] Blob size
Author Ann W. Harrison
Uwe Oeder wrote:

>Question 1. So the maximum size of a blob field is 64KB ?

As Helen said, the segment size limit is 64KB, which means that the
longest single byte stream you can send in a single call is 64KB.
However, you can send an arbitrary number of segments, each in its
own call, all stored in the same blob.

>Question 2. Does that mean that anytime you put something into a BLOB field
>64 KB are allocated for it ?

No. Nothing is allocated until you send something in, then enough
space is allocated for the blob and its header - about 16 bytes of
information about the blob that is stored with it.

>Question 3. If for instance I would save in one record's BLOB field 100 bytes
>and in another BLOB field 20 bytes that together they only occupy 120 bytes ?

They would occupy 120 bytes for data, plus 16 bytes each for
record headers, plus eight bytes each for the blob pointer in
the record, plus another four bytes of page index for each blob.

Blobs are not very practical for data that's going to be
as small as 20 bytes - unless some instances are 20 bytes and others
200 or 2000.

>Question 4. Is there anyway to save only the actual amount of bytes used
>and no more ?

As above, you've got to have a header block and a pointer
from the record and a page index entry.


We have answers.