Subject Re: [firebird-support] Database Size
Author Ann W. Harrison
Priebe, Joern (GE Indust, Security) wrote:
> Hello Ann,
> thanks for the answer. Do you know how FB handles UPDATE
> statements? E.g. if I have a 1000 records with 2 Blobs each
> and I start updating all records where I set the one blog
> to <null> - will this space be deallocated? I guess it won't?

When you update the records the transaction doing the update
creates a new version of the record with the blob field value
(8 bytes) set to zero. It also creates a back version which
is a difference record containing the old blob id value and
enough information to apply that value to the current record
and recreate the old record.

When the transaction doing the update commits, and all other
concurrent transactions have ended, the back version becomes
unnecessary and will be removed - garbage collected - by the
next transaction that visits the record. As part of the
garbage collection, the system recognizes that one blob is
no longer referenced and removes it.