Subject Re: [firebird-support] Rebuilding primary key index?
Author Ann W. Harrison
Kjell Rilbe wrote:
>
> So, when *IS* it relevant to rebuild a Firebird index, which I
> understand happens when an index is deactivated and then reactivated?
>

Index pages are recombined when twp adjacent pages are each less
than (roughly) 30% full. Sorry, I don't remember the exact number
and am not going to look it up. That reduces - but does not
eliminate - the problem of releasing and index page and instantly
needing it back again because the recombined page will only be
60% full. If you've got a table from which records are regularly
deleted across the range of the index, gstat may tell you that
the index pages are less than 50% full on average. That might
be a reason to rebuild the index - unless you expect to create
new records with key values all across the range of the index.

In fact, the only reason I can think of for rebuilding an index
is that you want a better fill level - whether the source of the
problem is deleted records or creating the index before loading
a large amount of data in random order relative to the index.

And some people just like doing maintenance and sleep better
knowing their indexes have been scrubbed.

Cheers,

Ann