ALTER INDEX statement
Available since: v3.0.0
The ALTER INDEX statement is used to alter a defined index on a table.
SurrealQL Syntax
ALTER INDEX @name ON TABLE @table
COMMENT @string |
PREPARE REMOVE |
DROP COMMENT
PREPARE REMOVE clause
As the name implies, an ALTER INDEX PREPARE REMOVE statement alters an index to prepare it for removal. This statement sets up a step in which the index has been decommissioned (prepared for removal), but not yet removed. At this point, SELECT queries along with the EXPLAIN clause to monitor query performance without the index.
ALTER INDEX my_index ON my_table PREPARE REMOVE;
SELECT ... FROM my_table EXPLAIN;
REMOVE INDEX my_index ON my_table;
If removing the index is no longer desired, it can be restored to a useful state by using a REBUILD INDEX statement.
REBUILD INDEX my_index ON my_table;
See also