I want to make an efficient compound key to work WHERE
queries with multiple conditions like:
SELECT * FROM playlists
WHERE
album = 'We Must Obey'
artist = 'Fu Manchu' AND
title = 'Ojo Rojo'
ORDER BY song_order ASCENDING ALLOW FILTERING
For this query, does it make sense to make album, artist and title secondary indexes? Would making the 3 of them secondary indexes be redundant? Would a single secondary index (the most common in this case, the artist column) suffice?
If most of your queries on albums and titles will come with a condition on artist, then I would say a single secondary index on artist would be sufficient since an artist is less likely to have more than a hundred albums. In this case, queries having an EQ on artist are very selective.
If many of your queries might solely on albums and titles without identifying an artist, then I would say building three secondary indices is necessary.