SASI Query Execution
SSTable Attached Secondary Index (SASI) attaches index structures directly to SSTables, ensuring that the index lifecycle is synchronized with the base data. Like legacy 2i, SASI uses a scatter-gather coordination model for queries that lack a partition key constraint. The key architectural difference is in storage: SASI indexes live alongside SSTables rather than in a separate hidden table.
Scatter-Gather Execution Model
Section titled “Scatter-Gather Execution Model”SASI uses the same scatter-gather pattern as legacy 2i:
Each node executes a local SASI scan against its per-SSTable index components, then performs base table reads for matched partition keys. The coordinator aggregates all partial results and returns them to the client.
Multi-Predicate Queries
Section titled “Multi-Predicate Queries”For queries with multiple indexed predicates, SASI performs single-pass intersection within each SSTable. Rather than performing separate index lookups and joining results, SASI intersects the index streams during the scan, reducing intermediate result set size.
Implementation Characteristics
Section titled “Implementation Characteristics”| Characteristic | Implementation |
|---|---|
| Storage structure | Per-SSTable index components (co-located with data) |
| Compaction | Synchronized with base table compaction |
| Query coordination | Static scatter-gather |
| Multi-predicate | Single-pass intersection within SSTables |
| Memory model | Unbounded during query execution |
| Index build visibility | No gossip propagation; status requires manual inspection |
Because SASI index components are created and compacted alongside the base SSTables, the index is never out of sync with the data due to independent compaction cycles. This addresses one consistency limitation of legacy 2i.
Differences from Legacy 2i
Section titled “Differences from Legacy 2i”| Aspect | 2i | SASI |
|---|---|---|
| Storage | Hidden table (separate replication) | Per-SSTable components (co-located) |
| Compaction coupling | Independent | Synchronized with base table |
| Multi-predicate | Separate lookups, joined at coordinator | Single-pass intersection per SSTable |
| Memory during query | Unbounded | Unbounded |
| Scatter-gather coordination | Yes | Yes |
Limitations
Section titled “Limitations”Scatter-gather at cluster scale
Like 2i, every global SASI query contacts one replica per token range. Latency is bounded by the slowest node and degrades as cluster size grows.
| Limitation | Implication |
|---|---|
| All-node contact for global queries | Latency degrades linearly with cluster size |
| Tail latency sensitivity | One slow node delays all results |
| Unbounded coordinator memory | Large result sets accumulate before returning to client |
| No failed index detection via gossip | Queries silently skip nodes with failed index state |
Related Documentation
Section titled “Related Documentation”- Secondary Index Queries Overview - Execution model comparison and query design guidelines
- Secondary Index (2i) - Legacy hidden-table scatter-gather index
- SAI - Adaptive range reading index (recommended for new deployments)
- Index Overview - Index type selection criteria