data modeling - how to handle search by unique id in Cassandra -


i have table composite primary key. name,description, id

primary key (id, name, description) 

whenever searching cassandra need provide 3 keys, have use case want delete, update, , based on id.

so created materialized view against table, , reordered keys have id first can search based on id.

but how delete or update record id ?

it's not clear if using partition key 3 columns, or if using composite primary key.

if using partition key 3 columns:

create table tbl (     id uuid,     name text,     description text,     ...     primary key ((id, name, description)) ); 

notice double parenthesis need 3 components identify data. when query data id materialized view need retrieve both name , description fields, , issue 1 delete per tuple <id, name, description>.

instead, if use composite primary key id being partition key:

create table tbl (     id uuid,     name text,     description text,     ...     primary key (id, name, description) ); 

notice single parenthesis, can issue 1 delete because know partition , don't need else.

check this post clear explanation on primary key types.

another thing should aware of materialized view populate table under hood you, , same rules/ideas data modeling should apply materialized views.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -