MySQL vs. NoSQL Databases: To Relate or Not to Relate?

When it comes to databases, you really only have two choices: relational databases or nonrelational databases.

For years, relational databases, such as SQL, have ruled the data airwaves, but nonrelational databases, such as NoSQL, have recently started to gain popularity.

These two types of databases are very distinct. Choosing the right one for your data-driven projects or applications requires careful consideration of resources and business objectives.

Relational databases use something called SQL (Structured Query Language) to extract value and results from the stored data. The data is contained within tables, and each table contains rows of data that fit a predefined format. Some of the most popular SQL databases include Oracle, Microsoft SQL Server, Postgres and MySQL.

Recently, nonrelational databases, which don’t use the query language or the structure found in SQL databases, have emerged and use the appropriate moniker of NoSQL (i.e., "not SQL"). These databases don’t use tables, and they have a much looser structure than traditional SQL databases. Popular NoSQL databases include MongoDB, CouchDB, BigTable, RavenDB and Cassandra.

The challenge most business IT leaders face is deciding which database type best suits their organizations or applications.

Why MySQL Might Make Sense

MySQL was introduced in 1995 as an open-source relational database. It continues to be one of the most popular database choices and is used by numerous companies and web applications, including Zappos, MTV Networks and Facebook.

MySQL is extremely good for structured data. Each table has a primary key, which allows for relationships to be made between tables. Using SQL, the database’s query language, data can easily be searched, added and deleted with a variety of well-documented commands. MySQL is good for fast inserts of data and complex joins between different data sets and can return search results in a structured manner.

MySQL is best used within heavy-duty transactional applications because it is quite stable and maintains a better integrity of data. SQL databases follow the computer-science database ACID model: atomicity, consistency, isolation and durability.

The biggest advantage of MySQL is its robust support community. This is similar to WordPress, which has gained dominance in large part because it, too, is open-sourced and backed by a large support community.

Why NoSQL Might Make Sense

NoSQL is relatively new to the database market. It is designed for scalability and performance. There is no set size for the data that NoSQL databases contain, unlike MySQL, which has predefined field sizes. Given that it is flatter in structure, NoSQL is also much more elastic and can quickly grow in size.

Instead of the traditional "joins" used by relational databases, NoSQL follows a key-value structure, which means that queries can be used to find linked data. NoSQL databases are nonrelational and often document-oriented databases. They also use key-value pairs and have wide-column stores (versus the table-based structure of SQL databases).

NoSQL proponents say the databases are easier to set up because they don't require time-intensive and detailed data models. Also, NoSQL has become the database of choice for Big Data implementations. When used with MapReduce, NoSQL becomes more powerful as well as cost effective, because large data sets can be processed and analyzed across clusters of computers or nodes.

However, because NoSQL is new, it doesn’t have the community support that MySQL does. Similarly, there aren’t as many reporting tools available, which can add additional costs to a NoSQL implementation, since organizations will have to purchase reporting solutions separately. There’s also a resource problem due to a scarcity of database administrators who are familiar with NoSQL.

The Question of Scalability

One of the biggest differences between MySQL and NoSQL is how data scales in each environment. Scalability is important because data sets tend to grow tremendously over time. And more companies are capturing different types of data and even pulling in legacy data stores. As more processing requirements grow, you need to have infrastructure that can handle volumes of data and increased processing demands.

With MySQL databases, scalability is vertical. That means if you want to give your MySQL database more oomph, you need to give it more power in the form of more RAM or CPUs. This can be costly, and there is a limit to the amount of RAM and CPUs you can add.

Conversely, with NoSQL databases, you scale horizontally. Instead of building more powerful boxes, you simply add more servers to the data cluster. With Big Data and MapReduce, building up the number of nodes adds to the processing power. One of the key advantages of a NoSQL environment is that servers can be added using less expensive hardware.

So Which Database Should You Choose?

If you work with lots of structured data and need to have ample support for your data implementations, then MySQL is the obvious choice. You will find a vast community available to help you, as well as a plethora of tools at your disposal.

If, however, you have largely unstructured data, which tends to grow exponentially, and most of your data transactions are mainly retrieval or “append” operations, you may want to consider a NoSQL approach. NoSQL is good for write-once (static) and read-many (transaction) data implementations.

Before you make any decision, be sure you talk with your application developers so you fully understand whether you need structured or unstructured data sets. Research the cost implications, and hire a consultant, partner or database analyst that understands your requirements. Do not simply make a blind decision on the type of database to use, because converting from one type to another can be a gargantuan task.