Cassandra Data Modeling - Design Concept -


i new cassandra, trying understand concepts. please me : here have data of citizens language , state.

create table citizens_by_state_and_language(  citizenid bigint,  state varchar,  language varchar  primary key((language,state), citizenid) ); 

i can query this

select * citizens_by_state_and_language language = 'spanish' , state = 'kentucky' 

however these queries wont work:

select * citizens_by_state_and_language language = 'spanish'; select * citizens_by_state_and_language state = 'kentucky'; 

now make working can create indexes on these, below:

create index on citizens_by_state_and_language(language); create index on citizens_by_state_and_language(state); 

i not sure whether right approach in designing or should create separate tables(one query per table) each of these queries?. please throw lights concepts.

that because language , state partition keys.

in cassandra can't query on single partition key, have specify both of fields so, why first query work.

cassandra keys not easy understand, this article explains what's behind keys , this one example.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -