Subject Re: REBUILDING the INDEXES in Firebird
Author Adam
> >How to do reindexing in Firebird
> >Is there any build in SP to do OR we have to fire any SQL command
> >
> >
> >
> ALTER INDEX <indexName> INACTIVE;

The above command will not work on indices created by primary or
foreign key constraints etc, as they can not be deactivated. IIRC, you
can just run the following command to rebuild. Someone can fill in the
blanks (confirm or tell me I am crazy)

> ALTER INDEX <indexName> ACTIVE;
>
> Note: since ALTER INDEX is a DDL command it cannot be used
> inside a stored procedure.
>

Also, if you rebuilt an index, does it regenerate the statistics, or
would setting them again be a good idea?

I had a database the other week where I knew some of the indices were
skewed and the statistics were horribly out of date and "the gap" was
about 10K, so I thought it an opportune time to backup-restore. This
of course fixed it, but it left me wondering whether it could have
been fixed up by simply running a script to set every active index to
active and running sweep.

Adam