Secondary indexes are used to query a table that uses a column that is not normally queryable, such as a non primary key column. The benefit of an index is fast, efficient lookup of data that matches a given condition. Storage Attached Indexes (SAI) are a new type of Cassandra index now available in Datastax Enterprise and Astra, created to achieve the goal of efficient and simpler filtering via the creation of secondary indexes.Get Started
Secondary indexes allow you to query additional fields outside the Cassandra partition key. Using SAI, you do not need to create custom tables just to cater to particular query patterns. You can create a table that is most natural for you, write to just that table, and query it any way you want. Your queries are not restricted by your primary key.Next concept: Defining SAI indexes
After creating your database, a keyspace, and one or more tables, use CREATE CUSTOM INDEX ... USING 'StorageAttachedIndex' DDL commands to define one or more SAI indexes on the table that you wish to index.Next concept: Querying your table
Once the index has been created, it is simply a matter of querying the table and specifying the SAI-indexed columns.
SAI Indexes are supported by DataStax Enterprise 6.8.3 and later (see the DSE release notes), as well as DataStax Astra. They are also on the roadmap to be added to OSS Cassandra in the near future. See the Cassandra Enhancement Proposal (CEP-7) for more details.Next: Skill Building
Try out Cassandra indexing with SAI for yourself - query tables based on non-primary key columns quickly and easily. Give it a try!
Follow this short tutorial to get started quickly with using indexes on DSE or Astra.See the docs
Storage-Attached Indexing is a highly-scalable, globally-distributed index for Apache Cassandra®.See the docs
The future of indexing in Apache Cassandra is now GA in Astra, DataStax Enterprise 6.8.3 and soon in Apache Cassandra™.Read More