I'm storing linked words in a
Cassandra v2 cluster and I'm having a hard time doing efficient reads. I'm trying to fetch the top X rows with the highest counter value.
- Cassandra doesn't store the rows in any ordered way, so simply adding
LIMIT Xto the CQL query returns random-ish rows.
ORDER BYcommand in CQL only works for columns that are (part of) the key.
OrderPreservingPartitionerdoesn't exist anymore in Cassandra v2.
At the moment, when doing a read, I have to fetch all rows and manually select those X rows with the highest counter value. This literally slows some queries down by 100x, because even mildly popular words often have hundreds of thousands of words linked to them, not to mention the waste of bandwidth and other resources.
Are there any clever techniques to make this more efficient?