Subject | Re: [firebird-support] How recompute all indexes |
---|---|
Author | Thomas Steinmaurer |
Post date | 2005-02-03T13:10:11Z |
>>instead of daily backup/restore I'd like to recompute automatically allHuh, "system-generated indexes" that is. ;-)
>>indexes, something that will generate following script for isql:
>>
>>alter index A inactive;
>>alter index A active;
>>...
>>alter index Z inactive;
>>alter index Z active;
>>
>>Is there any solution with standard command line programs - isql, gpre ?
>
>
> As Martijn has mentioned, you could write a selectable stored procedure
> which queries the rdb$indices system table and returns a result set
> where one record represents one ALTER INDEX ... statement.
>
> The problem is that you only can catch user-defined indexes that means
> you aren't able to deactivate/activate underlying indexes of a primary
> key constraint, for instance.
>
> Only a backup/restore cycle will re-build the B-tree of an index used by
> a primary key constraint entirely.
>
> The whole thing is a bit different if you don't want to re-build the
> index, but recompute its selectivity by using the SET STATISTICS ...
> statement. That should work with user-defined indexes as well, AFAIK.
Thomas.