NoSQL: Create your first Index on Cassandra Column

In this post, I am going to share basic details about the Cassandra Indexes.

The architecture of Cassandra Index is very similar to RDBMS Indexes.
Like, The Primary Key column is a default indexed column and don’t require to create additional index on the Primary key column.

You can use CREATE INDEX command to create an index on the particular column.
Cassandra supports the different Collection data type in which you cannot create an Index.

In the older version of CQL, Index must be created on the filtered column and without applying Index on column you cannot use that column as a filter in WHERE clause.

In the Cassandra, it is advisable to create an Index on filtered column.
In the latest version of CQL, If you are trying to access filtered data without an Index, then It generates the error like “filtering may have unpredictable performance”. Still, you can SELECT filter the data without indexes, but you should use ALLOW FILTERING option with SELECT statements.

One of the flexibility of the Cassandra Index is: you can also create a custom index by specifying storage option.

Create a sample Table:

Insert a Sample record:

SELECT Filtered data without Index:

SELECT data using ALLOW FILTERING option:

Create an Index on column:

NoSQL Cassandra Allow Filtering Option

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from