database design - Cassandra sort using updatable query -
database design - Cassandra sort using updatable query -
i have info set attributes content , year. want set them in cf 'words' attributes ('content','year','frequency'). cf should back upwards next operations.
frequency attribute of column can updated (i.e. - : can run query "update words set frequency = 2 content='abc' , year=1990;), clause should contain content , year should back upwards select query "select content words year = 2010 order frequency desc limit 10;" (where clause has year) results can ordered using frequencyis kind of requirement can fulfilled using cassandra? cf construction , indexing need utilize here? queries should utilize create cf , in indexing?
to utilize order by, frequency has sec column in compound primary key (http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/select_r.html?scroll=reference_ds_d35_v2q_xj__using-compound-primary-keys-and-sorting-results). using frequency key prohibits updates value of key: "specify row update in clause including columns composing partition key. in relation supported lastly column of partition key. update set operation not valid on primary key field." (http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/update_r.html)
create table words ( content text, year int, frequency int, primary key (year, frequency)); insert words (content, year, frequency) values ('lorem ipsum dolor sit down amet', 2014, 10 ); insert words (content, year, frequency) values ('sed ut perspiciatis unde', 2010, 3 ); insert words (content, year, frequency) values ('excepteur sint occaecat', 2010, 4 ); select content, frequency words year = 2010 order frequency desc limit 2; content | frequency --------------------------+----------- excepteur sint occaecat | 4 sed ut perspiciatis unde | 3 (2 rows) database-design cassandra data-modeling datastax denormalization
Comments
Post a Comment