What is NoSQL?

Niladri.Biswas
Posted by in NoSql category on for Beginner level | Points: 250 | Views : 5478 red flag

In this article we will introduce our self with the basic concept of NoSQL.We will also explore it's categories , benefits etc.

Introduction

The buzz is about NoSQL. So what it is? They say it as "Not Only SQL". So what does it signify?Let us dig the term SQL or "Structured Query Language". In a typical RDBMS system, we will encounter a proper relational structured data model where

  1. data is organized in entities(or tables)
  2. entities in the same group have the same descriptions (attributes)

But in real world, the case cannot be like so. Not all data is relational.Data can be unstructured or semistructured. Moreover,the data can grow to any extent say about yottabyte etc. When a traditional RDBMS grows out of one server, it becomes very difficult to use it since they don't scale out very well in a distributed system.The giants like Google, Yahoo, Facebook, Twitter, Amazon etc. have huge chunk of data and they are located in distributed systems for obvious reasons. A RDBMS system will fail to make a promise for scalability and performance in such a situation. Herein NoSQL will come into picture.They make promises in the following lines -

  1. Horizontal scalability
  2. Fault tolerant
  3. Preety good in handling de-normalized data
  4. Designed for high load

That being said, NoSQL fits for structure data too.What matters is that it focuses on data quantities and not on the element relationships.

So from the above discussion, we can infer that NoSQL fits both for structured as well as non-structured + semistructured data. That means it is "not only SQL" or not only it can handle structured data but semi-structured or non-structured data can fit into this model too. So it is SQL as well as non-SQL i.e. NoSQL.

Having these little information in our hand, we can start our exploration more on NoSQL.

So what is NoSQL?

From wikipedia:

"NoSQL is an umbrella of term for a loosely defined class of non-relational data stores that break with a long history of relational databases and ACID guarantees. Data stores that fall under this term may not require fixed table schemas, and usually avoid join operations. The term was first popularised in early 2009."

The relational Database peoples access the Relational Databases using Structured Query Language.That means that this query language is the main gateway to communicate with the tables, columns, rows, relationships etc. in the RDBMS parlance.

Now for the NoSql part, let us put a "Not only" in front of the last statement of the previous line( Not tables, columns, rows, relationships).This implies that NoSQL is an attempt to solve problems which cannot fit into the table/column/rows structures.This indicates that NoSQL databases will not support relationships, they are abandoning the well known RDBMS structures just because the problems has changed since their conception.

