David
David

Reputation: 3658

What is the default index in Cassandra?

I am using cassandra DSE 6.8. I know that there are several indexes used in Cassandra: 2nd index, SASI, SAI, search index, ...

When I create an index on a column:

CREATE INDEX status_idx ON table_name (status);

What is the name of default index ?

Upvotes: 1

Views: 609

Answers (2)

Erick Ramirez
Erick Ramirez

Reputation: 16353

There is only one native index in open-source Cassandra, commonly referred to as secondary index. All indexes created with the CQL command CREATE INDEX are secondary indexes.

Alternatively, the SSTable-attached secondary index (SASI) is a custom index and therefore needs to be explicitly created with the keyword CUSTOM and the custom class SASIIndex specified:

CREATE CUSTOM INDEX ... USING 'org.apache.cassandra.index.sasi.SASIIndex'

Note that SASI is considered experimental by the Cassandra community and is disabled by default as I've explained in this post -- https://community.datastax.com/questions/12403/. They are not recommended for use in production.

DataStax Enterprise which ships with production-certified distributions of Apache Cassandra has an advanced DSE Search feature that allows users to perform complex full-text Solr searches on CQL tables indexed with Lucene. The custom indexes are created with the class Cql3SolrSecondaryIndex:

CREATE CUSTOM INDEX ... USING 'com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex'

Astra DB, a fully-managed cloud-native Cassandra-as-a-service, includes the new Storage-Attached Indexing (SAI), a globally-distributed index for Cassandra. Indexes are created using the custom class StorageAttachedIndex:

CREATE CUSTOM INDEX ... USING 'StorageAttachedIndex'

The SAI enhancement in not yet available in open-source Cassandra but has been donated by DataStax and is awaiting acceptance by the Cassandra project (see CEP-7, CASSANDRA-16052). Cheers!

Upvotes: 2

Aaron
Aaron

Reputation: 57798

In this case, since a name has been provided, it will be status_idx. If a name was not provided, one is auto-generated based on the table and column:

table_name + _ + column_name + _idx

So in this case, it would be:

table_name_status_idx

Edit

Ahh…I get it now.

CREATE INDEX creates a secondary index.

CREATE CUSTOM INDEX creates a SASI index.

Upvotes: 1

Related Questions