DROP INDEX
This page documents the preview version (v2.21). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.
Synopsis
Use the DROP INDEX statement to remove an index and all of its data from the database.
Syntax
Diagram
Grammar
drop_index ::= DROP INDEX [ IF EXISTS ] index_name;
Where
index_nameis an identifier (possibly qualified with a keyspace name).
Semantics
- An error is raised if the specified
index_namedoes not exist unlessIF EXISTSoption is present. - Associated objects to
index_namesuch as prepared statements will be eventually invalidated after the drop statement is completed.
Examples
ycqlsh:example> CREATE TABLE users(id INT PRIMARY KEY, name TEXT) WITH transactions = { 'enabled' : true };
ycqlsh:example> CREATE INDEX users_by_name ON users(name);
ycqlsh:example> DROP INDEX users_by_name;