Saturday 15 October 2016

Cassandra - Designing the Data Model - II

CQL - Cassandra Query Language

CREATE KEYSPACE KEYSPACE_SimpleStrategy

  WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };
CREATE KEYSPACE "KEYSPACE_NetworkTopologyStrategy"  WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'dc1' : 3, 'dc2' : 2};
SELECT * FROM system.schema_keyspaces;

Modelling by Query

RDMS models data by relationship, whereas
Cassandra models data by query

Indexing

Cassandra organises the data in rows. For each row a rowKey is assigned.
As we know, a row must reside in a single node, i.e., a rowKey determines the node location of the row.
PRIMARY_KEY is used to partition the rows.
compound primary key
composite partition key

Secondary Index - adds overhead


No comments:

Post a Comment