e.g. if we have our own storage system ( say a customized data exchange format e.g. xml) that can be use for storing, retriving or organizing the data and we have an API that will help to do so, we have a NoSQL is place (in layman's term).

Categories of NoSQL?

Since every NoSQL provider tries to solve a different problem, so NoSQL implementations can be categorised by their manner of implementation.

  1. Key-Value Store Database
  2. Column Family Database
  3. Document Store Database
  4. Graph Database
  5. Multivalue Database
  6. Object Database
  7. Tripple Store Database
  8. Tuple Store Database
  9. Tabular Database

Now let us introduce ourself with the above categories in the below paras.

1.Key-Value Store Database

This kind stores data in a hash table where there is a unique key and a pointer to a particular item of data.e.g.

	Key			   Value
	-----			: ------	
	Id1_Name 		: Niladri Biswas
	Id1_Citizenship 		: Indian
	
	Id2_Name 		: Mike Curz
	Id2_Citizenship 		: American

Since it is guarented to always have a unique key for a particular object, we can query the database for that unique key and get the results back from whichever node has the object.

Examples involve Rika,Dynamo etc.

Read more about it from

  1. What is a Key/Value store database?
  2. Key value stores: A Practical Overview
  3. That No SQL Thing - Key/Value stores

2.Column Family Database

A Column Family database stores data column wise rather than row-wise.In a Column Store Databse, each row which is addressed by a key contains one or more "columns".Columns are themselves key-value pairs. The column names need not be predefined, i.e. the structure isn't fixed.Columns in a row are stored in sorted order according to their keys (names).

Column family:

7DE04F9F-5398-4DC5-9BC4-66CC96A927DE <- Row
	
	Name	Location		Salary 	<- col  col  col 
	A.Reddy	India		2000 	<- val  val  val

CC29FC6D-BA52-4D98-A366-C7F666941C46 <- Row
	Name	Location		Salary	<- col  col  col
	A.Cruz	Burma		5000	<- val  val  val

Examples : Cassandra,HBase etc.

3.Document Store Database

Document database stores semi-structured or unstructured records/documents in JSON format.The informations are encoded using XML, YAML, JSON, BSON, Binary forms like PDF ,Microsoft Office documents (MS Word, Excel, and so on) etc.

The following is a simple document that we can store in a Document Store Database

{ "Question Name"  : "TSQL Beginners Challenge 3 - Find the Factorial"
  "Author"         : "Niladri Biswas"
  "Launch Date"	  : "March 15th, 2010"
  "Link"		  : "http://beyondrelational.com/modules/19/tsql-beginners/303/tsql-beginners-challenge-3-find-the-factorial.aspx?tab=info"
  "Tags"		  : ["SQL Challange","TSQL Challange", "Database Challenge"]
  "Description"	  : " This challenge though does not have any resemblance with the real time problem directly, but it measures about logical thinking. The problem is all about finding the factorial of numbers. Though it is known to most of us what a factorial is, but to recall the concept here is an example:actorial of 3 is 1*2*3 = 6 i.e. the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n." 
}

Examples : MongoDB,CouchDB etc.

4.Graph Database

This kind of NoSQL database fits best in the case where in a connected set of all nodes,edges satisfy a given predicate, starting from a given node.A classic example may be any social engineering site.

Examples : Neo4j etc.

Read more about it from here

5.Multivalue Database

MultiValue database deals with three dimensional data modelling where they focus mainly on three-dimensional data structures like Fields, Values, and Subvalues.

Suppose we have a field say Phone Number.Now that field contains two values say Mobile Phone and Landline.Further say the Landline has two kind of values which we refer as sub-values say Home Phone Number and Office Number.This is what is the concept of Multivalue Database.

Examples : jBASE etc.

Read more about it from

  1. Multivalue Database
  2. MultiValue Databases

6.Object Database

In this case, informations are represented in the form of objects

Examples : db4o etc.

7.Tripple Store Database

In a classic relational database, data is stored in records. Each record contains multiple fields. These fields contain data that may belong to some object. The relation between the field and the object it belongs to is not represented as data in the database. It is only available as metadata in the form of the column (name, datatype, collation, foreign keys). An object is not explictly modelled, but rather via a series of linked tables.

A Triple Store Database is a network of interrelated triples ("subject-predicate-object" triplets) whose predicates are part of the data themselves. Moreover, each object has an identifier that is not just an integer number that means only something inside the database only. It is a URI that may have a distinct meaning worldwide.

A triple is a record containing three values: either (uri, uri, uri) or (uri, uri, value). In the first form the triple relates one object to another, as in the fact "Vox inc. is a supplier" (Both "Vox inc.", "is a", and "supplier" are semantic subjects identified by a uri). In the second form the triple links a constant value to a subject, as in "Vox inc.'s phone number is 0842 020 9090".

Examples: Mulgara etc.

Read more about it from

  1. NoSQL Option: Triplestore Databases
  2. Semantic web marvels in a relational database - part I: Case Study
  3. When to use triple store?

8.Tuple Store Database

It is a schema free, ordered list of elements.

Examples: Apache River,Tarantool etc.

9.Tabular Database

It is a sparse, distributed, persistent multidimensional sorted mapped storage system for managing structured data that is designed to scale to a very large size of data across thousands of commodity servers. The map is indexed by a row key, column key, and a timestamp.

Examples: BigTable,HyperTable etc.

Benefits of NoSQL

Flexible data model: No pre-defined schema is allocated for NoSQL databases.The data format can also change at any point of time.This on the other hand provides extreme flexibility in the application.

Consistent, high performance:Data caching is one of the characteristics of NoSQL DBs that brings in high performance in the application.

Easy scalability:This kind of DB's are highly scalable in nature.

References

  1. What is NoSQL
  2. The Four Horsemen of NoSQL
  3. An introduction to NoSQL databases
  4. The end of SQL and relational databases?
  5. In defence of SQL
  6. NoSQL: An Overview of NoSQL Databases
  7. NoSQL - the SQL
  8. Transitioning from RDBMS to NoSQL

Conclusion

In this article, we tried to understand what NoSQL is, it's type, it's benefits etc.Hope you find this useful.Thanks for reading.

Page copy protected against web site content infringement by Copyscape

About the Author

Niladri.Biswas
Full Name: Niladri Biswas
Member Level: Platinum
Member Status: Member
Member Since: 10/25/2010 11:04:24 AM
Country: India
Best Regards, Niladri Biswas
http://www.dotnetfunda.com
Technical Lead at HCL Technologies

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)