Not Only – SQL

Hello, everyone! I start my blog with most common trend No-SQL databases. Some of you heard about what it is, but I want to mention about more detail information without boring you. I put my references in the end of post.

Everybody knows relational databases such as MSSQL, Oracle, MySql etc. If we think opposite term, there is also no-SQLs which are not relational databases (That does not mean we do not need relational databases!). Why we need no-sqls? Recently, technology is changed and data is mass by day by. And we need to process these data and get some ideas from them. There are real-time applications (IoT) and really huge amount of data should be stored. At that point, these databases help you to store these data and process faster. But, we cannot use same syntax and language as we use in traditional SQL, because the systems are different.

So, what is advantages and disadvantages if we compare with traditional databases.

post-1-advantages-disadvantages

High Availability is one of them. Each query should be respond with success or fail. No timeout will be occured.  Read/Write Performance is greater than SQLs (depends on design). Horizontal Scale, you can add a new server on system and this system will be scaled. Schemaless, you can hold any type of data. You don’t have to define data schema before insert data. And even you have just raspery pii. You can run you no-sqls on it. Easly.

But some No-Sqls work as fire&forget. You send insert query but then you dont know when it is written on DB. So, consistency is important here. For example, like button on facebook. You dont need consistency but you have to be fast. If you have sql databases and want to transform it to no-sql databases, It little bit hard. You need some design work. No tools for that.

CAP THEOREM (Eric Brewer)

Okay, this is a computer science and I think all of software engineer should know it. But I don’t want to explain it again and again, I will give a brief what CAP is and some references to learn deeply.
CAP theorem (Brewer’s theorem) says “You can choose at most two of attributes of distributed database”.

Consistency – All nodes and servers should have same data and same time.
Availability – All queries should be respond with fail or success. No timeout.
Partition Tolerance – Data will be divided small partition and store different places. To be more secure.

So you can read and follow these links for more information;

Types of NoSQL Databases;

post-1-nosql-types

I will try some of them and share my experiences with you. But firstly look into what they offer us.

 Document Database

  • Uses again key-value pairs but values stored as «Document»
  • Multiple Formats
    • JSON
    • XML
    • BSON
  • Data is compressed
  • Can perform arithmetic, aggregate  functions on data
  • MongoDB and CouchBase are most known

Graph Base Database

  • Based on «Graph Theory»
  • Nodes-Edges instead of Key-Value
  • Uses mostly store information about network and social connections
  • Related with object-oriented applications

 

 

 

Key-Value Store

  • The simplest Type of No-Sql
  • Hash-Tables with key-value pairs
    • Key is unique
  • Operations;
    • Get (Read)
    • Insert (Create)
    • Delete (Delete)
    • Most of them no Update!

Colum Store Database

  • Fastest database in No-Sql types
    • Access,search and data aggregation
  • Data is stored in cells that are grouped in columns of data rather than as rows of data
  • Unlimited number of columns
  • Uses mostly store large amount of Data

Examples for All of Them

  • Calculating average income? -> Relational Databases
  • Building a shopping cart? -> Key-Value store
  • Storing structed product information? -> Document databases
  • Describing how a user got from point A to point B? -> Graph Base Store

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s