Cassandra - SASI Index

What is SASI index?

  • SASI indices offer improvements in performance, resource utilization, and functionality.
  • The key innovation that enables these enhancements is that–as the name implies–the index is attached to the SSTable itself, rather than being relegated to a separate table. This means the read path requires a single pass to read both the index and the underlying data.
  • SASI indices still follow the same query pattern as traditional indices, and therefore you should use them with caution for applications where performance and availability are critical.
  • Note: it is experimental feature. Datastax does not support it as of DSE 5.1
cqlsh:demo> create table user(id int primary key, fname text, lname text);
cqlsh:demo> CREATE CUSTOM INDEX ON demo.user(lname)  USING 'org.apache.cassandra.index.sasi.SASIIndex';
cqlsh:demo> insert into user(id, fname, lname) values (1, 'tom', 'mitchell');
cqlsh:demo> select * from user where lname like 'mitch%';

Reference: http://docs.datastax.com/en/dse/5.1/cql/cql/cql_reference/cql_commands/cqlCreateCustomIndex.html