Indexing a column

Steps for creating indexes on column values.

The CLI can be used to create indexes on column values. You can add the index when you create a table or add it later using the UPDATE COLUMN FAMILY command.


  1. Add an index to the birth_year column of the users column family.
    [default@demo] UPDATE COLUMN FAMILY users WITH comparator = UTF8Type
      AND column_metadata =
        [{column_name: birth_year,
          validation_class: LongType,
          index_type: KEYS
  2. Query Cassandra for users born in a given year.
    [default@demo] GET users WHERE birth_year = 1969;