Let's say I have this column family called People
which has tens of thousands of rows, each with two columns: name
and country
.
Now let's say I want to query for all people living in China and I want the results to be sorted alphabetically on names.
The obvious approach would be to get all rows with the country China
using secondary indices, and then sort the returned rows on client side. However if there are many people living in China, then this approach won't be feasible.
Also, I want to paginate the rows. Again, if I simply sort all rows on client side, then pagination is trivial. But what if getting that many rows and sorting them are too expensive?
What's the best way to do this?