Subject Re: [firebird-support] Garbage Collection
Author Ann W. Harrison
dr_john_mp wrote:
> Running Firebird 2 Superserver on a Linux machine with sweep interval
> at the default 20,000.

On a production server it makes more sense to set the interval to
zero and schedule the sweep during slow times.
> We have a couple of programms that run overnight (nothing else running
> (now)) that pull in data from another system. The first of these has
> a problem because the above differences increase continually through
> the time the program runs to well over the 20,000 sweep interval.
> Somwhat surprisingly when the program closes the differences remain
> high, even though there is no activity on the database. 20 minutes
> later a second program starts and the difference between all 3 values
> drops to almost zero.
> Am I right in saying that garbage collection is triggered by the
> difference when the next transaction starts, rather than when the
> oldest ones close ?

Nothing will remove record versions that aren't garbage and any record
version that a running transaction can possibly read isn't garbage.
The algorithm is the same for snapshot and read/write read committed
transactions: garbage collection must leave the last committed version
of a record created by a transaction that committed before any active
transaction started, and all subsequent versions.