1

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 ?

Aaron
  • 55,518
  • 11
  • 116
  • 132
David
  • 3,538
  • 9
  • 39
  • 50

2 Answers2

2

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!

k_rus
  • 2,959
  • 1
  • 19
  • 31
Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
1

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.

Aaron
  • 55,518
  • 11
  • 116
  • 132
  • Thanks Aaron. maybe my question is confuse. My question is about the type of the index: if I dont specify anything in the query to create index, what kind of index will be used (SAI, SAISI, secondary index, search index, ...) – David Oct 10 '21 at 18:17
  • @David edit made. – Aaron Oct 10 '21 at 18:46