Subject Re: [firebird-support] total records and total versions bigger than expected
Author Ann W. Harrison
Juan Jose Ochoa wrote:
>
> Can someone tell me please why the statistics of the table say I have
> 8272 records when I only have 30. This morning it said that I had
> 80000~ when I really had about two hundred.
>

Gstat counts all records in the database, including those that are
marked as deleted but have not yet been removed. Records that are
marked as deleted are not actually removed until after the end of all
transactions that started before the delete was committed. Even when
that condition is meet, the record is only garbage collected when some
transaction tries to read it, so gstat may be counting records that are
awaiting garbage collection.

Your stats show a transaction that's been around while more than 6500
other transactions have come and gone.

Oldest transaction 304318
Oldest active 304319
Oldest snapshot 301818
Next transaction 308396

As an aside, gstat also counts all index entries, including those that
represent records that have been deleted but not garbage collected. As
a result, gstat will sometimes report duplicates in unique or primary
key indexes - no transaction can see both entries, but the index does
have two entries for the same value.

Regards,


Ann