Using multiple indexes

About using multiple indexes.

For example purposes, let's say you can create multiple indexes, for example on album and title columns of the playlists table, and use multiple conditions in the WHERE clause to filter the results. In a real-world situation, these columns might not be good choices, depending on their cardinality, as described later:

CREATE INDEX album_name ON playlists ( album ); 
CREATE INDEX title_name ON playlists ( title ); 
SELECT * FROM playlists 
      WHERE album = 'Roll Away' AND title = 'Outside Woman Blues' 
      ALLOW FILTERING ;

When multiple occurrences of data match a condition in a WHERE clause, Cassandra selects the least-frequent occurrence of a condition for processing first for efficiency. For example, suppose data for Blind Joe Reynolds and Cream's versions of "Outside Woman Blues" were inserted into the playlists table. Cassandra queries on the album name first if there are fewer albums named Roll Away than there are songs called "Outside Woman Blues" in the database. When you attempt a potentially expensive query, such as searching a range of rows, Cassandra requires the ALLOW FILTERING directive.