NoSQL vs SQL – A Time for Change?

nosqlvssqlSQL (Structured Query Language) was created in the 1970’s to give relational databases a way to store data and communicate, and is very popular worldwide.  NoSQL, in contrast, refers to a newer type of non-relational databases which do not use SQL and are gaining popularity.

Get a solid introduction to SQL server databases with this online Udemy course!

There is an intense debate between developers as to the merits of each system, even making its way to Google I/O 2012 in a debate titled SQL vs NoSQL: Battle of the Backends.  Each has its own strengths and weaknesses, but some predict that NoSQL may eventually replace SQL.

So, just what are these differences?  Let’s take a look at some of the key features of NoSQL and how it differs from SQL.

Why might NoSQL perform better than SQL?

There are several reasons to believe that non-relational databases are more suited to the modern age than relational databases.

The relationships and tables that make up SQL databases can, for large organizations, number in the millions.  Combine this with millions of users doing lookups in these tables and the system can suffer major performance issues, as Google and Amazon discovered the hard way before switching to non-relational systems.

In addition, large-scale programming projects using complex data types and hierarchies, such as XML, are difficult to incorporate into SQL.  These data types, which can contain objects, lists, and other data types themselves, do not map well to tables consisting of only rows and columns.

On the other hand, smaller projects and organizations typically function just fine with SQL.  While it may be difficult in some cases, mapping complex objects using tables can be done and there are powerful tools available, such as the Oracle database system, which are very effective.  SQL and NoSQL systems can both perform well when managed by competent administrators, but the best choice will depend on how it will be used and the skills of the people who will be using it.

Learn the basics of the Oracle database developer with this FREE Udemy tutorial!

With that in mind, let’s take a look at some features of NoSQL designed to get around some of the shortcomings of SQL.

NoSQL Database Data Types and Features

Most NoSQL databases contain the following four data types:

Document databases, which allow a key to be paired with a document.  Documents can hold a variety of objects like key-array and key-value pairs, as well as other documents.

Key-value stores, simple databases which store information in the form of attributes (keys) and values.  In some cases, values can have types like string and integer.

Graph stores store data about networks.

Wide-column stores are made for handling large amounts of data in the form of columns.

Understand everything you need to know about SQL servers with this online tutorial.

NoSQL databases scale up horizontally, adding more servers to deal with larger loads.  SQL databases, on the other hand, usually scale up vertically, adding more and more traffic to a single server.  Auto-sharding lets NoSQL systems automatically share data across servers, without needing to perform some complex coding maneuvers.  This balances the load across several servers, providing a more robust system in the event of a crash of a particular server.

Programming today is often done iteratively, with small steps being made gradually that can affect the whole project.  This does not translate well to SQL servers, which demand that you define your schemas before adding any information.  Adding a new category to a table, for example, can become a time-consuming process when it is done late in a programming project.

NoSQL is much more flexible, not using schemas defined beforehand.  This allows users to add information and make changes at any time without disrupting the system or needing to transfer a large amount of data.

Study up for the SQL Server 2012 Certification Exam with this comprehensive Udemy course.

How do you feel about using NoSQL over SQL, or vice versa?  Share your thoughts in the comments below!