Secondary index (2i) concepts

Secondary indexing (2i) is a globally-distributed index for Apache Cassandra®, DataStax Astra DB, and DataStax Enterprise (DSE) databases.

2i is the original secondary indexing of DataStax Enterprise, but today, it suffers from poor performance and latency. If you are building new indexing, use SAI indexing instead.

2i adds column-level indexes to any CQL table column of any CQL data type, except for a counter column. However, the indexes are locally built on each DataStax Enterprise node in a cluster, so using 2i for queries results in poor performance.

A number of techniques exist for guarding against the undesirable scenario where data might be incorrectly retrieved during a query based on stale values in an index.

There are distinct conditions about when and when not to use a 2i index.

Using multiple indexes

How to use multiple secondary indexes.

Indexing a collection

How to index collections and query the database to find a collection containing a particular value.

Was this helpful?

Give Feedback

How can we improve the documentation?

┬ę 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,