Apache Kassandra. Advantage and disadvantage of the Secondary Index

I read that the Secondary Index in Kassandra is a completely useless feature. In fact, this makes writing to the database much slower, you can only find the value by the exact index, and you need to query all the servers in the cluster to find the value by index. Can someone tell me about benifit, will this be the reason for using the Secondary Index?

+4
source share
1 answer

Querying is made more flexible by adding secondary indexes to table columns. You can add indexed columns to the WHERE SELECT .

When to use secondary indexes
You want to query columns that are not a primary key and are not part of a composite key. The column that you want to request has several unique values ​​(I mean, for example, that you have the City column, this is a good choice for secondary indexing, because many people will form the same city, date of birth, however, would not be such a good choice).

When to Avoid Secondary Indexes
Trying not to use secondary indexes in columns contains a high count of unique values, and this will produce several results.

As always, check the documentation:

+8
source

Source: https://habr.com/ru/post/1490152/


All Articles