Cassandra secondary index
- A primary index is global, although a secondary index is local.
- To query a users by their secondary indexed value or their email every machine has to query its self target of users.
- One query, five reads from disk.
Using a secondary index
- Using SQL,after defining a table you can create an index on a column.
- You can also index a collection column.
- Secondary indexes are used to query a table using a column that is not general query table.
- Secondary indexes are difficult to use and can impact performance greatly.
- The index table is stored on every node in a cluster, so a query involving a secondary index if multiple nodes are accessed it can quickly become a performance nightmare.
- A general rule of thumb is to index a column with low cardinality of few data.
- Before creating an index, be aware of when and when not to create an index.