Subject Re: [firebird-support] Re: use of -USE_ALL_SPACE
Author Ann Harrison

> As I understand it when a record is deleted a new primary version with a
> mark (a flag) is put on it indicating that fact and the previous version of
> the record is copied on another location (same page if there is room or
> another page if there is not)
> Is that true?

More or less. A new "deleted stub" record - a header with no data - is
created and stored on the record's home page. If there's not room on
the home page for the deleted stub, then the oldest version of the record
on the page will be moved elsewhere.

It's probably worth noting, for those who are thinking about implementing
relational database managers, that records can be relocated on page

The record number (RDB$DB_KEY and all its aliases) is the value
used in indexes to identify a specific record. That number consists of
a pointer page identifier - the ordinal number of a row in RDB$PAGES for
pointer pages for that table - plus the offset on the pointer page that
contains the page number of the record's home page, plus the offset
of an index on that page that contains the offset and length of the data
on page. So...

1) Reorganizing data on a page just requires swapping values in the index
for that page to maintain stable record numbers.

2) All versions of a record use the same record number.

3) Updating a record does not require changing all the indexes on the
table. If the key doesn't change, neither does the index.

However, once a record has been deleted and garbage collected, its
record number is released and will be reused, so record numbers are
not stable outside of a single transaction - unless you use a switch
to make record numbers stable for your connection. Record numbers
will change after a gbak restore.

Good luck,


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