Subject Re: [firebird-support] Blob size
Author Helen Borrie
At 02:36 PM 17/01/2004 +0200, you wrote:
>It says in the documentation a BLOB field has None Range/Precision. But a
>64K segment limit.
>Question 1. So the maximum size of a blob field is 64KB ?

No. A blob can be many segments.

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

No. Segment size doesn't really mean a whole lot with dynamic SQL because
the engine pleases itself about segment size. Segments are just chunks of
disk space. The engine creates a new blob every time you insert or update
data to a blob column. It starts by allocating and filling one segment of
the size it chooses, then it keeps on allocating and filling segments as
required until the whole stream is stored.

>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 ?

See below.

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

That I don't know for sure because I don't know how the engine decides on
the size of a segment. I seem to think 80 bytes is the minimum size of a
segment, a sort of QWERTY phenomenon (80 btyes = width of one line of
console text).

A few reference bytes are stored in each segment, too (Ann or Ivan will be
able to tell you what they are).