Rebuilding a Firebird index

After looking at Damyan Ivanov posix script to rebuild indexes, I saw that he was using an undocumented “implementation artifact” (thanks to Dmitry Yemanov for confirming this) to rebuild indexes (including PK and FKs indexes). What he does is to call ALTER INDEX xxxx ACTIVE, where xxxx is an already active index!

Beside the fact that trying to activate an already active  index sounds “weird”, this will make Firebird to rebuild the index. Seems to be an easy way to rebuild PK/FK/UNIQs indexes (since they cannot be deactivated).

BTW, Damyan’s script will rebuild all indexes containing “text” fields in their keys. He created the script for the case where a previously created database needs to be run in a Firebird compiled with different version of the ICU libraries.

1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.50 out of 5)
Loading...

Leave a Reply