Subject | Re: [firebird-support] How recompute all indexes |
---|---|
Author | Thomas Steinmaurer |
Post date | 2005-02-03T13:06:45Z |
Hi,
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.
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com
> instead of daily backup/restore I'd like to recompute automatically allAs Martijn has mentioned, you could write a selectable stored procedure
> 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 ?
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.
--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com