Skip to content

Instantly share code, notes, and snippets.

@peijiehu
Created August 26, 2018 22:15
Show Gist options
  • Save peijiehu/1413e7ccf7474eece6b81e624dfdb112 to your computer and use it in GitHub Desktop.
Save peijiehu/1413e7ccf7474eece6b81e624dfdb112 to your computer and use it in GitHub Desktop.
cassandra_index

When to Use An Index?

Cassandra's built-in indexes are best on a table having many rows that contain the indexed value. The more unique values that exist in a particular column, the more overhead you will have for querying and maintaining the index. For example, suppose you had a playlists table with a billion songs and wanted to look up songs by the artist. Many songs will share the same column value for artist. The artist column is a good candidate for an index.

When Not to Use An Index?

Do not use an index in these situations:

  • On high-cardinality columns because you then query a huge volume of records for a small number of results
  • In tables that use a counter column
  • On a frequently updated or deleted column
  • To look for a row in a large partition unless narrowly queried
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment