Subject Re: [firebird-support] endless sweep
Author Ferda Brabenec
Ann W. Harrison wrote:
>>Ferda Brabenec wrote:
>>
>>
>>>thanks for the info. The sweep finished after 5 days.
>>>I am a bit puzzled by the fact, that indices play such a big role in sweep
>>>process. Is it because they contain references to already deleted records?
>>>
>
> Alexandre Benson Smith wrote:
>
>>I don't remember the real reason why sweep take a long time to run if
>>you have a lot of duplicates, I think because the entire duplicate chain
>>should be reached to look for the records on the data page, I am sure
>>someone will jump in and explain the real reason with acuracy.
>>
>
>
> Here's the quick version. The index contains information for all
> records in the table, including records that have been deleted and not
> garbage collected. Records are normally stored from the front of the
> table to the back, and garbage collected in the same order (FIFO). A
> new duplicate index value is stored at the beginning of the list of
> duplicates (LIFO). When the sweep finds a record to delete, it must
> also find the corresponding index entry. It takes The first record it
> sees is almost certainly going to be the last one in the chain of
> duplicates, so it has to look at each one of the n-thousand duplicates.
> In a bad case, you empty the cache
>
> Regards,
>
> Ann

Ann and Alex, thank you for your replies.
What can be done about low-selective FK indices in this matter?

Regards, Ferda