Subject Re: [firebird-support] touching a deleted record
Author Ann W. Harrison
Nick Upson wrote:
>
> When Firebird deletes a record, it doesn't remove the record from
> the database. Instead, it creates a new version of the record,
> without data, marked as deleted. When the transaction that did
> the delete commits, and all concurrent transactions exit, the next
> transaction that touches the record removes the deleted stub and
> all earlier versions of the record.
>
> which I, hopefully, understand.
>
> I don't know is what counts as 'touching' the record,

Using the "References" privilege - which can include selecting
the record directly or in an aggregate, foreign key checking,
triggered actions that read the record, or a non-indexed search.
In some cases - superserver with deferred garbage collection -
just referencing one record that requires garbage collection
will cause the garbage collect thread to clean up all records
on the page.
>
> select count(*) touches all records but if my only access into the
> table is via an index and I never sweep, when does the deleted stub
> get removed?

When you backup the database, unless you use the -g switch.

Regards,


Ann