Cassandra is a NoSQL data base. Some core features that are provided by Cassandra are -
- High write performance
- High scalability
- Fault tolerant
- Linear scale performance
- Easy data distribution
The Cassandra data model contains -
- Keyspaces - A keyspace is the container of all data in Cassandra. Replication is specified at the keyspace level.
- Tables - Every table should have a primary key, which can be a composite primary key.
- Columns - A column contains the key value data in Cassandra.
Cassandra provides CREATE TABLE, ALTER TABLE, and DROP TABLE statements for data definition and provides INSERT, UPDATE, SELECT, and DELETE statements for data manipulation. The ‘where’ clauses in Cassandra have restrictions. Certain filters in the where clause can result in cluster wide scans which are not desirable.
While doing data modeling for your application, some things to keep in mind would be -
- Start with what kind of queries you will be performing on the database.
- Denormalize when you can.
- Data should be spread evenly across the cluster. This can be achieved by picking the right partition key. The partition key is the first element of the primary key. Data is partitioned by the first part of the primary key and clustered by the remaining part.
- Minimize the number of partitions that need to be accessed in your read queries.
No comments:
Post a Comment