incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shrikar archak <shrika...@gmail.com>
Subject CLUSTERING ORDER CQL3
Date Wed, 11 Dec 2013 21:44:20 GMT
Hi All,

My Usecase

I want query result by ordered by timestamp DESC. But I don't want
timestamp to be the second column in the primary key as that will take of
my querying capability

for example

create table demo(oid int,cid int,ts timeuuid,PRIMARY KEY
(oid,cid,ts)) WITH CLUSTERING ORDER BY (ts DESC);

Queries required:

I want the result for all the below queries to be in DESC order of timestamp

select * from demo where oid = 100;
select * from demo where oid = 100 and cid = 10;
select * from demo where oid = 100 and cid = 100 and ts >
minTimeuuid('something');

I am trying to create this table with CLUSTERING ORDER IN CQL and getting
this error

cqlsh:viralheat> create table demo(oid int,cid int,ts timeuuid,PRIMARY
KEY (oid,cid,ts))     WITH CLUSTERING ORDER BY (ts desc);
Bad Request: Missing CLUSTERING ORDER for column cid

In this document it mentions that we can have multple keys for cluster
ordering. any one know how to do that?

Go here Datastax
doc<https://app.getsignals.com/link?url=http%3A%2F%2Fcassandra.apache.org%2Fdoc%2Fcql3%2FCQL.html%23createTableStmt&ukey=agxzfnNpZ25hbHNjcnhyGAsSC1VzZXJQcm9maWxlGICAgKDPyrUJDA&k=303c1e0a-f921-4526-832a-225d31a9f80e>


If I make the timestamp the second column then I cant have queries likes

select * from demo where oid = 100 and cid = 100 and ts >
minTimeuuid('something');

Thanks,

Shrikar

Mime
View raw message