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

Reply via email to