Subject Re: Stored Procedures, Isolation Levels, a nd Transactions
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "Epstein, Ed" <eepstein@c...>
wrote:
> The points about the indexes are very interesting. I have about 7
indexes
> on the table. I limited the indexes to columns i really needed them on.
> None of the indices are unique though. I have a single constraint
for the
> table that does not involve the column being updated. How do I go about
> deactivating an index before running the SP. After that how do I go
about
> activating again afterwards. My big question of course, is that when I
> activate after a couple million updates how long will it take to
rebuild the
> index and how will that affect select statements being run on it?

Firtsly, AFAIU for update important are indices on updated columns
only. For delete - all. Secondly, metadata changes (incliding indices
deactivation/activation) should be made in single-user access only.
System index can be deactivated by updating it's column
rdb$index_inactive to 1 in rdb$indices table and commit. Activated -
by updating it back to 0 and commit. Note while system index is
inactive at least constraint which is based on it can be violated.
Perhaps more unpleasant things, don't know. One-time index rebuilding
will consume MUCH less time than multiple rebuilding during mass
update of indexed column and collection of garbage in the index after it.

Best regards,
Alexander