What Is a Storage-Attached Indexing (SAI) in Apache Cassandra?
SAI attaches index data to immutable SSTables. Cassandra can select a selective indexed predicate and query token ranges/replicas in rounds to satisfy a read.
How the Storage-Attached Indexing (SAI) Algorithm Works
SAI attaches index data to immutable SSTables. Cassandra can select a selective indexed predicate and query token ranges/replicas in rounds to satisfy a read.
When to Use Storage-Attached Indexing (SAI)
Cassandra 5 supported non-primary-key searches, including selected combinations of filters and data types.
How to Create a Apache Cassandra Storage-Attached Indexing (SAI)
Review data quality, existing structures, feature support, build time, and deployment requirements before creating an index on a production table.
CREATE CUSTOM INDEX IF NOT EXISTS orders_status_sai ON orders (status) USING 'StorageAttachedIndex';Storage-Attached Indexing (SAI) Query Example
This example demonstrates the matching query shape. Check the execution plan to confirm that the engine can use the index.
SELECT order_id FROM orders WHERE status = 'OPEN' LIMIT 100;Queries Supported by Storage-Attached Indexing (SAI)
Cassandra 5 supported non-primary-key searches, including selected combinations of filters and data types. A similar-looking predicate may not use the same access path; operators, expressions, key order, and data type all matter.
Read Performance, Storage, and Write Costs
Adds disk, build, memory, and write costs; distributed reads may still contact many token ranges. Indexes reduce some search work but require storage and add maintenance to writes.
Storage-Attached Indexing (SAI) Limitations and Common Mistakes
SAI behavior is release-specific; validate types, operators, collection support, and index state.
Do not assume that an index being present means the optimizer chose it or that the query became selective.
How to Measure and Tune Storage-Attached Indexing (SAI)
Use selective predicates and limits, monitor index build/replica state, and test cluster-scale latency.
Compare representative plans and timings before and after, including concurrent writes and realistic data volumes.
Storage-Attached Indexing (SAI) Questions
Will the database always use this index?
No. The optimizer weighs selectivity, estimated costs, statistics, cache state, and the amount of data returned.
What should I verify before production?
Confirm version support, query compatibility, write overhead, build/rollback procedures, and index behavior during backup and recovery.
Official Apache Cassandra Index Documentation
Check Apache Cassandra documentation: Indexing concepts for release-specific requirements and supported operators.