Subject RES: [firebird-support] Internal Firebird question.
Author Fabiano

You right, it uses free space when the page are touched.

I make a mistake. The old data continues on datapage but pointers are
updated. Now it shows me 3 records.


[] Em nome de Dmitry Kuzmenko
Enviada em: segunda-feira, 21 de maio de 2012 15:01
Assunto: Re: [firebird-support] Internal Firebird question.

Hello, Fabiano!

Monday, May 21, 2012, 9:08:04 PM, you wrote:

F> I have a question about how Firebird internally updates a record.

it uses versioning.

F> Insert into test(cod, name) values (1, 'Big description 1');
F> Insert into test(cod, name) values (2, 'Big description 2');
F> Insert into test(cod, name) values (3, 'Big description 3');

well, 3 records in table.

F> Delete from teste where cod=2;

here engine created new version named as "delete stub" for one of the
records. It keeps "old" record because it can be still visible and
required for running snapshot transactions, even if they are not
exist now.

F> Whell, next I insert a new record:
F> Insert into test(cod, name) values (2, 'Small 2');

4-th record.

F> After that I reinspect the FDB file and it not REUSE the old record that
F> contains "Big description 2". It stays here and a NEW record was create
F> hold the new record 2 that are SMALL than old record.

yes. deleted or updated records are "new versions", and "old versions"
can be considered garbage and removed from pages only when engine
will be sure that these "old versions" are not needed for any
running transactions.
Old versions will be cleared during select or update statement that
will "touch" this records.

F> Why? Why Firebird does not reutilize that space?

see below.

F> I tested with only one connection in a test database with only this

versioning works always, there is no "single-user mode" in the
Firebird engine.
please read


Dmitry Kuzmenko,

[Non-text portions of this message have been removed]