cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dikang Gu <dikan...@gmail.com>
Subject Re: A difficult data model with C*
Date Tue, 08 Nov 2016 06:48:57 GMT
Agree, change the last_time to be descending order will help, you can also
TTL the data, so that the old records will be purged by Cassandra.

--Dikang.

On Mon, Nov 7, 2016 at 10:39 PM, Alain Rastoul <alf.mmm.cat@gmail.com>
wrote:

> On 11/08/2016 03:54 AM, ben ben wrote:
>
>> Hi guys,
>>    CREATE TABLE recent (
>>      user_name text,
>>      vedio_id text,
>>      position int,
>>      last_time timestamp,
>>      PRIMARY KEY (user_name, vedio_id)
>> )
>>
>>
> Hi Ben,
>
> May be a clustering columns order would help
> CREATE TABLE recent (
> ...
> ) WITH CLUSTERING ORDER BY (last_time DESC);
> So you can query only the last 10 records
> SELECT * FROM recent WHERE vedio_id = xxx  LIMIT 10
>
> See here http://www.datastax.com/dev/blog/we-shall-have-order
> --
> best,
> Alain
>



-- 
Dikang

Mime
View raw message