cql - Cassandra range slicing on composite key -


i have columnfamily composite key this

create table sometable(     keya varchar,     keyb varchar,     keyc varchar,     keyd varchar,     value int,     date timestamp,     primary key (keya,keyb,keyc,keyd,date) ); 

what need to

select * sometable     keya = 'abc' ,     keyb = 'def' ,     date < '2014-01-01' 

and giving me error

bad request: primary key part date cannot restricted (preceding part keyd either not restricted or non-eq relation) 

what's best way solve this? need alter columnfamily? need query table keya, keyb, keyc, , date.

thank you,

andrei dharma

you cannot in cassandra. moreover, such range slicing costlier too. trying slice through set of equalities have lower priority according schema.

i need query table keya, keyb, keyc, , date.

if considering solve problem, considering having schema. suggest have keys in separate schema

create table ( timeuuid id, keytype text, primary key (timeuuid,keytype))

use timeuuid store values , range scan based on that.

create table( timeuuid prevtableid, value int, date timestamp, primary key(prevtableid,date))

guess , in way, table normalized better scalability in use case , may save lot of disk space if keys repetitive too.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -