Is the Cassandra secondary index improved if a partition key is specified?

For secondary index queries that have a partition key specified in the WHERE clause, does the secondary index search perform all nodes in the cluster or only the node of the specified partition key?
If the latter is true, then the secondary index will also work well for fields with high power (only for queries that satisfy the partition key).

EDIT: for example, for the following feed scheme, requesting a specific feed (specified by feed_id) to retrieve existing or deleted feeds should be very efficient:

CREATE TABLE my_feed ( feed_id int, item_id timeuuid, is_deleted boolean, data text, PRIMARY KEY (feed_id, item_id) ) WITH CLUSTERING ORDER BY (item_id DESC); CREATE INDEX my_feed_is_deleted_idx ON my_feed (is_deleted); ==> SELECT * FROM my_feed WHERE feed_id=1 AND is_deleted=false; --efficient? 
+3
source share
2 answers

If you first press the section key, it will not be a wide range operation. Only the target section will be deleted. If you have wide rows with many rows in a section, a secondary index will be an effective way to filter them out when a section is hit.

+2
source

When and when you do not need to use the secondary index and why it is considered here: http://www.datastax.com/documentation/cql/3.1/cql/ddl/ddl_when_use_index_c.html

0
source

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


All Articles