Now time to discuss about the different Data model of NoSQL Databases.
One of the most popular data model is, NoSQL Column Family Store Data Model.
Facebook’s Cassandra, Google’s BigTable Amazon DynamoDB and HBase are the most popular column stored base NoSQL Databases.
What exactly it is?
It allows you to store data with the key and mapped value to it, but these values are stored in Column Family.
A Column Family is a collection of rows, which can contain any number of columns for the each row.
You can create an unlimited columns in a row, there are no any limitations.
The row key must be unique within a column family, but the same row key can be reused in another column family.
We can also use different data types for each row key.
e.g. User-1 wants to use a Mobile Number as row key and User-2 wants to use an Email address as row key.
This is possible.
Very simple term, we can say that Column Family is a logical division of similar data.
e.g., Column Family-1 for User’s Profile and Column Family-2 for User’s Friends.
A Column family is a very similar to the Table of RDBMS.
How exactly it works?
- Keyspace: Name of the application. e.g.Gmail, Facebook.
- ColumnFamily: Structure contained unlimited columns.
- Column: Tuple with Name, Value, Timestamp.
- Key: Name of the record.
- SuperColumn: Containter of the more columns.
Each column has three attributes. The column name, column value and Timestamp. Timestamp automatically attached to the each column.
Using the Timestamp, we can also set expiring usage.
e.g. I want to delete a particular column in next 8000 second.
Realtime example is, Running a promo code or special offer for a set of users and running for the particular time. For this kind of application, we can expire a column by defining timestamp.
All the row key and column stored in the particular order.
We can also create a Super column, which adds another level of nesting to the regular column family structure.
Each Column Family store in a file and each file separately stores into Disk.
The benefit of storing data in the column, is fast searching and accessing of the data.
For example, we have two column family one for User’s Profile and second for User’s Friends.
Now I want to fetch User’s Profile data, then It accesses only one User’s Profile file which returns good performance.
Another good example is,
Cricketer’s award information. All cricketers have different award information like, International, National and State level matches.
We can store an N number of different award information for each cricketer and stores vertically into Column Family.