Subject Re: [firebird-support] Re: TempDirectories and ALTER INDEX ACTIVE
Author Mark Rotteveel
On 8-6-2012 18:07, Ann Harrison wrote:
> On Fri, Jun 8, 2012 at 11:24 AM, Alec Swan <alecswan@...> wrote:
>
>> Thanks Vlad, but this is too complicated to give as a guidance to our
>> customers. However, it sounds like rebuilding an index cannot require more
>> space that the database size itself, right?
>
>
> On a bad day, yes it could. To have a day that bad, you'd have to have
> keys that are most of the size of the record, with columns that are often
> null, zero, or contain values much smaller than the declared size of the
> column. There may be a situation during the merge phase of the sort when
> there's more than one copy of each record.

Question out of curiosity: why does an index rebuild actually require a
sort? I would think that for an index rebuild this would be sufficient:

* deactivate index
* clear index
* for each record (sequential read of all pages?)
* insert column value into index
* activate index

These steps would not require any additional temporary space.
--
Mark Rotteveel