DROP INDEX

Drop the named index.

Drop the named index.

Synopsis

DROP INDEX IF EXISTS keyspace.index_name
Table 1. Legend
  • Uppercase means literal
  • Lowercase means not literal
  • Italics mean optional
  • The pipe (|) symbol means OR or AND/OR
  • Ellipsis (...) means repeatable

A semicolon that terminates CQL statements is not included in the synopsis.

Description

A DROP INDEX statement removes an existing index. If the index was not given a name during creation, the index name is <table_name>_<column_name>_idx. If the index does not exists, the statement will return an error, unless IF EXISTS is used in which case the operation is a no-op. You can use dot notation to specify a keyspace for the index you want to drop: keyspace name followed by a period followed the name of the index. Apache Cassandra drops the index in the specified keyspace, but does not change the current keyspace; otherwise, if you do not use a keyspace name, Cassandra drops the index for the table within the current keyspace.

Example

DROP INDEX user_state;

DROP INDEX users_zip_idx;

DROP INDEX myschema.users_state;