If I correctly understand the answers, the solution to your ordering
question is to use clustering keys.
I'm agree, but I just wanted to warn you about one limitation :  the values
of keys can't be updated, unless by using a delete and then an insert.
(In the case of your song "example", putting the rate as a key can be
tricky if the value has to be frequently updated)


Le lun. 10 oct. 2016 à 22:15, Mikhail Krupitskiy <
mikhail.krupits...@jetbrains.com> a écrit :

> Looks like ordering by multiple columns in Cassandra has few sides that
> are not obvious.
> I wasn’t able to find this information in the official documentation but
> it’s quite well described here:
>
> http://stackoverflow.com/questions/35708118/where-and-order-by-clauses-in-cassandra-cql
>
> Thanks,
> Mikhail
>
> On 10 Oct 2016, at 21:55, DuyHai Doan <doanduy...@gmail.com> wrote:
>
> No, we didn't record the talk this time unfortunately :(
>
> On Mon, Oct 10, 2016 at 8:17 PM, Ali Akhtar <ali.rac...@gmail.com> wrote:
>
> Really helpful slides. Is there a video to go with them?
>
> On Sun, Oct 9, 2016 at 11:48 AM, DuyHai Doan <doanduy...@gmail.com> wrote:
>
> Yes it is possible, read this:
> http://www.slideshare.net/doanduyhai/datastax-day-2016-cassandra-data-modeling-basics/24
>
> and the following slides
>
> On Sun, Oct 9, 2016 at 2:04 AM, Ali Akhtar <ali.rac...@gmail.com> wrote:
>
> Is it possible to have multiple clustering keys in cassandra, or some
> other way to order by multiple columns?
>
> For example, say I have a table of songs, and each song has a rating and a
> date.
>
> I want to sort songs by rating first, and then with newer songs on top.
>
> So if two songs have 5 rating, and one's date is 1st Feb, the other is 2nd
> Feb, then I want the 2nd feb one to be sorted above the 1st feb one.
>
> Like this:
>
> Select * from songs order by rating, createdAt
>
> Is this possible?
>
>
>
>
>
>

Reply via email to