Global Secondary Indexes¶
Global Secondary Indexes is production ready in Scylla Open Source 3.0 and Scylla Enterprise 2019.1.x
CQL supports creating secondary indexes on tables, allowing queries on the table to use those indexes. A secondary index is identified by a name defined by:
index_name ::= re('[a-zA-Z_0-9]+')
Creating a secondary index on a table uses the
CREATE INDEX statement:
create_index_statement ::= CREATE INDEX [
index_identifier')' [ USING
string[ WITH OPTIONS =
map_literal] ] index_identifier ::=
column_name| ( KEYS | VALUES | ENTRIES | FULL ) '('
CREATE INDEX userIndex ON NerdMovies (user); CREATE INDEX ON Mutants (abilityId); CREATE INDEX ON users (keys(favs));
CREATE INDEX statement is used to create a new (automatic) secondary index for a given (existing) column in a
given table. A name for the index itself can be specified before the
ON keyword, if desired. If data already exists
for the column, it will be indexed asynchronously. After the index is created, new data for the column is indexed
automatically at insertion time.
Dropping a secondary index uses the
DROP INDEX statement:
drop_index_statement ::= DROP INDEX [ IF EXISTS ]
DROP INDEX statement is used to drop an existing secondary index. The argument of the statement is the index
name, which may optionally specify the keyspace of the index.
© 2016, The Apache Software Foundation.
Apache®, Apache Cassandra®, Cassandra®, the Apache feather logo and the Apache Cassandra® Eye logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.