Indexing in Cassandra with Storage Attached Indexes (SAI)

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
Introduction-SAI

Introduction

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

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
Defining SAI indexes
Querying your table

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

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!

More Resources

Items related to SAI

SAI quick start
SAI

SAI Quick Start

Follow this short tutorial to get started quickly with using indexes on DSE or Astra.

See the docs
What is SAI
SAI

What is SAI?

Storage-Attached Indexing is a highly-scalable, globally-distributed index for Apache Cassandra®.

See the docs
Blog
SAI

Better Cassandra Indexes for a Better Data Model: Introducing Storage-Attached Indexing

The future of indexing in Apache Cassandra is now GA in Astra, DataStax Enterprise 6.8.3 and soon in Apache Cassandra™.

Read More