I would like to disable (and later rebuild) all indexes for a given table in an HSQLDB. I know this feature from SQL Server, where you can just write
ALTER INDEX ALL ON MyTable DISABLE;
to disable all indexes for a table and then rebuild them with
ALTER INDEX ALL ON MyTable REBUILD;
I am not even sure, if HSQLDB supports disabling and enabling a single index.
HSQLDB does not have this feature.
You can perform SHUTDOWN COMPACT to recreate all indexes on all tables.
I do not think this is indeed supported. However you can drop index and then create it again. Something like this:
DROP INDEX index [IF EXISTS];
ALTER TABLE MY_TABLE ADD INDEX MY_INDEX
Take a look on this doc for more info.
来源:https://stackoverflow.com/questions/12567327/disable-and-rebuild-an-index-in-hsqldb