Home » Cassandra Drop Index

Cassandra Drop Index

by Online Tutorials Library

Cassandra DROP Index

DROP INDEX command is used to drop a specified index. If the index name was not specified during index creation, then index name is TableName_ColumnName_idx.

Syntax:

Or


Rules for dropping an Index

  • If the index does not exist, it will return an error unless you use IF EXISTS which returns no operation.
  • During index creation, you have to specify keyspace name with the index name otherwise index will be dropped from the current keyspace.

Example:

Let’s take an example to demonstrate how to drop index on a column. Here we drop the created index to a column “student_name” in the table “student”. The name of the keyspace is “tutoraspire”.

Cassandra Drop index 1

Index is dropped from the column “student_name”.

Note: You can verify that the index is dropped or not, by using the DROP index command once again. It will show a message that index is already dropped.

Cassandra Drop index 2

You can see that index is not anymore on the table.


Next TopicCassandra batch

You may also like